Scripting Additions Guide
Table Of Contents
CHAPTER 3
Writing Scripting Additions
100 Sample Scripting Addition
////////////////////////////////////////////////////////////////////
//
// PlaySound(Handle theSoundHdl)
//
// This is the code to play a 'snd '.
//
//////////////////////////////////////////////////////////////////
OSErr PlaySound(Handle theSoundHdl)
{
/* our variables */
OSErr theErr = noErr;
SndChannelPtr theSndChan = NULL; /*NULL pointer to a */
/* sound channel*/
/* open a channel so we can do synchronous play */
theErr = SndNewChannel (&theSndChan, sampledSynth,
initMono, NULL);
if (theErr == noErr) /* play that sound */
theErr = SndPlay (theSndChan, theSoundHdl, !kAsync);
/* dispose of the channel, if the sound channel was allocated */
if (theSndChan != NULL)
SndDisposeChannel(theSndChan, !kQuietNow);
return theErr;
}