Pausing and Restarting Sound Channels
Pausing and Restarting Sound Channels Interrupting play
If you want to pause command processing in a particular channel, you can use
either of two sound commands, waitCmd or pauseCmd. The waitCmd command
suspends all processing in a channel for a specified number of
half- milliseconds. Here's an example:
mySndCmd.cmd = waitCmd; [TOKEN:12079]the command is waitCmd
mySndCmd. param1 = 2000; [TOKEN:12079]1 second wait duration
mySndCmd. param2 = 0; [TOKEN:12079]unused
//pause the channel
myErr = SndDoImmediate(& mySndChan, mySndCmd);
To pause the processing of commands in a sound channel for an un specified
duration, use the pauseCmd command. Unlike waitCmd, pauseCmd suspends
processing for an un determined amount of time. Processing does not resume
until the Sound Manager receives a resumeCmd command for the specified
channel.
To issue waitCmd or pauseCmd, you can use either SndDoImmediate or
SndDoCommand, depending on whether you want the suspension of
sound-channel processing to begin immediately or when the synthesizer
reaches that command in the normal course of reading commands from a sound
channel. The resumeCmd command, which is simply the opposite of pauseCmd,
should be issued by using SndDoImmediate. Neither waitCmd nor pauseCmd
stops any sound that is currently playing; these commands simply stop further
processing of commands queued in the sound channel.
Note: Synthesizers expect to receive additional commands after a
resumeCmd command. If no other commands are pending in the sound
channel, the Sound Manager sends an emptyCmd command. The
emptyCmd command is sent only by the Sound Manager and should
not be issued by your application.