(CoreAudio) Retain volume value until initialization. Makes volume slider work when game isn't running. Fixes issue 5383.

This commit is contained in:
Ryan Houdek 2012-12-14 12:15:01 -06:00
parent 3b559d89ec
commit 88b890824b
2 changed files with 9 additions and 0 deletions

View File

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

View File

@ -47,6 +47,7 @@ public:
private:
AudioUnit audioUnit;
int m_volume;
static OSStatus callback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,