chansrv: add a utility function to convert wFormatTag into string

This commit is contained in:
Koichiro IWAO
2023-02-09 00:53:49 +09:00
parent 4b4989b6a7
commit 5f07c648e4
2 changed files with 23 additions and 0 deletions
+21
View File
@@ -88,6 +88,27 @@ static struct xr_wave_format_ex **g_client_formats = NULL;
static int g_current_format = 0; /* index in g_client_formats */ static int g_current_format = 0; /* index in g_client_formats */
/*****************************************************************************/
/*
* This can be called from sound.c because it includes audin.h.
*/
const char *
audin_wave_format_tag_to_str(int tag)
{
return
(tag == WAVE_FORMAT_PCM) ? "WAVE_FORMAT_PCM" :
(tag == WAVE_FORMAT_ADPCM) ? "WAVE_FORMAT_ADPCM" :
(tag == WAVE_FORMAT_ALAW) ? "WAVE_FORMAT_ALAW" :
(tag == WAVE_FORMAT_MULAW) ? "WAVE_FORMAT_MULAW" :
(tag == WAVE_FORMAT_MULAW) ? "WAVE_FORMAT_MULAW" :
(tag == WAVE_FORMAT_MPEGLAYER3) ? "WAVE_FORMAT_MPEGLAYER3" :
(tag == WAVE_FORMAT_OPUS) ? "WAVE_FORMAT_OPUS" :
(tag == WAVE_FORMAT_AAC) ? "WAVE_FORMAT_AAC" :
NULL;
}
/*****************************************************************************/ /*****************************************************************************/
static int static int
cleanup_client_formats(void) cleanup_client_formats(void)
+2
View File
@@ -22,6 +22,8 @@
#ifndef _AUDIN_H_ #ifndef _AUDIN_H_
#define _AUDIN_H_ #define _AUDIN_H_
const char *
audin_wave_format_tag_to_str(int tag);
int int
audin_init(void); audin_init(void);
int int