I'm having a problem with OpenAL that only seems to occur with iPod hardware, and the odd thing is that it was working fine, and now it's not.
I'm setting up the audio session:
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecord error: nil];
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute,
sizeof(UInt32), &audioRouteOverride);
AudioSessionSetActive(YES);
And initializing OpenAL:
device = alcOpenDevice(NULL);
if (!device) {
NSLog(@"Could not open default OpenAL device.");
return NO;
}
context = alcCreateContext(device, 0);
if (!context) {
NSLog(@"Failed to create OpenAL context for default device.");
return NO;
}
BOOL success = alcMakeContextCurrent(context); // fails here
if (!success) {
NSLog(@"Failed to set current OpenAL context.");
return NO;
The output is:
AudioStreamBasicDescription: 2 ch, 44100 Hz, 'lpcm' (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved
2010-10-27 10:51:09.261 FinchTestProject[239:307] Failed to set current OpenAL context.
So alcMakeContextCurrent function is returning false, and I'm not sure why. Audio is not really my expertise, and I can't find much information on this, so any help you guys can give me would be appreciated.
Thanks!
EDIT: I've found if I reverse the order of initialization- that is if I initialize OpenAL and then the AudioSession, it works... although this is the order I had it in before and it wasn't working, so something funny is definitely going on; also, it still doesn't work with older versions of iOS