NSSound 'selector not recognized' error
NSSound 'selector not recognized' error
- Subject: NSSound 'selector not recognized' error
- From: Russ McBride <email@hidden>
- Date: Thu, 16 Aug 2007 15:31:58 -0700
I'm moving this over from the coreAudio list since it doesn't seem to
get too much traffic.
I still can't seem to figure out why I'm getting a "selector not
recognized" error when I try to pause a playing sound. When I pause
a playing built-in system sound everything works find. But I get the
error when I try to pause a sound from a local file.
Any tips appreciated.
Thanks,
russ
================================
interface--
NSSound *theSound;
implementation--
// Getter and setter methods for theSound instance variable.
- (NSSound *)theSound
{
return theSound;
}
- (void)setTheSound:(NSSound *)newSound
{
theSound = newSound;
[theSound setDelegate:self];
}
// Plays the selected system sound from an NSTableView.
// This can always be paused just fine.
- (IBAction)playSystemSound:(id)sender
{
NSString *selectedSoundAsString = [builtinSounds objectAtIndex:
[tableView selectedRow]];
NSSound *selectedSound;
selectedSound = [NSSound soundNamed:selectedSoundAsString];
[self setTheSound:selectedSound];
[theSound play];
}
// Plays a sound the user selects his file system. Generates
// error is pause is attempted.
- (IBAction)playFromLocalFile:(id)sender
{
NSString *theFileName;
// Do stuff to get theFileName set to some local sound file,
e.g., an .mp3 file . . .
NSSound *localSound = [[NSSound alloc]
initWithContentsOfFile:theFileName byReference:YES];
[self setTheSound:localSound];
[theSound play];
}
// This creates a "selector not found" error when theSound is
// played from the method, playFromLocalFile, then paused, but it
doesn't generate an error
// when the sound is played from the method, playSystemSound, then
paused.--?????
- (IBAction) pause:(id)sender
{
[theSound pause];
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden