alSeqPlayer (function)

Nintendo 64 MIDI sequence player routines


#include <libaudio.h>     /* libaudio.h */

void  alSeqpNew(ALSeqPlayer *seqp, ALSeqpConfig *config);
void  alSeqpDelete(ALSeqPlayer *seqp);
void  alSeqpSetSeq(ALSeqPlayer *seqp, ALSeq *seq);
ALSeq *alSeqpGetSeq(ALSeqPlayer *seqp);
void  alSeqpSetBank(ALSeqPlayer *seqp,ALBank *b);
s32   alSeqpGetState(ALSeqPlayer *seqp);
void  alSeqpPlay(ALSeqPlayer *seqp);
void  alSeqpStop(ALSeqPlayer *seqp);
void  alSeqpSetTempo(ALSeqPlayer *seqp, s32 tempo);
s32   alSeqpGetTempo(ALSeqPlayer *seqp);
s16   alSeqpGetVol(ALSeqPlayer *seqp);
void  alSeqpSetVol(ALSeqPlayer *seqp, s16 vol);
void  alSeqpSetChlProgram(ALSeqPlayer *seqp, u8 chan, u8 prog);
s32   alSeqpGetChlProgram(ALSeqPlayer *seqp, u8 chan);
void  alSeqpSetChlFXMix(ALSeqPlayer *seqp, u8 chan, u8 fxmix);
u8    alSeqpGetChlFXMix(ALSeqPlayer *seqp, u8 chan);
void  alSeqpSetChlVol(ALSeqPlayer *seqp, u8 chan, u8 vol);
u8    alSeqpGetChlVol(ALSeqPlayer *seqp, u8 chan);
void  alSeqpSetChlPan(ALSeqPlayer *seqp, u8 chan, ALPan pan);
ALPan alSeqpGetChlPan(ALSeqPlayer *seqp, u8 chan);
void  alSeqpSetChlPriority(ALSeqPlayer *seqp, u8 chan, u8 priority);
u8    alSeqpGetChlPriority(ALSeqPlayer *seqp, u8 chan);
void  alSeqpSendMidi(ALSeqPlayer *seqp, s32 ticks, u8 status, u8 byte1, u8 byte2);
void  alSeqpLoop(ALSeqPlayer *seqp, ALSeqMarker *start, ALSeqMarker *end, s32 count);


The Nintendo 64 Audio Library supports the playback of MIDI sequences by using either the Type 0 MIDI Sequence Player (the routines begin with alSeqp) or the Compressed MIDI Sequence Player (the routines begin with alCSP).

This page details the Type 0 MIDI Sequence Player. For details of the Compressed MIDI Sequence Player, see the page for alCSeqPlayer. The two MIDI players differ in their handling of loops and their compression of data. Details are discussed in the Audio Library and Audio Formats sections of the Nintendo 64 Programming Manual

The sequence player handles the playback of the sequence, but the actual sequence data is handled by a Sequence.

To use the Sequence Player, you must first initialize an ALSeqPlayer structure to represent it. To do this, call alSeqpNew.

After initializing the ALSeqPlayer structure, you must set the bank and the sequence by calling alSeqpSetBank and alSeqpSetSeq respectively.

To start the sequence player playing, call alSeqpPlay. To stop the sequence player, call alSeqpStop. The sequence player can only have one target sequence at a time. You must stop a sequence before setting and playing a new sequence. You should not attempt to switch banks while a sequence is playing. You can use the alCSPGetSeq function to determine if the sequence player is fully stopped. When you call alSeqpPlay, all processing of the sequence stops and all notes are turned off.

When a sequence is stopped, it will not rewind. It remains pointing to its current location. This allows you to restart a sequence from where it was stopped by calling alSeqpPlay. Sustained notes that were cut off by a call to alSeqpStop are not restarted, only new notes are processed.

If you want to rewind the sequence or relocate to another point in the sequence, you can create an ALSeqMarker at the desired location by calling alSeqNewMarker, and then call alSeqSetLoc to rewind or relocate the sequence. Note that these calls do not affect the channel playback state, so make sure that the channel arguments (such as program, volume, pan, and so on) are set to appropriate values for the given sequence location.

You can set channel arguments by calling individual functions or by sending the appropriate MIDI data in a call to alSeqpSendMidi. Music can be created in real time and played back by calling alSeqpSendMidi.

A single loop can be created by calling alSeqpLoop; however, you must first create and set a beginning and an ending loop. Looping of individual tracks is not supported by the sequence player. For more involved looping. see the compressed MIDI sequence player (alCSeqPlayer) routine.

See Also

alSeq, alSeqpNew, alSeqpDelete, alSeqpSetSeq, alSeqpGetSeq, alSeqpPlay, alSeqpStop, alSeqpSetBank, alSeqpSetTempo, alSeqpGetTempo, alSeqpGetVol, alSeqpSetVol, alSeqpSetChlProgram, alSeqpGetChlProgram, alSeqpSetChlFXMix, alSeqpGetChlFXMix, alSeqpSetChlPan, alSeqpGetChlPan, alSeqpSetChlVol, alSeqpGetChlVol, alSeqpSetChlPriority, alSeqpGetChlPriority, and alSeqpSendMidi

Revision History

1999/04/30 Changed Format