Skip to content

Commit

Permalink
Apply suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuda-Chen committed Dec 16, 2024
1 parent 4d9aefd commit 7a7c07b
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions virtio-snd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 _
};

Expand Down

0 comments on commit 7a7c07b

Please sign in to comment.