From d29e53481d7741ae3becd997e80ee800ed90c7c5 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 22 Jan 2025 20:01:11 +0300 Subject: [PATCH] engine: client: remove unused S_StreamAviSamples --- engine/client/client.h | 1 - engine/client/s_main.c | 80 ------------------------------------------ engine/client/sound.h | 1 - 3 files changed, 82 deletions(-) diff --git a/engine/client/client.h b/engine/client/client.h index def9e32b..22cedd24 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -1120,7 +1120,6 @@ void Con_PageUp( int lines ); // s_main.c // typedef int sound_t; -void S_StreamAviSamples( void *Avi, int entnum, float fvol, float attn, float synctime ); void S_StartBackgroundTrack( const char *intro, const char *loop, int position, qboolean fullpath ); void S_StopBackgroundTrack( void ); void S_StreamSetPause( int pause ); diff --git a/engine/client/s_main.c b/engine/client/s_main.c index 93a24492..a06f2b8a 100644 --- a/engine/client/s_main.c +++ b/engine/client/s_main.c @@ -1207,86 +1207,6 @@ void S_RawSamples( uint samples, uint rate, word width, word channels, const byt S_RawEntSamples( entnum, samples, rate, width, channels, data, snd_vol ); } -/* -=================== -S_PositionedRawSamples -=================== -*/ -void S_StreamAviSamples( void *Avi, int entnum, float fvol, float attn, float synctime ) -{ - int bufferSamples; - int fileSamples; - byte raw[MAX_RAW_SAMPLES]; - float duration = 0.0f; - int r, fileBytes; - rawchan_t *ch = NULL; - - if( !dma.initialized || s_listener.paused || !CL_IsInGame( )) - return; - - if( entnum < 0 || entnum >= GI->max_edicts ) - return; - - if( !( ch = S_FindRawChannel( entnum, true ))) - return; - - if( ch->sound_info.rate == 0 ) - { - if( !AVI_GetAudioInfo( Avi, &ch->sound_info )) - return; // no audiotrack - } - - ch->master_vol = bound( 0, fvol * 255, 255 ); - ch->dist_mult = (attn / SND_CLIP_DISTANCE); - - // see how many samples should be copied into the raw buffer - if( ch->s_rawend < soundtime ) - ch->s_rawend = soundtime; - - // position is changed, synchronization is lost etc - if( fabs( ch->oldtime - synctime ) > s_mixahead.value ) - ch->sound_info.loopStart = AVI_TimeToSoundPosition( Avi, synctime * 1000 ); - ch->oldtime = synctime; // keep actual time - - while( ch->s_rawend < soundtime + ch->max_samples ) - { - wavdata_t *info = &ch->sound_info; - - bufferSamples = ch->max_samples - (ch->s_rawend - soundtime); - - // decide how much data needs to be read from the file - fileSamples = bufferSamples * ((float)info->rate / SOUND_DMA_SPEED ); - if( fileSamples <= 1 ) return; // no more samples need - - // our max buffer size - fileBytes = fileSamples * ( info->width * info->channels ); - - if( fileBytes > sizeof( raw )) - { - fileBytes = sizeof( raw ); - fileSamples = fileBytes / ( info->width * info->channels ); - } - - // read audio stream - r = AVI_GetAudioChunk( Avi, raw, info->loopStart, fileBytes ); - info->loopStart += r; // advance play position - - if( r < fileBytes ) - { - fileBytes = r; - fileSamples = r / ( info->width * info->channels ); - } - - if( r > 0 ) - { - // add to raw buffer - ch->s_rawend = S_RawSamplesStereo( ch->rawsamples, ch->s_rawend, ch->max_samples, - fileSamples, info->rate, info->width, info->channels, raw ); - } - else break; // no more samples for this frame - } -} - /* =================== S_FreeIdleRawChannels diff --git a/engine/client/sound.h b/engine/client/sound.h index 51ffe6a0..f66f4123 100644 --- a/engine/client/sound.h +++ b/engine/client/sound.h @@ -114,7 +114,6 @@ typedef struct rawchan_s vec3_t origin; // only use if fixed_origin is set volatile uint s_rawend; float oldtime; // catch time jumps - wavdata_t sound_info; // advance play position size_t max_samples; // buffer length portable_samplepair_t rawsamples[]; // variable sized } rawchan_t;