From b2c8d1320dc6475ca1459bef719cd6f5a0fdb65f Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 3 Apr 2021 14:41:20 +0100 Subject: [PATCH] Fix for repeating patterns loaded from a save game file --- .../jni/d3es-multithread-master/neo/game/Entity.cpp | 4 ---- .../d3es-multithread-master/neo/sound/snd_emitter.cpp | 9 +++++++++ .../d3es-multithread-master/neo/sound/snd_world.cpp | 11 +++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Projects/Android/jni/d3es-multithread-master/neo/game/Entity.cpp b/Projects/Android/jni/d3es-multithread-master/neo/game/Entity.cpp index 0ad8321..d09cdf3 100644 --- a/Projects/Android/jni/d3es-multithread-master/neo/game/Entity.cpp +++ b/Projects/Android/jni/d3es-multithread-master/neo/game/Entity.cpp @@ -1649,10 +1649,6 @@ void idEntity::StopSound( const s_channelType channel, bool broadcast ) { if ( refSound.referenceSound ) { refSound.referenceSound->StopSound( channel ); - - if (refSound.shader) { - common->HapticStopEvent(refSound.shader->GetName()); - } } } diff --git a/Projects/Android/jni/d3es-multithread-master/neo/sound/snd_emitter.cpp b/Projects/Android/jni/d3es-multithread-master/neo/sound/snd_emitter.cpp index 0fe1ba3..daffc1d 100644 --- a/Projects/Android/jni/d3es-multithread-master/neo/sound/snd_emitter.cpp +++ b/Projects/Android/jni/d3es-multithread-master/neo/sound/snd_emitter.cpp @@ -151,6 +151,7 @@ idSoundChannel::idSoundChannel */ idSoundChannel::idSoundChannel( void ) { decoder = NULL; + soundShader = NULL; Clear(); } @@ -212,6 +213,12 @@ idSoundChannel::Stop void idSoundChannel::Stop( void ) { triggerState = false; stopped = true; + + if (soundShader != NULL) + { + common->HapticStopEvent(soundShader->GetName()); + } + if ( decoder != NULL ) { idSampleDecoder::Free( decoder ); decoder = NULL; @@ -971,6 +978,8 @@ void idSoundEmitterLocal::StopSound( const s_channelType channel ) { Sys_EnterCriticalSection(); + const char* soundShaderName = NULL; + for( i = 0; i < SOUND_MAX_CHANNELS; i++ ) { idSoundChannel *chan = &channels[i]; diff --git a/Projects/Android/jni/d3es-multithread-master/neo/sound/snd_world.cpp b/Projects/Android/jni/d3es-multithread-master/neo/sound/snd_world.cpp index b7a0ed9..78f82ca 100644 --- a/Projects/Android/jni/d3es-multithread-master/neo/sound/snd_world.cpp +++ b/Projects/Android/jni/d3es-multithread-master/neo/sound/snd_world.cpp @@ -1356,6 +1356,17 @@ void idSoundWorldLocal::ReadFromSaveGame( idFile *savefile ) { chan->channelFade.fadeEnd44kHz += soundTimeOffset; } + //Only concerned with registering looping sounds with the haptics service + if (cvarSystem->GetCVarBool("vr_useHapticsService")) + { + bool looping = (def->parms.soundShaderFlags & SSF_LOOPING) != 0; + if (looping) + { + common->Printf("Start Looping: %s", chan->soundShader->GetName()); + common->HapticEvent(chan->soundShader->GetName(), 4, 1, 0, 0, 0); + } + } + // next command savefile->ReadInt( channel ); }