spService

Service SPPlayer

Synopsis

int32 spService (SPPlayer *player, int32 signals)

Description

This function

. 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).

Arguments

player
Pointer to SPPlayer to service.
signals
Signals last received to process. Ignores any signals that do not belong to this SPPlayer. Does nothing if none of the SPPlayer's signals are set.

Return Value

Non-negative player status flags (SP_STATUS_F_) on success; negative error code on failure.

Implementation

Library call implemented in music.lib V24.

Examples

// 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) {
        }
    }
}

Associated Files

soundplayer.h, music.lib

See Also

spGetPlayerSignalMask(), spGetPlayerStatus(), spStartReading(), spStartPlaying()