Forum Navigation
You need to log in to create posts and topics.

NSSound soundNamed:

Posted by: fblistserve <fblistserve@...>

On Jul 22, 2010, at 2:30 PM, Ken Shmidheiser wrote:

> Brian wrote
>
>> Failing a mistake ( likely )...
>
> No extension needed for System sounds:
>
> PlaySound( @"Glass” )

Thanks Ken. I’d read about not using the extension but there was no mention of failure if used. I cobbled this together but won’t use it now.

'---------------
BeginCFunction
void PlaySound( CFURLRef url )
{
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
NSSound *sound = [[NSSound alloc]
initWithContentsOfURL: (NSURL *)url
byReference:YES];
[sound play];
[sound release];
[localPool release];
}
EndC
toolbox PlaySound( CFStringRef filename )

dim as CFURLRef url

long if ( files$( _CFURLRefOpen,, "Open sound file in /system/libary/sounds", url ) )
PlaySound( url )
end if
RunApplicationEventLoop()
'---------------

Brian S