Reputation: 7165
Does anybody know if this is possible?
I have my audio session and OpenAL set-up like so:
// Allow their music to play in the background
AudioSessionInitialize(NULL, NULL, openALInterruptionListener, (__bridge void *)(self));
UInt32 sessionCategory = kAudioSessionCategory_AmbientSound;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory);
UInt32 allowMixing = false;
AudioSessionSetProperty(kAudioSessionProperty_OtherMixableAudioShouldDuck, sizeof(allowMixing), &allowMixing);
// use the device to make a context
_mContext = alcCreateContext(_mDevice, NULL);
// set my context to the currently active one
alcMakeContextCurrent(_mContext);
And I have ducking set-up like so:
- (void)setSoundDucked:(BOOL)soundDucked
{
if(soundDucked)
{
UInt32 allowMixing = true;
AudioSessionSetProperty(kAudioSessionProperty_OtherMixableAudioShouldDuck, sizeof(allowMixing), &allowMixing);
AudioSessionSetActive(false);
AudioSessionSetActive(true);
}
else
{
UInt32 allowMixing = false;
AudioSessionSetProperty(kAudioSessionProperty_OtherMixableAudioShouldDuck, sizeof(allowMixing), &allowMixing);
AudioSessionSetActive(false);
AudioSessionSetActive(true);
}
}
However, sound doesn't duck. It will only duck if I comment out the following lines:
// use the device to make a context
_mContext = alcCreateContext(_mDevice, NULL);
// set my context to the currently active one
alcMakeContextCurrent(_mContext);
Is there anyway of getting OpenAL to play nice with the audio ducking property?
Upvotes: 1
Views: 199