From 88b890824b6691c90e0cd5828b212a65f07443e7 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 14 Dec 2012 12:15:01 -0600 Subject: (CoreAudio) Retain volume value until initialization. Makes volume slider work when game isn't running. Fixes issue 5383. --- Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp') diff --git a/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp b/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp index d09bce85f9..f6d5d31bed 100644 --- a/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp +++ b/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp @@ -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"); @@ -105,6 +112,7 @@ bool CoreAudioSound::Start() void CoreAudioSound::SetVolume(int volume) { OSStatus err; + m_volume = volume; err = AudioUnitSetParameter(audioUnit, kHALOutputParam_Volume, -- cgit v1.2.3