SndPlay
SndChannelPtr chan; a pointer to a sound channel
Handle sndHdl; a handle to a sound Boolean async ; 0=await completion; 1=immediate return You use the SndPlay function to play the sounds that are stored in an 'snd ' resource, either format 1 or format 2.
chan a pointer to a sound channel
sndHdlt is a handle to a sound, which is expected to have the structure of a
format 1 or format 2 'snd ' resource. If the sound handle is in
format 1 and specifies a synthesizer, then the appropriate 'snth'
resource is loaded into memory and linked to the channel. All
commands and data contained in the sound handle are then sent to the
channel. Note that you can pass SndPlay a handle to some data created by calling SndRecord as well as a handle to an actual 'snd ' resource that you have loaded into memory.
async is a Boolean value. Use FALSE for normal (synchronous) ope ration or TRUE to enqueue the request and resume control immediately. See Async I/O.
noErr (0) No error
resProblem (-204) Problem loading the resource
badChannel (-205) Channel is corrupt or unusable
badFormat (-206) Resource is corrupt or unusable
Notes: The chan parameter is a pointer to a sound channel. If your application
passes NULL as the channel pointer, the Sound Manager creates a channel in your application's heap. The Sound Manager releases this memory after the sound has completed. If your application passes NULL as the
sound-channel pointer, the async parameter is ignored and the sound plays
synchronously.
If, however, your application does supply a sound-channel pointer in the
chan parameter, then the sound can be produced asynchronously. When a
sound is played asynchronously, a completion routine can be called when the
last command has finished processing. This procedure is the callback
If a format 1 'snd ' resource does not specify which synthesizer is to be
supports format 2 'snd ' resources using the sampled sound synthesizer and
a bufferCmd command. Note that to use SndPlay and the sampled sound synthesizer with a format 1 'snd ' resource, you must include a bufferCmd
command in the resource.