(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;
|
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);
|
err = AudioUnitInitialize(audioUnit);
|
||||||
if (err != noErr) {
|
if (err != noErr) {
|
||||||
ERROR_LOG(AUDIO, "error initializing audiounit");
|
ERROR_LOG(AUDIO, "error initializing audiounit");
|
||||||
|
@ -105,6 +112,7 @@ bool CoreAudioSound::Start()
|
||||||
void CoreAudioSound::SetVolume(int volume)
|
void CoreAudioSound::SetVolume(int volume)
|
||||||
{
|
{
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
|
m_volume = volume;
|
||||||
|
|
||||||
err = AudioUnitSetParameter(audioUnit,
|
err = AudioUnitSetParameter(audioUnit,
|
||||||
kHALOutputParam_Volume,
|
kHALOutputParam_Volume,
|
||||||
|
|
|
@ -47,6 +47,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AudioUnit audioUnit;
|
AudioUnit audioUnit;
|
||||||
|
int m_volume;
|
||||||
|
|
||||||
static OSStatus callback(void *inRefCon,
|
static OSStatus callback(void *inRefCon,
|
||||||
AudioUnitRenderActionFlags *ioActionFlags,
|
AudioUnitRenderActionFlags *ioActionFlags,
|
||||||
|
|
Loading…
Reference in New Issue