From 628ac376ed8e7d32e92feec0e368be01d72bfec6 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 13 Jan 2024 05:29:43 +0300 Subject: [PATCH] engine: client: s_dsp: refactoring from hldsp --- engine/client/s_dsp.c | 12 ++++-------- engine/client/s_mix.c | 3 ++- engine/client/sound.h | 3 +-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/engine/client/s_dsp.c b/engine/client/s_dsp.c index 64a0d886..ee924382 100644 --- a/engine/client/s_dsp.c +++ b/engine/client/s_dsp.c @@ -334,7 +334,7 @@ DLY_MovePointer Checks overflow and moves pointer ============ */ -_inline void DLY_MovePointer( dly_t *dly ) +static void DLY_MovePointer( dly_t *dly ) { if( ++dly->idelayinput >= dly->cdelaysamplesmax ) dly->idelayinput = 0; @@ -807,13 +807,9 @@ DSP_Process (xash dsp interface) =========== */ -void DSP_Process( int idsp, portable_samplepair_t *pbfront, int sampleCount ) +void DSP_Process( portable_samplepair_t *pbfront, int sampleCount ) { - if( dsp_off.value ) - return; - - // don't process DSP while in menu - if( cls.key_dest == key_menu || !sampleCount ) + if( dsp_off.value || !sampleCount ) return; // preset is already installed by CheckNewDspPresets @@ -940,7 +936,7 @@ static void SX_Profiling_f( void ) start = Sys_DoubleTime(); for( calls = 10000; calls; calls-- ) { - DSP_Process( idsp_room, testbuffer, 512 ); + DSP_Process( testbuffer, 512 ); } end = Sys_DoubleTime(); diff --git a/engine/client/s_mix.c b/engine/client/s_mix.c index 11a5232b..50164475 100644 --- a/engine/client/s_mix.c +++ b/engine/client/s_mix.c @@ -999,7 +999,8 @@ void MIX_PaintChannels( int endtime ) MIX_UpsampleAllPaintbuffers( end, count ); // process all sounds with DSP - DSP_Process( idsp_room, MIX_GetPFrontFromIPaint( IROOMBUFFER ), count ); + if( cls.key_dest != key_menu ) + DSP_Process( MIX_GetPFrontFromIPaint( IROOMBUFFER ), count ); // add music or soundtrack from movie (no dsp) MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() ); diff --git a/engine/client/sound.h b/engine/client/sound.h index e463c97a..7e581cbc 100644 --- a/engine/client/sound.h +++ b/engine/client/sound.h @@ -255,8 +255,7 @@ void S_InitSounds( void ); void SX_Init( void ); void SX_Free( void ); void CheckNewDspPresets( void ); -void DSP_Process( int idsp, portable_samplepair_t *pbfront, int sampleCount ); -float DSP_GetGain( int idsp ); +void DSP_Process( portable_samplepair_t *pbfront, int sampleCount ); void DSP_ClearState( void ); qboolean S_Init( void );