Finch Audio Engine 未打开默认 OpenAL 设备
我有一个抽象类,它在 awakeFromNib 方法中将 Finch 初始化为全局变量 Finch *engine,如下所示:
engine = [[Finch alloc] init];
抽象类的子类都不会重写该方法。但是,每当我尝试我的程序时,Finch 都会打印“Finch:无法打开默认 OpenAL 设备”。在调试器中。为什么 Finch 无法获取默认的 OpenAL 设备?据我所知,我正在做他们的代码示例中所示的所有事情。
I have an abstract class that initializes Finch to the global variable Finch *engine in the awakeFromNib method as follows:
engine = [[Finch alloc] init];
None of the abstract class's subclasses override the method. However, whenever I try my program, Finch prints "Finch: Could not open default OpenAL device." in the debugger. Why can't Finch get the default OpenAL device? As far as I can tell I'm doing everything as shown in their code example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚遇到了同样的问题。对我来说,这是由于在多个视图控制器中实例化 Finch 对象引起的。由于某种原因,第二个似乎取消了第一个,每当我尝试播放声音时,我都会收到该错误消息。
为了解决这个问题,我只是在 App Delegate 中创建了一个 Finch 对象,现在它在整个应用程序中完美运行。
希望这有帮助:)
I just came across the same problem. For me, it was caused by instantiating a Finch object in more than one view controller. For some reason the second one seemed to cancel the first one out and I got that error message whenever I tried to play a sound.
To solve it, I simply created one Finch object in the App Delegate and now it's working perfectly throughout the whole app.
Hope this helps :)
警告,如果您要分配多个 Finch 类:
在 FISoundEngine 中,dealloc 方法会调用 closeAudioDevice。这将关闭 OpenAL 音频设备。
您可能知道,您的整个应用程序中只存在一台 OpenAL 设备!
因此,这意味着您的整个应用程序只能拥有一个引擎(和一个工厂),
或者您将在设备应保持打开的位置关闭该设备。
这是否是一个设计缺陷,我不知道。我建议把芬奇变成
单例类,但我的想法被作者拒绝了。
Warning, if you are allocating multiple Finch classes:
In FISoundEngine, the dealloc method calls closeAudioDevice. This closes the OpenAL audio device.
And as you probably know, only one OpenAL device exists in your entire app!
So, that means you can only have one engine (and one factory) for your entire app,
or you will be closing the device in places where it should stay open.
Whether this is a design flaw, I don't know. I suggested that Finch be turned into
a singleton class, but my idea was rejected by the author.