N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## alSeqpLoop

Syntax

    #include <libaudio.h>
    void alSeqpLoop(ALSeqPlayer *seqp, ALSeqMarker *start, ALSeqMarker *end, int count);

Arguments

- seqp is the pointer to the sequence player
- start is the pointer to the loop start marker
- end is the pointer to the loop end marker
- count is the number of times to loop - a value of -1 means loop forever

Explanation
It sets the sequence loop points to the locations specified by the start and end markers. These markers must have been previously initialized by calling alSeqNewMarker.
To use loops effectively, several important points concerning the behavior of loops and markers must be understood. First, markers always get positioned at sequence event locations, so if you create a new marker at a tick location that does not correspond to a sequence event, alSeqNewMarker will "snap" the marker to the event previous to the tick time.
Second, loops are inclusive of the start marker's event and exclusive of the end marker's event. That is, the loop is defined as [start, end).
Third, loops should always contain an equal number of "note on" and "note off" events. This is very important because if the end marker is positioned on a "note off" event, it will not be part of the loop and the voice of the corresponding "note on" will never be released. Therefore, each time through the loop, a voice is used up until the maximum number of allocated voices has been reached. Because of this, you need to be very careful to place the end marker so that each "note on" event is matched with a "note off" event, even if this means placing a dummy event at the end loop marker.
Overall, the alSeqpLoop function is designed for looping over the entire sequence or over well-defined sections of a sequence. For more comprehensive loops that are on a track-by-track basis, see the compact sequence player that embeds loop points in the sequence stream.
Warning
The loop markers must remain allocated for the entire duration of the loop because the sequence player stores references to these markers.
See Also
alSeqNewMarker

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last Updated April, 1999