aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-03-29 00:28:31 -0700
committerChris Robinson <[email protected]>2023-03-29 00:28:31 -0700
commitd82d30cce98194a98a3eb32b60b49a1ae57ae5ef (patch)
tree8dde3b850e66ca86ed48ed49140c83af7ccf8d82
parent0b3dde9ccc9eaf82f1cceac234ab7bed0d4061e6 (diff)
Make sure delayed-start voices are properly stopped
-rw-r--r--core/voice.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/voice.cpp b/core/voice.cpp
index ee5f6ae6..e8fbcccd 100644
--- a/core/voice.cpp
+++ b/core/voice.cpp
@@ -732,8 +732,17 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi
uint OutPos{0u};
/* Check if we're doing a delayed start, and we start in this update. */
- if(mStartTime > deviceTime)
+ if(mStartTime > deviceTime) UNLIKELY
{
+ /* If the voice is supposed to be stopping but hasn't actually started
+ * yet, make sure its stopped.
+ */
+ if(vstate == Stopping)
+ {
+ mPlayState.store(Stopped, std::memory_order_release);
+ return;
+ }
+
/* If the start time is too far ahead, don't bother. */
auto diff = mStartTime - deviceTime;
if(diff >= seconds{1})