OpenAL初始化问题,仅iPod(?) [英] OpenAL initialization problem, iPod only (?)
问题描述
我在OpenAL中遇到的问题似乎只在iPod硬件上才发生,奇怪的是,它正常正常工作,而现在却没有.
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.
我正在设置音频会话:
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecord error: nil];
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute,
sizeof(UInt32), &audioRouteOverride);
AudioSessionSetActive(YES);
并初始化OpenAL:
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;
输出为:
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.
因此alcMakeContextCurrent函数返回的是false,但我不确定为什么.音频并不是我真正的专长,我在这方面找不到太多信息,因此,你们能提供给我的任何帮助将不胜感激.
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.
谢谢!
我发现如果我颠倒了初始化的顺序,也就是我先初始化OpenAL,然后初始化AudioSession,它就可以工作了……尽管这是我以前使用的顺序,但是没有用,所以一定会发生有趣的事情;而且,它仍然不适用于旧版本的iOS
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
推荐答案
相反的初始化顺序似乎还可以,先是OpenAL,然后是AudioSession
Reverse order of initialization seems to work ok, OpenAL then AudioSession
这篇关于OpenAL初始化问题,仅iPod(?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!