• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: didFinishPlaying NSSound
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: didFinishPlaying NSSound


  • Subject: Re: didFinishPlaying NSSound
  • From: Dani <email@hidden>
  • Date: Wed, 27 Jun 2007 20:01:11 +0200

I've followed that guide but for some reason it doesn't work.

That's my code in @implementation:

@implementation PlaySong

- (void) sound:(NSSound *)sound didFinishPlaying:(BOOL) playbackSuccessful
{
i=i+1;
if (playbackSuccessful) {
[snd release];
prova = [files objectAtIndex:i];
snd = [[NSSound alloc] initWithContentsOfFile:prova byReference:YES];
[snd play];
}
else {


    }
}

@end

and this in @interface:

@interface PlaySong : NSObject
{
	NSArray *files;
	NSString *prova;
	NSSound *snd;
	IBOutlet NSTableView *tableView;
	int i;
}
- (IBAction)play:(id)sender;
- (IBAction)stop:(id)sender;
- (IBAction)open:(id)sender;
- (IBAction)next:(id)sender;
- (IBAction)previous:(id)sender;
- (IBAction)pause:(id)sender;

- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn: (NSTableColumn *)aTableColumn row:(int)row;
- (void) sound:(NSSound *)sound didFinishPlaying:(BOOL) playbackSuccessful;


@end

I don't remember where, I found somebody that says that I need to do that:

[sound setDelegate]

but I don't know in wich part of my code. And after reading about delegates I don't understant how they really works and how Cocoa calls the didFinishPlaying delegate method when a song has finisehd.

Thanks

El 27/06/2007, a las 19:53, Matt Neuburg escribió:

On Wed, 27 Jun 2007 18:58:25 +0200, Dani <email@hidden> said:
Hi, I've been working with the NSSound class but now I want to play
the next song from a NSArray when the current one finish. So, for
doing that I need to use the didFinishPlaying delegate method and I
don't know how to use it. Some help? I've read other  posts but I
don't find any solution.

<http://developer.apple.com/documentation/Cocoa/Conceptual/Sound/ Tasks/Playi
ngAudioData.html>


m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>




_______________________________________________

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


References: 
 >Re: didFinishPlaying NSSound (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Bindings / NSTableView (limitation ?)
  • Next by Date: Re: Bindings / NSTableView (limitation ?)
  • Previous by thread: Re: didFinishPlaying NSSound
  • Next by thread: setting up an NSTextView manually
  • Index(es):
    • Date
    • Thread