MusHandlePause()

Syntax

int MusHandlePause(musHandle handle);

Arguments

handle
the sound handle

Description

It pauses the processing and silences the channels associated with the specified sound handle. The channels will stop processing on the next player update and have their current volume level set to zero (when switched to the thread for music player).

The pausing/resuming process may result in songs not quite sounding exactly as they should. This is because processing is suspended but the samples currently being used will play through to the end or loop. When processing is resumed, some samples may be offset because the sample playing continues during the pause period.

This function passes the pause command to the player via the FIFO buffer. If there is no space free in the FIFO buffer, this command will be ignored. The FIFO buffer is emptied every time the player processes sound data.

The handle must be a sound handle returned by MusStartSong(), MusStartSongFromMarker(), MusStartEffect(), or MusStartEffect2(). If a handle of zero is supplied, this function will always return zero.

Return Value

Zero (0) if the FIFO command has been ignored, otherwise a non-zero value.

Example

void PauseSong(musHandle handle)
{
  int i;

  for (i=0x80; i!=0; i-=0x20)
  {
    WaitForVsync();
    MusHandleSetVolume(handle, i);
  }
  while (MusHandlePause(handle)==0)
    WaitForVsync();
}

See Also

MusHandleUnPause(), MusStartSong(), MusStartEffect(), MusStartEffect2()