Contents

MusicEventIteratorNextEvent(_:)

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

Declaration

func MusicEventIteratorNextEvent(_ inIterator: MusicEventIterator) -> OSStatus

Parameters

  • inIterator:

    The music event iterator to reposition.

Return Value

A result code.

Discussion

Use this function to increment the position of a music event iterator forward through a music track’s events.

If an iterator is at the final event of a track when you call this function, the iterator then moves beyond the final event. You can detect if the iterator is beyond the final event by calling the MusicEventIteratorHasCurrentEvent(_:_:) function.

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

// Create a new iterator, which automatically points at the first event
// on the iterator's music track.
 
bool hasCurrentEvent;
MusicEventIteratorHasCurrentEvent (myIterator, &hasCurrentEvent);
while (hasCurrentEvent) {
        // do work here
    MusicEventIteratorNextEvent (myIterator);
    MusicEventIteratorHasCurrentEvent (myIterator, &hasCurrentEvent);
}

See Also

Iterating Over Music Events