I have a music app that I'm upgrading with Finch. In it, I have an uninstantiated model class, inheriting from UIView called PSNeckViewAbstract that initializes Finch in awakeFromNib:
PSNeckViewAbstract has three subclasses that implement loadNotes (which is an empty method in PSNeckViewAbstract) and do not override awakeFromNib. Obviously, all of them also inherit the class variable Finch *engine as well. However, when the three subclasses call [[Finch alloc]init], Finch prints "Finch: Could not open default OpenAL device." in the debugger. This is because device = alcOpenDevice(NULL) didn't return a device. What's going on?
Code:
-(void)setupAudioSession
{
audioSession = [AVAudioSession sharedInstance];
audioSession.delegate = self;
// Assign the Playback category to the audio session.
NSError *audioSessionError = nil;
[audioSession setCategory:AVAudioSessionCategoryPlayback error:&audioSessionError];
NSAssert(audioSessionError == nil, @"Failed to set audio session category.");
[audioSession setActive:YES error:&audioSessionError];
NSAssert(audioSessionError == nil, @"Failed to activate audio session.");
}
...
-(void)awakeFromNib
{
[super awakeFromNib];
[self setupAudioSession];
engine = [[Finch alloc]init];
[self loadNotes];
}
PSNeckViewAbstract has three subclasses that implement loadNotes (which is an empty method in PSNeckViewAbstract) and do not override awakeFromNib. Obviously, all of them also inherit the class variable Finch *engine as well. However, when the three subclasses call [[Finch alloc]init], Finch prints "Finch: Could not open default OpenAL device." in the debugger. This is because device = alcOpenDevice(NULL) didn't return a device. What's going on?