(CoreAudio) Retain volume value until initialization. Makes volume slider work when game isn't running. Fixes issue 5383.
This commit is contained in:
parent
3b559d89ec
commit
88b890824b
|
@ -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,
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
|
||||
private:
|
||||
AudioUnit audioUnit;
|
||||
int m_volume;
|
||||
|
||||
static OSStatus callback(void *inRefCon,
|
||||
AudioUnitRenderActionFlags *ioActionFlags,
|
||||
|
|
Loading…
Reference in New Issue