Use a separate function to update an openal stream's volume

This commit is contained in:
Chris Robinson 2014-06-28 00:37:12 -07:00
parent c73d97af44
commit 7908116fef
1 changed files with 7 additions and 2 deletions

View File

@ -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)