aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-03-09 13:20:10 -0800
committerChris Robinson <[email protected]>2019-03-09 13:20:10 -0800
commitd39cfcc7bb4f7c7ad6686bfc455785438d6b22ae (patch)
treefbf110d7fc5807df3cc94446ff804cd869439d39 /OpenAL32
parent972a5c0f1d27a02f84823bd8afed5cac01459420 (diff)
Clear the voice's buffer when detaching from source
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alSource.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp
index 30ba02f6..9b0e5672 100644
--- a/OpenAL32/alSource.cpp
+++ b/OpenAL32/alSource.cpp
@@ -530,6 +530,8 @@ void FreeSource(ALCcontext *context, ALsource *source)
BackendUniqueLock backlock{*device->Backend};
if(ALvoice *voice{GetSourceVoice(source, context)})
{
+ 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);
}
@@ -2931,6 +2933,8 @@ AL_API ALvoid AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources)
ALvoice *voice{GetSourceVoice(source, context.get())};
if(voice != nullptr)
{
+ 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);
voice = nullptr;
@@ -2974,6 +2978,8 @@ AL_API ALvoid AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources)
ALvoice *voice{GetSourceVoice(source, context.get())};
if(voice != nullptr)
{
+ 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);
voice = nullptr;