Contents

MusicSequenceSetUserCallback(_:_:_:)

Registers a user callback function with a music sequence.

Declaration

func MusicSequenceSetUserCallback(_ inSequence: MusicSequence, _ inCallback: MusicSequenceUserCallback?, _ inClientData: UnsafeMutableRawPointer?) -> OSStatus

Parameters

  • inSequence:

    The music sequence that you want to add a user callback function to.

  • inCallback:

    A reference to your callback function. Use NULL to remove a registered callback function.

  • inClientData:

    Your data that the music sequence provides back to your callback function when it is invoked.

Return Value

A result code.

Discussion

The music sequence invokes your callback for each user event added to any music track owned by the sequence. If there is a callback registered, then UserEvents will be chased when MusicPlayerSetTime is called. In that case the inStartSliceBeat and inEndSliceBeat will both be the same value and will be the beat that the player is chasing to.

Usually, where the sequence data is being scheduled for playback, the following applies:

inStartSliceBeat <= inEventTime < inEndSliceBeat

The only exception to this is if the track that owns the MusicEvent is looping. In this case the start beat will still be less than the end beat (so your callback can still determine that it is playing, and what beats are currently being scheduled), however, the inEventTime will be the original time-stamped time of the user event.

See Also

Managing Music Sequences