NSSound + NSBundle
NSSound + NSBundle
- Subject: NSSound + NSBundle
- From: "Tim Simon" <email@hidden>
- Date: Sun, 22 Apr 2007 10:34:09 +0930
I have a program that plays sounds that are added into the project.
Whilst this works fine, i want to be able to select a song that is in
any directory on my Mac, without adding it specifically to the project
itself.
To initialize the first song, this code is used:
song1 = [[NSSound alloc] initWithContentsOfFile:[thisBundle
pathForResource:@"sound1" ofType:@"mp3"] byReference:YES];
I tried using a NSTextField to allow the user to enter the path for
the sound, and then use
song1 = [[NSSound alloc] initWithContentsOfFile:[thisBundle
pathForResource:[NSTextField stringValue] ofType:@"mp3"]
byReference:YES];
to play, but this comes up with errors. I belive that it is something
to do with the NSBundle that is used, but im not sure how to actually
change it so it works.
Cheers, Tim
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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