diff --git a/virtio-snd.c b/virtio-snd.c index 3ecad06..e496617 100644 --- a/virtio-snd.c +++ b/virtio-snd.c @@ -64,31 +64,34 @@ enum { VIRTIO_SND_S_IO_ERR, }; +/* Unit: Hz */ +#define SND_PCM_RATE \ + _(5512) \ + _(8000) \ + _(11025) \ + _(16000) \ + _(22050) \ + _(32000) \ + _(44100) \ + _(48000) \ + _(64000) \ + _(88200) \ + _(96000) \ + _(176400) \ + _(192000) \ + _(384000) + /* supported PCM frame rates */ enum { -#define _(rate) VIRTIO_SND_PCM_RATE_##rate - _(5512) = 0, /* 5512 Hz */ - _(8000), /* 8000 Hz */ - _(11025), /* 11025 Hz */ - _(16000), /* 16000 Hz */ - _(22050), /* 22050 Hz */ - _(32000), /* 32000 Hz */ - _(44100), /* 44100 Hz */ - _(48000), /* 48000 Hz */ - _(64000), /* 64000 Hz */ - _(88200), /* 88200 Hz */ - _(96000), /* 96000 Hz */ - _(176400), /* 176400 Hz */ - _(192000), /* 192000 Hz */ - _(384000), /* 384000 Hz */ +#define _(rate) VIRTIO_SND_PCM_RATE_##rate, + SND_PCM_RATE #undef _ }; /* supported PCM frames rates mapping */ int pcm_rate_tbl[] = { -#define _(rate) [VIRTIO_SND_PCM_RATE_##rate] = rate - _(5512), _(8000), _(11025), _(16000), _(22050), _(32000), _(44100), - _(48000), _(64000), _(88200), _(96000), _(176400), _(192000), _(384000), +#define _(rate) [VIRTIO_SND_PCM_RATE_##rate] = rate, + SND_PCM_RATE #undef _ };