diff options
author | Chris Robinson <[email protected]> | 2019-03-09 13:20:10 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-03-09 13:20:10 -0800 |
commit | d39cfcc7bb4f7c7ad6686bfc455785438d6b22ae (patch) | |
tree | fbf110d7fc5807df3cc94446ff804cd869439d39 /Alc/alu.cpp | |
parent | 972a5c0f1d27a02f84823bd8afed5cac01459420 (diff) |
Clear the voice's buffer when detaching from source
Diffstat (limited to 'Alc/alu.cpp')
-rw-r--r-- | Alc/alu.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Alc/alu.cpp b/Alc/alu.cpp index 85482084..28f6346e 100644 --- a/Alc/alu.cpp +++ b/Alc/alu.cpp @@ -1457,6 +1457,8 @@ void ProcessContext(ALCcontext *ctx, const ALsizei SamplesToDo) if(!MixSource(voice, sid, ctx, SamplesToDo)) { + voice->current_buffer.store(nullptr, std::memory_order_relaxed); + voice->loop_buffer.store(nullptr, std::memory_order_relaxed); voice->SourceID.store(0u, std::memory_order_relaxed); voice->Playing.store(false, std::memory_order_release); SendSourceStoppedEvent(ctx, sid); @@ -1816,6 +1818,8 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) ALuint sid{voice->SourceID.load(std::memory_order_relaxed)}; if(!sid) return; + voice->current_buffer.store(nullptr, std::memory_order_relaxed); + voice->loop_buffer.store(nullptr, std::memory_order_relaxed); voice->SourceID.store(0u, std::memory_order_relaxed); voice->Playing.store(false, std::memory_order_release); /* If the source's voice was playing, it's now effectively stopped |