engine: client: s_dsp: refactoring from hldsp

This commit is contained in:
Alibek Omarov 2024-01-13 05:29:43 +03:00
parent 251e6ac1dc
commit 628ac376ed
3 changed files with 7 additions and 11 deletions

View File

@ -334,7 +334,7 @@ DLY_MovePointer
Checks overflow and moves pointer Checks overflow and moves pointer
============ ============
*/ */
_inline void DLY_MovePointer( dly_t *dly ) static void DLY_MovePointer( dly_t *dly )
{ {
if( ++dly->idelayinput >= dly->cdelaysamplesmax ) if( ++dly->idelayinput >= dly->cdelaysamplesmax )
dly->idelayinput = 0; dly->idelayinput = 0;
@ -807,13 +807,9 @@ DSP_Process
(xash dsp interface) (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 ) if( dsp_off.value || !sampleCount )
return;
// don't process DSP while in menu
if( cls.key_dest == key_menu || !sampleCount )
return; return;
// preset is already installed by CheckNewDspPresets // preset is already installed by CheckNewDspPresets
@ -940,7 +936,7 @@ static void SX_Profiling_f( void )
start = Sys_DoubleTime(); start = Sys_DoubleTime();
for( calls = 10000; calls; calls-- ) for( calls = 10000; calls; calls-- )
{ {
DSP_Process( idsp_room, testbuffer, 512 ); DSP_Process( testbuffer, 512 );
} }
end = Sys_DoubleTime(); end = Sys_DoubleTime();

View File

@ -999,7 +999,8 @@ void MIX_PaintChannels( int endtime )
MIX_UpsampleAllPaintbuffers( end, count ); MIX_UpsampleAllPaintbuffers( end, count );
// process all sounds with DSP // 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) // add music or soundtrack from movie (no dsp)
MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() ); MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() );

View File

@ -255,8 +255,7 @@ void S_InitSounds( void );
void SX_Init( void ); void SX_Init( void );
void SX_Free( void ); void SX_Free( void );
void CheckNewDspPresets( void ); void CheckNewDspPresets( void );
void DSP_Process( int idsp, portable_samplepair_t *pbfront, int sampleCount ); void DSP_Process( portable_samplepair_t *pbfront, int sampleCount );
float DSP_GetGain( int idsp );
void DSP_ClearState( void ); void DSP_ClearState( void );
qboolean S_Init( void ); qboolean S_Init( void );