Added snd_pcm_get_format_name() to alsa-lib.

This commit is contained in:
Jaroslav Kysela 1999-12-11 20:36:13 +00:00
parent a3b8114c84
commit d33c93096a
2 changed files with 37 additions and 0 deletions

View file

@ -57,6 +57,7 @@ int snd_pcm_format_little_endian(int format);
int snd_pcm_format_big_endian(int format);
int snd_pcm_format_width(int format); /* in bits */
ssize_t snd_pcm_format_size(int format, size_t samples);
const char *snd_pcm_get_format_name(int format);
#ifdef __cplusplus
}

View file

@ -191,3 +191,39 @@ ssize_t snd_pcm_format_size(int format, size_t samples)
return -EINVAL;
}
}
const char *snd_pcm_get_format_name(int format)
{
static char *formats[] = {
"Signed 8-bit",
"Unsigned 8-bit",
"Signed 16-bit Little Endian",
"Signed 16-bit Big Endian",
"Unsigned 16-bit Little Endian",
"Unsigned 16-bit Big Endian",
"Signed 24-bit Little Endian",
"Signed 24-bit Big Endian",
"Unsigned 24-bit Little Endian",
"Unsigned 24-bit Big Endian",
"Signed 32-bit Little Endian",
"Signed 32-bit Big Endian",
"Unsigned 32-bit Little Endian",
"Unsigned 32-bit Big Endian",
"Float Little Endian",
"Float Big Endian",
"Float64 Little Endian",
"Float64 Big Endian",
"IEC-958 Little Endian",
"IEC-958 Big Endian",
"Mu-Law",
"A-Law",
"Ima-ADPCM",
"MPEG",
"GSM"
};
if (format == SND_PCM_SFMT_SPECIAL)
return "Special";
if (format < 0 || format > SND_PCM_SFMT_GSM)
return "Unknown";
return formats[format];
}