Re: NSSound and private embedded frameworks
Re: NSSound and private embedded frameworks
- Subject: Re: NSSound and private embedded frameworks
- From: Philip Dow <email@hidden>
- Date: Tue, 3 Jan 2006 10:57:06 +0100
Boisy, you may want to try the following.
First, get the NSBundle object for your framework using :
NSBundle *myFrameworkBundle = [NSBundle
bundleWithIdentifier:@"com.myframework.name"];
Then get the path to the sound file using
NSString *soundPath = [myFrameworkBundle
pathForResource:@"MySoundName" ofType:@"wav"];
Make sure the sound file ends in the .wav extension. That sound path
should be a complete path whether using the framework or the
application. Use that path to initialize your NSSound object - (id)
initWithContentsOfFile:(NSString *)path byReference:(BOOL)byRef
-Phil
On Jan 2, 2006, at 2:32 AM, Boisy Pitre wrote:
Hi all,
I have a private embedded framework that contains code, several
image files and several WAV files. In turn, this framework is
inside of the a Cocoa application bundle.
There are two .wav files: insert.wav and eject.wav which are part
of the framework, and are in the BP.framework/Resources folder.
The BP.framework folder in turn is located in the applications
Contents/Frameworks folder (hence it is "private embedded")
I've followed the instructions on http://rentzsch.com/cocoa/
embeddedFrameworks and so far almost everything is working EXCEPT
for sound.
In a routine in the framework code, I have the following lines:
insertSound = [NSSound soundNamed:@"insert"];
NSLog(@"Insert Sound = %X", insertSound);
The log shows that insertSound is 0 (nil) when I run the
application. However, if I copy eject.wav and insert.wav from
Contents/Frameworks/BP.framework/Resources to Contents/Resources,
the Log shows that the insertSound pointer is not nil and the sound
actually works.
The framework's NIB file shows the 'insert' and 'eject' sounds in
the Sounds tab, so the NIB file "sees" them, but it appears that
NSSound is only looking in Contents/Resources and not the
framework's Resources folder for sounds.
Could someone possibly shed some light on why this might be
happening? If I haven't provided enough information, please let me
know.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden