Finch Audio Engine not opening default OpenAL device

448 views Asked by At

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.

2

There are 2 answers

1
Jimmy Pewtress On

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 :)

0
user1224431 On

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.