DoSound

void DoSound(number subFunction, ...)

Do sound handles all sound related functions such as playing, loading, unloading, stopping, pausing, etc. It uses the first parameter to identify it's subfunction, and the following parameters vary.

void DoSound(sndINIT, heapPtr sndObject)
Sets up the specified sound object. It loads the sound resource specified by the sound object's number property and sets it's status property to ssINITIALIZED.
Example
DoSound(sndINIT aSoundObject)
void DoSound(sndPLAY, heapPtr sndObject)
Plays the sound specified by the given sound object and sets the object's status property to sndPLAYING.
Example
DoSound(sndPLAY aSoundObject)
void DoSound(sndDISPOSE, heapPtr sndObject)
Disposes of the sound specified by the given object unloading it and removing it from the sound system.
Example
DoSound(sndDISPOSE aSoundObject)
bool DoSound(sndSET_SOUND[, bool fTURN_ON])
If the sound system is currently muted, it returns FALSE, otherwise, it returns TRUE.

If fTURN_ON is specified, it evaluates it and sets whether to mute or unmute the sound system. If it is TRUE, the sound system it unmuted. If it is FALSE, the sound system is muted.

Example
// If the sound system is not muted, mute it.
(if(DoSound(sndSET_SOUND))
  DoSound(sndSET_SOUND FALSE)
)
void DoSound(sndSTOP, heapPtr sndObject)
Stops playing the sound specified by the given sound object and sets the object's status property to sndSTOPPED.
Example
DoSound(sndSTOP aSoundObject)
void DoSound(sndPAUSE, heapPtr sndObject)
Pauses the sound specified by the given sound object and sets the object's status property to ssPAUSED.
Example
DoSound(sndPAUSE aSoundObject)
void DoSound(sndRESUME, heapPtr sndObject)
Resumes playing a previously paysed sound and sets it's status to sndPLAYING.
Example
DoSound(sndRESUME aSoundObject)
number DoSound(sndVOLUME[, number newVolume])
Returns the currently set sound volume, which is a number ranging from 0 to 15.If newVolume is specified, it sets the volume to newVol.
Example
(if(< DoSound(sndVOLUME) 7)
  DoSound(sndVOLUME 7)
)
void DoSound(sndUPDATE, heapPtr sndObject)
Tells the sound system to update the specified sound. It notifies it that the sound has changed so it's priority and loop properties are reevaluated.
Example
DoSound(sndUPDATE aSoundObject)
void DoSound(sndFADE, heapPtr sndObject)
Fades the specified sound for roughly two seconds, then stops it, setting it's status property to ssSTOPPED.
Example
DoSound(sndFADE aSoundObject)
bool DoSound(sndCHECK_DRIVER)
Checks to see if the sound driver is installed. If it is, it returns TRUE, otherwise, it returns FALSE.
Example
(if( not DoSound(sndCHECK_DRIVER) )
  Print("The sound driver is not installed!")
)
void DoSound(sndSTOP_ALL)
Stops all the sounds currently playing.
Example
DoSound(sndSTOP_ALL)