Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of MacOSX sound resources [closed]

I'm looking for some objective-c code that outputs to NSLog the name of every available Sound resource on the current MacOSX system. I've done lots of google searches. I'm missing some key term as the searches are not turning up anything useful. I've got code working to play a sound as long as I know the name of the sound from How do I play a sound in Mac OS?.

// Assumes #import <AppKit/AppKit.h> and the framework has been added. 
NSSound *sound = [[NSSound alloc] initWithContentsOfFile:    [[NSBundle mainBundle] pathForResource:@"Fark" ofType:@"mp3"] byReference:NO];
[sound play];
[sound release];
like image 467
Keith John Hutchison Avatar asked Dec 07 '25 02:12

Keith John Hutchison


1 Answers

Take a look at the documentation for +[NSSound soundNamed:] and you'll find that that method will search the following directories after looking in the application's main bundle:

~/Library/Sounds
/Library/Sounds
/Network/Library/Sounds
/System/Library/Sounds

So those would probably be good places to look for the system sounds available on your machine.

"every available Sound resource on the current MacOSX system" is a rather tall order, depending on what you mean. The system sounds will likely be found in the directories described above, but there may also be sounds inside applications that you might or might not consider to be part of the operating system.

like image 194
Caleb Avatar answered Dec 09 '25 20:12

Caleb