Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MachCUBED

macrumors newbie
Original poster
Apr 22, 2010
11
0
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:

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?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.