From 9d2e03a5a4898f815fc67b700aa9b157462bf8b1 Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Fri, 19 Jul 2024 17:31:51 -0700 Subject: [PATCH] fix non-localOnly positional sounds not updating --- libraries/entities/src/SimpleEntitySimulation.cpp | 4 ++-- libraries/entities/src/SoundEntityItem.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libraries/entities/src/SimpleEntitySimulation.cpp b/libraries/entities/src/SimpleEntitySimulation.cpp index d64efdf87f..ecdc37ebfb 100644 --- a/libraries/entities/src/SimpleEntitySimulation.cpp +++ b/libraries/entities/src/SimpleEntitySimulation.cpp @@ -62,7 +62,7 @@ void SimpleEntitySimulation::addEntityToInternalLists(EntityItemPointer entity) // we don't allow dynamic objects to move without an owner so nothing to do here } else if (entity->isMovingRelativeToParent()) { SetOfEntities::iterator itr = _simpleKinematicEntities.find(entity); - if (itr != _simpleKinematicEntities.end()) { + if (itr == _simpleKinematicEntities.end()) { _simpleKinematicEntities.insert(entity); entity->setLastSimulated(usecTimestampNow()); } @@ -73,7 +73,7 @@ void SimpleEntitySimulation::addEntityToInternalLists(EntityItemPointer entity) if (entity->isMovingRelativeToParent()) { SetOfEntities::iterator itr = _simpleKinematicEntities.find(entity); - if (itr != _simpleKinematicEntities.end()) { + if (itr == _simpleKinematicEntities.end()) { _simpleKinematicEntities.insert(entity); entity->setLastSimulated(usecTimestampNow()); } diff --git a/libraries/entities/src/SoundEntityItem.cpp b/libraries/entities/src/SoundEntityItem.cpp index 71845920f9..d8c648a61a 100644 --- a/libraries/entities/src/SoundEntityItem.cpp +++ b/libraries/entities/src/SoundEntityItem.cpp @@ -359,8 +359,8 @@ void SoundEntityItem::setLocalOnly(bool value) { if (_injector) { DependencyManager::get()->stop(_injector); + _injector = nullptr; } - _injector = nullptr; } if (_sound) { @@ -409,7 +409,7 @@ bool SoundEntityItem::restartSound(bool lock) { options.ambisonic = _sound->isAmbisonic(); if (_injector) { - DependencyManager::get()->setOptionsAndRestart(_injector, options); + DependencyManager::get()->setOptions(_injector, options); } else { _injector = DependencyManager::get()->playSound(_sound, options); } @@ -431,8 +431,8 @@ void SoundEntityItem::updateSound(bool restart) { if (restart) { if (_injector) { DependencyManager::get()->stop(_injector); + _injector = nullptr; } - _injector = nullptr; } if (_playing) { @@ -440,6 +440,7 @@ void SoundEntityItem::updateSound(bool restart) { } else { if (_injector) { DependencyManager::get()->stop(_injector); + _injector = nullptr; } } }