Skip to content

Commit

Permalink
Voice Optimization: No processors, sample done, terminate (#1388)
Browse files Browse the repository at this point in the history
The voice lifetime was gated by the AEG in the past but
in the case of no processors and a sample which is finished
(as in non looping played through etc...) you can early
terminate the voice.

Closes #379 (which is a pretty ancient issue)
  • Loading branch information
baconpaul authored Sep 29, 2024
1 parent e64f024 commit 114ea16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/engine/group_and_zone_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ void HasGroupZoneProcessors<T>::setProcessorType(int whichProcessor,
ps.streamingVersion = 0;
}

SCLOG("STREAMING VERSION IS " << ps.streamingVersion);
asT()->onProcessorTypeChanged(whichProcessor, type);
}

Expand Down
6 changes: 5 additions & 1 deletion src/voice/voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,14 @@ template <bool OS> bool Voice::processWithOS()
/*
* Finally do voice state update
*/
if (isAEGRunning)
if (isAEGRunning && (hasProcs || isGeneratorRunning))
{
isVoicePlaying = true;
}
else
{
isVoicePlaying = false;
}

return true;
}
Expand Down

0 comments on commit 114ea16

Please sign in to comment.