int32 spService (SPPlayer *player, int32 signals)
. processes signals received by the client's sent by the SPPlayer, and
. reads and spools more sound data, processing marker actions along the way.
This function synchronizes the SPPlayer's SoundSpooler to the state of the signals read from the last WaitSignal()
. You must call it after waiting for SPPlayer's signals before calling any other sound player function for this SPPlayer (with the exception of spDeletePlayer()
, which can tolerate the spooler being out of sync with the task's signals).
This function can set or clear the SP_STATUS_F_BUFFER_ACTIVE flag, depending on buffer usage. It clears SP_STATUS_F_READING when there's no more sound data to read. This function may be called under any player state including when SP_STATUS_F_PLAYING is not set without any ill effects.
This function must be called exactly once for each WaitSignal()
on an SPPlayer's signals. It will almost certainly have dangerous results if fed incorrect signals (signals other than from the most recent WaitSignal()
, or signals that it has already processed).
// error checking omitted for brevity
{
const int32 playersigs = spGetPlayerSignalMask (player);
// service player until it's done
while (spGetPlayerStatus(player) & SP_STATUS_F_BUFFER_ACTIVE) {
const int32 sigs = WaitSignal (playersigs |
othersignals1 |
othersignals2);
// service player before servicing other
// things that might affect the player
spService (player, playersigs);
// service other things
if (sigs & othersignals1) {
}
if (sigs & othersignals2) {
}
}
}
spGetPlayerSignalMask
(), spGetPlayerStatus(), spStartReading(), spStartPlaying()