diff options
-rw-r--r-- | include/tinyalsa/asoundlib.h | 12 | ||||
-rw-r--r-- | pcm.c | 31 |
2 files changed, 35 insertions, 8 deletions
diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h index 8c215ce..35d7457 100644 --- a/include/tinyalsa/asoundlib.h +++ b/include/tinyalsa/asoundlib.h @@ -66,12 +66,16 @@ struct pcm; /* Bit formats */ enum pcm_format { + PCM_FORMAT_S8 = 1, PCM_FORMAT_S16_LE = 0, - PCM_FORMAT_S32_LE, - PCM_FORMAT_S8, + PCM_FORMAT_S16_BE = 2, PCM_FORMAT_S24_LE, - - PCM_FORMAT_MAX, + PCM_FORMAT_S24_BE, + PCM_FORMAT_S24_3LE, + PCM_FORMAT_S24_3BE, + PCM_FORMAT_S32_LE, + PCM_FORMAT_S32_BE, + PCM_FORMAT_MAX }; /* Bitmask has 256 bits (32 bytes) in asound.h */ @@ -214,15 +214,30 @@ static int oops(struct pcm *pcm, int e, const char *fmt, ...) static unsigned int pcm_format_to_alsa(enum pcm_format format) { switch (format) { - case PCM_FORMAT_S32_LE: - return SNDRV_PCM_FORMAT_S32_LE; + case PCM_FORMAT_S8: return SNDRV_PCM_FORMAT_S8; - case PCM_FORMAT_S24_LE: - return SNDRV_PCM_FORMAT_S24_LE; + default: case PCM_FORMAT_S16_LE: return SNDRV_PCM_FORMAT_S16_LE; + case PCM_FORMAT_S16_BE: + return SNDRV_PCM_FORMAT_S16_BE; + + case PCM_FORMAT_S24_LE: + return SNDRV_PCM_FORMAT_S24_LE; + case PCM_FORMAT_S24_BE: + return SNDRV_PCM_FORMAT_S24_BE; + + case PCM_FORMAT_S24_3LE: + return SNDRV_PCM_FORMAT_S24_3LE; + case PCM_FORMAT_S24_3BE: + return SNDRV_PCM_FORMAT_S24_3BE; + + case PCM_FORMAT_S32_LE: + return SNDRV_PCM_FORMAT_S32_LE; + case PCM_FORMAT_S32_BE: + return SNDRV_PCM_FORMAT_S32_BE; }; } @@ -230,11 +245,19 @@ unsigned int pcm_format_to_bits(enum pcm_format format) { switch (format) { case PCM_FORMAT_S32_LE: + case PCM_FORMAT_S32_BE: case PCM_FORMAT_S24_LE: + case PCM_FORMAT_S24_BE: return 32; + case PCM_FORMAT_S24_3LE: + case PCM_FORMAT_S24_3BE: + return 24; default: case PCM_FORMAT_S16_LE: + case PCM_FORMAT_S16_BE: return 16; + case PCM_FORMAT_S8: + return 8; }; } |