From 5f07c648e45cdbd5eeea127322e32dd48582f436 Mon Sep 17 00:00:00 2001 From: Koichiro IWAO Date: Thu, 9 Feb 2023 00:53:49 +0900 Subject: [PATCH] chansrv: add a utility function to convert wFormatTag into string --- sesman/chansrv/audin.c | 21 +++++++++++++++++++++ sesman/chansrv/audin.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/sesman/chansrv/audin.c b/sesman/chansrv/audin.c index 36a8027a..5e759c50 100644 --- a/sesman/chansrv/audin.c +++ b/sesman/chansrv/audin.c @@ -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 */ +/*****************************************************************************/ + +/* + * 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 cleanup_client_formats(void) diff --git a/sesman/chansrv/audin.h b/sesman/chansrv/audin.h index 7569bc4f..ee57b56d 100644 --- a/sesman/chansrv/audin.h +++ b/sesman/chansrv/audin.h @@ -22,6 +22,8 @@ #ifndef _AUDIN_H_ #define _AUDIN_H_ +const char * +audin_wave_format_tag_to_str(int tag); int audin_init(void); int