From 7908116fefc035b173ff7826d3be7b550d0bf362 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 28 Jun 2014 00:37:12 -0700 Subject: [PATCH] Use a separate function to update an openal stream's volume --- src/sound/oalsound.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sound/oalsound.cpp b/src/sound/oalsound.cpp index 3272a95666..ecc4a97ea3 100644 --- a/src/sound/oalsound.cpp +++ b/src/sound/oalsound.cpp @@ -297,7 +297,12 @@ public: virtual void SetVolume(float vol) { - if(vol >= 0.0f) Volume = vol; + Volume = vol; + UpdateVolume(); + } + + void UpdateVolume() + { alSourcef(Source, AL_GAIN, Renderer->MusicVolume*Volume); getALError(); } @@ -875,7 +880,7 @@ void OpenALSoundRenderer::SetMusicVolume(float volume) { MusicVolume = volume; for(uint32 i = 0;i < Streams.Size();++i) - Streams[i]->SetVolume(-1.f); + Streams[i]->UpdateVolume(); } unsigned int OpenALSoundRenderer::GetMSLength(SoundHandle sfx)