Thread View: comp.sys.next.programmer
4 messages
4 total messages
Started by aoml
Thu, 30 Jul 1992 21:05
Using a sound in an application...
Author: aoml
Date: Thu, 30 Jul 1992 21:05
Date: Thu, 30 Jul 1992 21:05
8 lines
596 bytes
596 bytes
I have a sound that exists in my nib section. How can I execute that sound easily? I know that a button can have a sound associated with it, but I really would prefer being able to execute the sound when the program deems it necessary, not when the user does an action. Thanks for your help, Kevin
Re: Using a sound in an application...
Author: Mike Jory
Date: Fri, 31 Jul 1992 02:57
Date: Fri, 31 Jul 1992 02:57
7 lines
612 bytes
612 bytes
To play a sound, add the following code to your program: #import <sound/sound.h> and whenever you want to play the sound: SNDPlaySoundfile(filename,0); mtj@unbsj.ca
Re: Using a sound in an application...
Author: Eric P. Scott
Date: Fri, 31 Jul 1992 06:01
Date: Fri, 31 Jul 1992 06:01
22 lines
1284 bytes
1284 bytes
In article <30JUL92.17051704@enh.nist.gov> aoml@enh.nist.gov writes: >I have a sound that exists in my nib section. How can I execute that sound >easily? In article <1992Jul31.025720.901@jupiter.sun.csd.unb.ca> mtj@unbsj.ca (Mike Jory) writes: >and whenever you want to play the sound: >SNDPlaySoundfile(filename,0); That doesn't help, because the sound doesn't have a file name. You *could* use getsectdata(3) to "directly" obtain a SNDSoundStruct * and feed that to SNDStartPlaying(), but it's probably easier to use the SoundKit's Sound class (+addName:fromMachO: or +findSoundFor:), and -play that. Remember that sound playback occurs in a separate thread, and you may want to use -waitUntilStopped or a -didPlay: delegate method to keep things synchronized. -=EPS=-
Re: Using a sound in an application...
Author: mkrogers
Date: Mon, 03 Aug 1992 01:28
Date: Mon, 03 Aug 1992 01:28
11 lines
977 bytes
977 bytes
In article <30JUL92.17051704@enh.nist.gov>, aoml@enh.nist.gov writes: > I have a sound that exists in my nib section. How can I execute that sound > easily? I know that a button can have a sound associated with it, but I really > would prefer being able to execute the sound when the program deems it > necessary, not when the user does an action. A combination of using the Sound class and +findSoundFor: and -play will do it. Look them up in the Librarian. -mike mkr@cs.amherst.edu
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads