Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
(CoreAudio) Retain volume value until initialization. Makes volume sl…
…ider work when game isn't running. Fixes issue 5383.
  • Loading branch information
Sonicadvance1 committed Dec 14, 2012
1 parent 3b559d8 commit 88b8908
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp
Expand Up @@ -87,6 +87,13 @@ bool CoreAudioSound::Start()
return false;
}

err = AudioUnitSetParameter(audioUnit,
kHALOutputParam_Volume,
kAudioUnitParameterFlag_Output, 0,
m_volume / 100., 0);
if (err != noErr)
ERROR_LOG(AUDIO, "error setting volume");

err = AudioUnitInitialize(audioUnit);
if (err != noErr) {
ERROR_LOG(AUDIO, "error initializing audiounit");
Expand All @@ -105,6 +112,7 @@ bool CoreAudioSound::Start()
void CoreAudioSound::SetVolume(int volume)
{
OSStatus err;
m_volume = volume;

err = AudioUnitSetParameter(audioUnit,
kHALOutputParam_Volume,
Expand Down
1 change: 1 addition & 0 deletions Source/Core/AudioCommon/Src/CoreAudioSoundStream.h
Expand Up @@ -47,6 +47,7 @@ class CoreAudioSound : public SoundStream

private:
AudioUnit audioUnit;
int m_volume;

static OSStatus callback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
Expand Down

0 comments on commit 88b8908

Please sign in to comment.