From 24cdbd36005219ce47aab5dc81d17870c02807df Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 26 Aug 2024 12:40:13 +0200 Subject: [PATCH] Cleanup and consolidation of rendering configuration processing --- apps/decoder.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 1ac9a7d5f9..c6a535207d 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -400,6 +400,8 @@ int main( } } +#ifndef FIX_1158_FASTCONV_REVERB_HRTF + /*------------------------------------------------------------------------------------------* * Open renderer configuration reader file *------------------------------------------------------------------------------------------*/ @@ -419,14 +421,6 @@ int main( goto cleanup; } } -#ifdef FIX_1158_FASTCONV_REVERB_HRTF - else if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - /* supply default renderer config for BINAURAL_ROOM_REVERB */ - IVAS_RENDER_CONFIG_DATA renderConfig; - IVAS_DEC_GetDefaultRenderConfig( &renderConfig ); - IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ); - } #endif /*------------------------------------------------------------------------------------------* @@ -615,6 +609,17 @@ int main( goto cleanup; } +#ifdef FIX_1158_FASTCONV_REVERB_HRTF + IVAS_DEC_GetDefaultRenderConfig( &renderConfig ); + + if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: Can't open Renderer configuration file %s \n\n", arg.renderConfigFilename ); + goto cleanup; + } + +#endif + if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); @@ -683,6 +688,19 @@ int main( goto cleanup; } } +#ifdef FIX_1158_FASTCONV_REVERB_HRTF + else if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + /* supply default renderer config for BINAURAL_ROOM_REVERB */ + IVAS_RENDER_CONFIG_DATA renderConfig; + IVAS_DEC_GetDefaultRenderConfig( &renderConfig ); + if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } +#endif /*------------------------------------------------------------------------------------------* * Load custom loudspeaker layout data -- GitLab