Re: Getting a list of system sounds, etc.
Re: Getting a list of system sounds, etc.
- Subject: Re: Getting a list of system sounds, etc.
- From: Evan Gross <email@hidden>
- Date: Thu, 11 Apr 2002 20:51:39 -0400
On 4/11/02 12:11 PM, "Mike O'Connor" <email@hidden> wrote:
>
I want the user to be able to choose a system sound to play. As a Cocoa
>
novice, I'm still learning the available calls. Is there some facility that
>
will help me assemble lists of these types of things? System sounds can be
>
in several places: /Library, ~/Library, System/Library... You have to get
>
filenames from these places, perhaps strip off the file type extensions,
>
perhaps sort them, and so on. This seems like it might be a common problem
>
for lots of things that can be in Library subdirectories.
>
>
Is there something that can enumerate through all the files in all the
>
directories a particular type of system file might be, something like that?
>
It doesn't seem too tough to roll my own, but I didn't want to miss out on
>
something that might already be in the system. Some kind of super FindFolder
>
or something...
>
I needed to do this same exact thing, but couldn't find any single (or
couple of) toolbox calls to do it (too bad that none of the xxxResMenu() or
GetIndResource() calls don't work like they do on OS 8/9). I'm pretty sure
you have to roll your own.
So, FWIW, I look in (using FSFindFolder and then enumerating the files and
adding the ones that match one of the types returned by +[NSSound
soundUnfilteredFileTypes]):
kUserDomain, kSystemSoundsFolderType then
kLocalDomain, kSystemSoundsFolderType then
kNetworkDomain, kSystemSoundsFolderType then
kSystemDomain, kSystemSoundsFolderType.
(always specifying kDontCreateFolder).
Not sure if I'm perhaps missing some domain that might contain sounds, but
this seems to do the trick.
If there's an easier way, I'd like to know about it as well...
Hope this helps,
Evan Gross
Rainmaker Research Inc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.