<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AudioToolbox",
  "identifier" : "/documentation/AudioToolbox/MusicEventIteratorNextEvent(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Audio Toolbox"
    ],
    "preciseIdentifier" : "c:@F@MusicEventIteratorNextEvent"
  },
  "title" : "MusicEventIteratorNextEvent(_:)"
}
-->

# MusicEventIteratorNextEvent(_:)

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

```
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(_:_:)`](/documentation/AudioToolbox/MusicEventIteratorHasCurrentEvent(_:_:)) function.

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

```objc
// 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);
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)