From 68be8157eacaa1041cb92ed423f6b63c905578db Mon Sep 17 00:00:00 2001 From: SNMetamorph <25657591+SNMetamorph@users.noreply.github.com> Date: Sat, 18 Mar 2023 23:31:58 +0400 Subject: [PATCH] engine: common: soundlib: added Sound_SupportedFileFormat function --- engine/common/common.h | 1 + engine/common/soundlib/snd_utils.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/engine/common/common.h b/engine/common/common.h index 08404a3a..7835891d 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -566,6 +566,7 @@ int FS_GetStreamPos( stream_t *stream ); void FS_FreeStream( stream_t *stream ); qboolean Sound_Process( wavdata_t **wav, int rate, int width, uint flags ); uint Sound_GetApproxWavePlayLen( const char *filepath ); +qboolean Sound_SupportedFileFormat( const char *fileext ); // // host.c diff --git a/engine/common/soundlib/snd_utils.c b/engine/common/soundlib/snd_utils.c index 98626066..0319bdaf 100644 --- a/engine/common/soundlib/snd_utils.c +++ b/engine/common/soundlib/snd_utils.c @@ -290,3 +290,17 @@ qboolean Sound_Process( wavdata_t **wav, int rate, int width, uint flags ) return false; } + +qboolean Sound_SupportedFileFormat( const char *fileext ) +{ + const loadwavfmt_t *format; + if( COM_CheckStringEmpty( fileext )) + { + for( format = sound.loadformats; format && format->formatstring; format++ ) + { + if( !Q_stricmp( format->ext, fileext )) + return true; + } + } + return false; +}