mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-13 22:22:05 +00:00
Make Cinematic Audio playback respect the s_noSound cVar setting
This commit is contained in:
parent
8509d80cca
commit
67c6537991
3 changed files with 16 additions and 5 deletions
|
@ -257,6 +257,7 @@ static unsigned short* vq2 = NULL;
|
|||
static unsigned short* vq4 = NULL;
|
||||
static unsigned short* vq8 = NULL;
|
||||
|
||||
extern idCVar s_noSound;
|
||||
|
||||
|
||||
//===========================================
|
||||
|
@ -1555,7 +1556,15 @@ cinData_t idCinematicLocal::ImageForTimeFFMPEG( int thisTime, nvrhi::ICommandLis
|
|||
while( !lagBuffer.empty() )
|
||||
{
|
||||
// SRS - Note that PlayAudio() is responsible for releasing any audio buffers sent to it
|
||||
cinematicAudio->PlayAudio( lagBuffer.front(), lagBufSize.front() );
|
||||
if( !s_noSound.GetBool() )
|
||||
{
|
||||
cinematicAudio->PlayAudio( lagBuffer.front(), lagBufSize.front() );
|
||||
}
|
||||
else
|
||||
{
|
||||
av_freep( &lagBuffer.front() );
|
||||
}
|
||||
|
||||
lagBuffer.pop();
|
||||
lagBufSize.pop();
|
||||
}
|
||||
|
@ -1729,7 +1738,7 @@ cinData_t idCinematicLocal::ImageForTimeBinkDec( int thisTime, nvrhi::ICommandLi
|
|||
num_bytes = Bink_GetAudioData( binkHandle, trackIndex, audioBuffer );
|
||||
|
||||
// SRS - If we have cinematic audio data, start playing it now
|
||||
if( num_bytes > 0 )
|
||||
if( num_bytes > 0 && !s_noSound.GetBool() )
|
||||
{
|
||||
// SRS - Note that PlayAudio() is responsible for releasing any audio buffers sent to it
|
||||
cinematicAudio->PlayAudio( ( uint8_t* )audioBuffer, num_bytes );
|
||||
|
|
|
@ -37,7 +37,6 @@ extern "C"
|
|||
#include <BinkDecoder.h>
|
||||
#endif
|
||||
|
||||
extern idCVar s_noSound;
|
||||
extern idCVar s_volume_dB;
|
||||
|
||||
CinematicAudio_OpenAL::CinematicAudio_OpenAL():
|
||||
|
@ -51,7 +50,7 @@ CinematicAudio_OpenAL::CinematicAudio_OpenAL():
|
|||
alSource3i( alMusicSourceVoicecin, AL_POSITION, 0, 0, 0 );
|
||||
alSourcei( alMusicSourceVoicecin, AL_SOURCE_RELATIVE, AL_TRUE );
|
||||
alSourcei( alMusicSourceVoicecin, AL_ROLLOFF_FACTOR, 0 );
|
||||
alListenerf( AL_GAIN, s_noSound.GetBool() ? 0.0f : DBtoLinear( s_volume_dB.GetFloat() ) ); //GK: Set the sound volume the same that is used in DOOM 3
|
||||
alListenerf( AL_GAIN, DBtoLinear( s_volume_dB.GetFloat() ) ); //GK: Set the sound volume the same that is used in DOOM 3
|
||||
alGenBuffers( NUM_BUFFERS, &alMusicBuffercin[0] );
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,10 @@ void CinematicAudio_XAudio2::InitAudio( void* audioContext )
|
|||
exvoice.SubFormat = use_ext ? KSDATAFORMAT_SUBTYPE_IEEE_FLOAT : KSDATAFORMAT_SUBTYPE_PCM;
|
||||
// Use the XAudio2 that the game has initialized instead of making our own
|
||||
// SRS - Hook up the voice callback interface to get notice when audio buffers can be freed
|
||||
( ( IXAudio2* )soundSystemLocal.GetIXAudio2() )->CreateSourceVoice( &pMusicSourceVoice1, ( WAVEFORMATEX* )&exvoice, XAUDIO2_VOICE_USEFILTER, XAUDIO2_DEFAULT_FREQ_RATIO, &voiceCallback );
|
||||
if( soundSystemLocal.GetIXAudio2() )
|
||||
{
|
||||
( ( IXAudio2* )soundSystemLocal.GetIXAudio2() )->CreateSourceVoice( &pMusicSourceVoice1, ( WAVEFORMATEX* )&exvoice, XAUDIO2_VOICE_USEFILTER, XAUDIO2_DEFAULT_FREQ_RATIO, &voiceCallback );
|
||||
}
|
||||
}
|
||||
|
||||
void CinematicAudio_XAudio2::PlayAudio( uint8_t* data, int size )
|
||||
|
|
Loading…
Reference in a new issue