Function

MusicEventIteratorPreviousEvent

Positions a music event iterator at the previous event on a music track.

Declaration

OSStatus MusicEventIteratorPreviousEvent(MusicEventIterator inIterator);

Parameters

inIterator

The music event iterator to reposition.

Return Value

A result code.

Discussion

Use this function to decrement a music event iterator, moving it backward through a music track’s events.

If an iterator is at the first event of a track when you call this function, the iterator position remains unchanged and this function returns an error.

The following code snippet illustrates how to use a music event iterator to proceed backward along a music track, from the end:

// Points iterator just beyond the final event on its music track
MusicEventIteratorSeek (myIterator, kMusicTimeStamp_EndOfTrack);
 
bool hasPreviousEvent;
MusicEventIteratorHasPreviousEvent (myIterator, &hasPreviousEvent);
while (hasPreviousEvent) {
    MusicEventIteratorPreviousEvent (myIterator);
        // do work here
    MusicEventIteratorHasPreviousEvent (myIterator, &hasPreviousEvent);
}

See Also