Inherits from NSObject
Declared in MIKMIDITrack.h

Overview

Instances of MIKMIDITrack contain sequences of MIDI events. Commonly, these will be MIDI notes. Multiple MIKMIDITracks can be contained in a MIKMIDISequence, which can be played.

Tasks

Properties

destinationEndpoint

@property (nonatomic, strong, readwrite) MIKMIDIDestinationEndpoint *destinationEndpoint
Discussion

The destination endpoint for the MIDI events of the track during playback.

Declared In

MIKMIDITrack.h

doesLoop

@property (nonatomic, readonly) BOOL doesLoop
Discussion

Whether the track is set to loop.

Declared In

MIKMIDITrack.h

events

@property (nonatomic, copy) NSArray *events
Discussion

An array of MIKMIDIEvent containing all of the MIDI events for the track.

Declared In

MIKMIDITrack.h

length

@property (nonatomic) MusicTimeStamp length
Discussion

The length of the MIDI track.

Declared In

MIKMIDITrack.h

loopDuration

@property (nonatomic) MusicTimeStamp loopDuration
Discussion

The point in a MIDI track, measured in beats from the end of the MIDI track, at which to begin playback during looped playback. That is, during looped playback, a MIDI track plays from (length – loopDuration) to length.

This is a shortcut to the loopDuration member of the loopInfo property.

Declared In

MIKMIDITrack.h

loopInfo

@property (nonatomic) MusicTrackLoopInfo loopInfo
Discussion

The loop info for the track.

Declared In

MIKMIDITrack.h

musicTrack

@property (nonatomic, readonly) MusicTrack musicTrack
Discussion

The underlying MusicTrack that backs the instance of MIKMIDITrack.

Declared In

MIKMIDITrack.h

muted

@property (nonatomic, getter=isMuted) BOOL muted
Discussion

Whether or not the MIDI track is muted.

Declared In

MIKMIDITrack.h

notes

@property (nonatomic, readonly) NSArray *notes
Discussion

An array of MIKMIDINoteEvent containing all of the MIDI note events for the track.

Declared In

MIKMIDITrack.h

numberOfLoops

@property (nonatomic) SInt32 numberOfLoops
Discussion

The number of times to play the designated portion of the music track. By default, a music track plays once.

This is a shortcut to the numberOfLoops member of the loopInfo property.

Declared In

MIKMIDITrack.h

offset

@property (nonatomic) MusicTimeStamp offset
Discussion

A MIDI track’s start time in terms of beat number. By default this value is 0.

Declared In

MIKMIDITrack.h

sequence

@property (weak, nonatomic, readonly) MIKMIDISequence *sequence
Discussion

The MIDI sequence the track belongs to.

Declared In

MIKMIDITrack.h

solo

@property (nonatomic, getter=isSolo) BOOL solo
Discussion

Whether or not the MIDI track is soloed.

Declared In

MIKMIDITrack.h

timeResolution

@property (nonatomic, readonly) SInt16 timeResolution
Discussion

The time resolution for a sequence of MIDI events. For example, this value can indicate the time resolution that was specified by the MIDI file used to construct a sequence.

If you create a MIDI sequence programmatically, the value is set to 480. If you create a MIDI sequence from a MIDI file, the value is set to the time resolution specified in the MIDI file.

Declared In

MIKMIDITrack.h

Class Methods

trackWithSequence:musicTrack:

+ (instancetype)trackWithSequence:(MIKMIDISequence *)sequence musicTrack:(MusicTrack)musicTrack
Discussion

Creates and initializes a new MIKMIDITrack.

Note: You should not call this method. To add a new track to a MIDI sequence use [MIKMIDISequence addTrack].

Parameters

sequence

The MIDI sequence the new track will belong to.

musicTrack

The MusicTrack to use as the backing for the new MIDI track.

Declared In

MIKMIDITrack.h

Instance Methods

clearAllEvents

- (BOOL)clearAllEvents
Discussion

Removes all MIDI events from the track.

Return Value

Whether or not removing all of the MIDI events from the track was succesful.

Declared In

MIKMIDITrack.h

clearEventsFromStartingTimeStamp:toEndingTimeStamp:

- (BOOL)clearEventsFromStartingTimeStamp:(MusicTimeStamp)startTimeStamp toEndingTimeStamp:(MusicTimeStamp)endTimeStamp
Discussion

Removes all of the MIDI events between startTimeStamp and endTimeStamp inclusively.

Parameters

startTimeStamp

The starting time stamp for the range of the events to remove.

endTimeStamp

The ending time stamp for the range of the events to move.

Return Value

Whether or not moving the MIDI events was succesful.

Declared In

MIKMIDITrack.h

copyEventsFromMIDITrack:fromTimeStamp:toTimeStamp:andInsertAtTimeStamp:

- (BOOL)copyEventsFromMIDITrack:(MIKMIDITrack *)origTrack fromTimeStamp:(MusicTimeStamp)startTimeStamp toTimeStamp:(MusicTimeStamp)endTimeStamp andInsertAtTimeStamp:(MusicTimeStamp)destTimeStamp
Discussion

Copies MIDI events from one track and inserts them into the receiver.

Parameters

origTrack

The track to copy the events from.

startTimeStamp

The starting time stamp for the range of the events to copy.

endTimeStamp

The ending time stamp for the range of the events to copy.

destTimeStamp

The time stamp at which to the copied events will be inserted into the receiver.

Return Value

Whether or not copying the MIDI events was succesful.

Declared In

MIKMIDITrack.h

cutEventsFromStartingTimeStamp:toEndingTimeStamp:

- (BOOL)cutEventsFromStartingTimeStamp:(MusicTimeStamp)startTimeStamp toEndingTimeStamp:(MusicTimeStamp)endTimeStamp
Discussion

Removes all of the MIDI events between startTimeStamp and endTimeStamp inclusively. Events that fall past the specified range will be moved back by the specified range time.

Parameters

startTimeStamp

The starting time stamp for the range of the events to cut.

endTimeStamp

The ending time stamp for the range of the events to cut.

Return Value

Whether or not cutting the MIDI events was succesful.

Declared In

MIKMIDITrack.h

eventsFromTimeStamp:toTimeStamp:

- (NSArray *)eventsFromTimeStamp:(MusicTimeStamp)startTimeStamp toTimeStamp:(MusicTimeStamp)endTimeStamp
Discussion

Gets all of the MIDI events in the track starting from startTimeStamp and ending at endTimeStamp inclusively.

Parameters

startTimeStamp

The starting time stamp for the range to get MIDI events for.

endTimeStamp

The ending time stamp for the range to get MIDI events for. Use kMusicTimeStamp_EndOfTrack to get events up to the end of the track.

Return Value

An array of MIKMIDIEvent.

Declared In

MIKMIDITrack.h

eventsOfClass:fromTimeStamp:toTimeStamp:

- (NSArray *)eventsOfClass:(Class)eventClass fromTimeStamp:(MusicTimeStamp)startTimeStamp toTimeStamp:(MusicTimeStamp)endTimeStamp
Discussion

Gets all of the MIDI events of a specific class in the track starting from startTimeStamp and ending at endTimeStamp inclusively.

Parameters

eventClass

The class of MIDI events you would like to retrieve. This class must be the MIKMIDIEvent class or a subclass thereof.

startTimeStamp

The staring time stamp for the range to get MIDI events for.

endTimeStamp

The ending time stamp for the range to get MIDI events for. Use kMusicTimeStamp_EndOfTrack to get events up to the end of the track.

Return Value

An array of specified class of MIDI events.

Declared In

MIKMIDITrack.h

getTrackNumber:

- (BOOL)getTrackNumber:(UInt32 *)trackNumber
Discussion

Gets the track’s track number in it’s owning MIDI sequence.

Parameters

trackNumber

On output, the track number of the track.

Return Value

Whether or not getting the track number was succesful.

Declared In

MIKMIDITrack.h

insertMIDIEvent:

- (BOOL)insertMIDIEvent:(MIKMIDIEvent *)event
Discussion

Inserts the specified MIDI event into the track.

Parameters

event

The MIDI event to insert into the track.

Return Value

Whether or not inserting the MIDI event was succesful.

Declared In

MIKMIDITrack.h

insertMIDIEvents:

- (BOOL)insertMIDIEvents:(NSSet *)events
Discussion

Inserts MIDI events into the track.

Parameters

events

An NSSet of MIKMIDIEvent to insert into the track.

Return Value

Whether or not inserting the MIDI events was succesful.

Declared In

MIKMIDITrack.h

mergeEventsFromMIDITrack:fromTimeStamp:toTimeStamp:atTimeStamp:

- (BOOL)mergeEventsFromMIDITrack:(MIKMIDITrack *)origTrack fromTimeStamp:(MusicTimeStamp)startTimeStamp toTimeStamp:(MusicTimeStamp)endTimeStamp atTimeStamp:(MusicTimeStamp)destTimeStamp
Discussion

Copies MIDI events from one track and merges them into the receiver.

Parameters

origTrack

The track to copy the events from.

startTimeStamp

The starting time stamp for the range of the events to copy.

endTimeStamp

The ending time stamp for the range of the events to copy.

destTimeStamp

The time stamp at which to the copied events will be merged into the receiver.

Return Value

Whether or not merging the MIDI events was succesful.

Declared In

MIKMIDITrack.h

moveEventsFromStartingTimeStamp:toEndingTimeStamp:byAmount:

- (BOOL)moveEventsFromStartingTimeStamp:(MusicTimeStamp)startTimeStamp toEndingTimeStamp:(MusicTimeStamp)endTimeStamp byAmount:(MusicTimeStamp)offsetTimeStamp
Discussion

Moves all of the MIDI events between startTimeStamp and endTimeStamp inclusively by the specified offset.

Parameters

startTimeStamp

The starting time stamp for the range of the events to move.

endTimeStamp

The ending time stamp for the range of the events to move.

offsetTimeStamp

The amount to move the events

Return Value

Whether or not moving the events was succesful.

Declared In

MIKMIDITrack.h

notesFromTimeStamp:toTimeStamp:

- (NSArray *)notesFromTimeStamp:(MusicTimeStamp)startTimeStamp toTimeStamp:(MusicTimeStamp)endTimeStamp
Discussion

Gets all of the MIDI notes in the track starting from startTimeStamp and ending at endTimeStamp inclusively.

Calling this method is equivalent to calling eventsOfClass:fromTimeStamp:toTimeStamp: with [MIKMIDINoteEvent class].

Parameters

startTimeStamp

The starting time stamp for the range to get MIDI events for.

endTimeStamp

The ending time stamp for the range to get MIDI notes for. Use kMusicTimeStamp_EndOfTrack to get events up to the end of the track.

Return Value

An array of MIKMIDINoteEvent.

Declared In

MIKMIDITrack.h

removeMIDIEvent:

- (BOOL)removeMIDIEvent:(MIKMIDIEvent *)event
Discussion

Removes the specified MIDI event from the track.

Parameters

event

The MIDI event to remove from the track.

Return Value

Whether or not removing the MIDI event from the track was succesful.

Declared In

MIKMIDITrack.h

removeMIDIEvents:

- (BOOL)removeMIDIEvents:(NSSet *)events
Discussion

Removes MIDI events from a track.

Parameters

events

An NSSet of MIKMIDIEvent to remove from the track.

Return Value

Whether or not removing the MIDI events was succesful.

Declared In

MIKMIDITrack.h

restoreLengthAndLoopInfo

- (void)restoreLengthAndLoopInfo
Discussion

Restores the length and loopInfo of the track to what it was before calling setTemporaryLength:andLoopInfo:.

Note: You should not call this method. It is exclusively used by MIKMIDISequence when the sequence is being looped by a MIKMIDIPlayer.

Declared In

MIKMIDITrack.h

setTemporaryLength:andLoopInfo:

- (void)setTemporaryLength:(MusicTimeStamp)length andLoopInfo:(MusicTrackLoopInfo)loopInfo
Discussion

Sets a temporary length and loopInfo for the track.

Note: You should not call this method. It is exclusivley used by MIKMIDISequence when the sequence is being looped by a MIKMIDIPlayer.

Parameters

length

The temporary length for the track.

loopInfo

The temporary loopInfo for the track.

Declared In

MIKMIDITrack.h