Handles the Nintendo 64 Compressed MIDI sequence player routines
#include <libaudio.h> /* libaudio.h */void alCSPNew(ALCSPlayer *seqp, ALSeqpConfig *config); void alCSPDelete(ALCSPlayer *seqp); void alCSPSetSeq(ALCSPlayer *seqp, ALCSeq *seq); ALCSeq *alCSPGetSeq(ALCSPlayer *seqp); void alCSPSetBank(ALCSPlayer *seqp, ALBank *b); s32 alCSPGetState(ALCSPlayer *seqp); void alCSPPlay(ALCSPlayer *seqp); void alCSPStop(ALCSPlayer *seqp); void alCSPSetBank(ALCSPlayer *seqp, ALBank *b); void alCSPSetTempo(ALCSPlayer *seqp, s32 tempo); s32 alCSPGetTempo(ALCSPlayer *seqp); s16 alCSPGetVol(ALCSPlayer *seqp); void alCSPSetVol(ALCSPlayer *seqp, s16 vol); void alCSPSetChlProgram(ALCSPlayer *seqp, u8 chan, u8 prog); s32 alCSPGetChlProgram(ALCSPlayer *seqp, u8 chan); void alCSPSetChlFXMix(ALCSPlayer *seqp, u8 chan, u8 fxmix); u8 alCSPGetChlFXMix(ALCSPlayer *seqp, u8 chan); void alCSPSetChlPan(ALCSPlayer *seqp, u8 chan, ALPan pan); ALPan alCSPGetChlPan(ALCSPlayer *seqp, u8 chan); void alCSPSetChlVol(ALCSPlayer *seqp,u8 chan, u8 vol); u8 alCSPGetChlVol(ALCSPlayer *seqp, u8 chan); void alCSPSetChlPriority(ALCSPlayer *seqp, u8 chan, u8 priority); u8 alCSPGetChlPriority(ALCSPlayer *seqp, u8 chan); void alCSPSendMidi(ALCSPlayer *seqp, long ticks, u8 status, u8 byte1, u8 byte2);
The Nintendo 64 Audio Library supports the playback of MIDI sequences using either the Type 0 MIDI Sequence Player (function names that begin with alSeqp) or the Compressed MIDI Sequence Player (function names that begin with alCSP).
This page details the Compressed MIDI Sequence Player. For details about the Type 0 MIDI Sequence Player, see the alSeqPlayer page. The principle differences between the two MIDI players are the handling of loops, and the 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 (see alCSeq).
To use a Compressed Sequence Player, you must first initialize an ALCSPlayer structure to represent it. This is accomplished by calling the alCSPNew function.
After initializing the ALCSPlayer structure, you must set the bank and the sequence by calling alCSPSetBank and alCSPSetSeq respectively.
To start the sequence player, call alCSPPlay. To stop the sequence player, call alCSPStop. 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 alCSPGetSeq to determine if the sequence player is fully stopped. When you call alCSPStop, all processing of the sequence will stop and all notes will be turned off.
When a sequence is stopped, it will not rewind; it continues to point to its current location. This allows you to restart a sequence from where it was stopped by calling alCSPPlay. Sustained notes that were cut off by a call to alCSPStop 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 ALCSeqMarker at the desired location by calling the alCSeqNewMarker function. Then call alCSeqSetLoc to rewind or relocate the sequence. Note that these calls do not affect the channel playback state, so you must ensure that the channel arguments (such as program, volume, pan, and so on) are set to appropriate values for the given sequence location.
Channel arguments can be set by calling their individual functions or by sending the appropriate MIDI data using the alCSPSendMidi function. Music can be created in real time and played back by calling the alCSPSendMidi function.
The compressed MIDI sequence player does not support loops created by application programming interface (API) calls. To loop music using the Compressed MIDI Sequence Player, you must ensure that the sequences have loop points embedded in them. To learn how to embed loop points, see the Audio Library section of the Nintendo 64 Programming Manual.
alCSeq, alCSPNew, alCSPDelete , alCSPSetSeq, alCSPGetSeq, alCSPPlay, alCSPStop, alCSPSetBank, alCSPSetTempo, alCSPGetTempo, alCSPGetVol, alCSPSetVol, alCSPSetChlProgram, alCSPGetChlProgram, alCSPSetChlFXMix, alCSPGetChlFXMix, alCSPSetChlPan, alCSPGetChlPan, alCSPSetChlVol, alCSPGetChlVol, alCSPSetChlPriority, alCSPGetChlPriority, and alCSPSendMidi
1999/04/30 Changed Format