mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-02-20 11:03:09 +00:00
Fix running timedemo if sound is disabled (s_noSound 1), fix #163
By adding some nullpointer checks
This commit is contained in:
parent
eefdd8343e
commit
92310f66f0
2 changed files with 8 additions and 4 deletions
|
@ -952,7 +952,8 @@ void idSoundEmitterLocal::StopSound( const s_channelType channel ) {
|
|||
chan->ALStop();
|
||||
|
||||
// if this was an onDemand sound, purge the sample now
|
||||
if ( chan->leadinSample->onDemand ) {
|
||||
// Note: if sound is disabled (s_noSound 1), leadinSample can be NULL
|
||||
if ( chan->leadinSample && chan->leadinSample->onDemand ) {
|
||||
chan->leadinSample->PurgeSoundSample();
|
||||
}
|
||||
|
||||
|
|
|
@ -2148,10 +2148,13 @@ float idSoundWorldLocal::FindAmplitude( idSoundEmitterLocal *sound, const int lo
|
|||
sourceBuffer[j] = j & 1 ? 32767.0f : -32767.0f;
|
||||
}
|
||||
} else {
|
||||
int offset = (localTime - localTriggerTimes); // offset in samples
|
||||
int size = ( looping ? chan->soundShader->entries[0]->LengthIn44kHzSamples() : chan->leadinSample->LengthIn44kHzSamples() );
|
||||
short *amplitudeData = (short *)( looping ? chan->soundShader->entries[0]->amplitudeData : chan->leadinSample->amplitudeData );
|
||||
idSoundSample* sample = looping ? chan->soundShader->entries[0] : chan->leadinSample;
|
||||
if ( sample == NULL ) // DG: this happens if sound is disabled (s_noSound 1)
|
||||
continue;
|
||||
|
||||
int offset = (localTime - localTriggerTimes); // offset in samples
|
||||
int size = sample->LengthIn44kHzSamples();
|
||||
short *amplitudeData = (short *)( sample->amplitudeData );
|
||||
if ( amplitudeData ) {
|
||||
// when the amplitudeData is present use that fill a dummy sourceBuffer
|
||||
// this is to allow for amplitude based effect on hardware audio solutions
|
||||
|
|
Loading…
Reference in a new issue