Inherits from NSObject
Declared in MIKMIDISequence.h

Overview

Instances of MIKMIDISequence contain a collection of MIDI tracks. MIKMIDISequences may be thought of as MIDI “songs”. They can be loaded from and saved to MIDI files. They can also be played using an MIKMIDIPlayer.

Tasks

Properties

callBackBlock

@property (copy, nonatomic) void ( ^ ) ( MIKMIDITrack *track , MusicTimeStamp eventTime , const MusicEventUserData *eventData , MusicTimeStamp startSliceBeat , MusicTimeStamp endSliceBeat ) callBackBlock
Discussion

A block to be called for each user event added to any music track owned by the sequence.

This block is to be used in the same fashion as you would use the callback function sent to MusicSequenceSetUserCallback() if you were working directly with CoreMIDI.

Declared In

MIKMIDISequence.h

dataValue

@property (nonatomic, readonly) NSData *dataValue
Discussion

The MIDI data that composes the sequence. This data is equivalent to an NSData representation of a standard MIDI file.

Declared In

MIKMIDISequence.h

durationInSeconds

@property (nonatomic, readonly) Float64 durationInSeconds
Discussion

The duration of the sequence in seconds.

Declared In

MIKMIDISequence.h

length

@property (nonatomic) MusicTimeStamp length
Discussion

The length of the sequence as a MusicTimeStamp.

Set to MIKMIDISequenceLongestTrackLength to make the length equal to the length of the longest track.

Declared In

MIKMIDISequence.h

musicSequence

@property (nonatomic, readonly) MusicSequence musicSequence
Discussion

The underlaying MusicSequence that backs the instance of MIKMIDISequence.

Declared In

MIKMIDISequence.h

tempoTrack

@property (nonatomic, readonly) MIKMIDITrack *tempoTrack
Discussion

The tempo track for the sequence.

Declared In

MIKMIDISequence.h

tracks

@property (nonatomic, readonly) NSArray *tracks
Discussion

The MIDI tracks for the sequence. An array of MIKMIDITrack instances.

Declared In

MIKMIDISequence.h

Class Methods

sequence

+ (instancetype)sequence
Discussion

Creates and initializes a new instance of MIKMIDISequence.

Return Value

A new instance of MIKMIDISequence, or nil if an error occured.

Declared In

MIKMIDISequence.h

sequenceWithData:

+ (instancetype)sequenceWithData:(NSData *)data
Discussion

This method is deprecated. Use sequenceWithData:error: instead.

Creates and initializes a new instance of MIKMIDISequence from MIDI data.

Parameters

data

The MIDI data for the new sequence.

Return Value

A new instance of MIKMIDISequence containing the MIDI data, or nil if an error occured.

Declared In

MIKMIDISequence.h

sequenceWithData:error:

+ (instancetype)sequenceWithData:(NSData *)data error:(NSError **)error
Discussion

Creates and initializes a new instance of MIKMIDISequence from MIDI data.

Parameters

data

An NSData instance containing the data for the MIDI sequence/file.

error

If an

Return Value

If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.

Declared In

MIKMIDISequence.h

sequenceWithFileAtURL:error:

+ (instancetype)sequenceWithFileAtURL:(NSURL *)fileURL error:(NSError **)error
Discussion

Creates and initilazes a new instance of MIKMIDISequence from a MIDI file.

Parameters

fileURL

The URL of the MIDI file.

error

If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.

Return Value

A new instance of MIKMIDISequence containing the loaded file’s MIDI sequence, or nil if an error occured.

Declared In

MIKMIDISequence.h

Instance Methods

addTrack

- (MIKMIDITrack *)addTrack
Discussion

Creates and adds a new MIDI track to the sequence.

Declared In

MIKMIDISequence.h

equivalentTimeStampForLoopedTimeStamp:

- (MusicTimeStamp)equivalentTimeStampForLoopedTimeStamp:(MusicTimeStamp)loopedTimeStamp
Discussion

A MusicTimeStamp that is less than the sequence’s length, but is at an equivalent position in the looped sequence as loopedTimeStamp

When the music sequence is being looped by an MIKMIDIPlayer, the time stamp of the player continuosly increases. This method can be used to find where in the MIDI sequence the looped playback is at. For example, in a sequence with a length of 16, calling this method with a loopedTimeStamp of 17 would return 1.

Parameters

loopedTimeStamp

The time stamp that you would like an equivalent time stamp for.

Return Value

The MusicTimeStamp of the sequence that is in an equivalent position in the sequence as loopedTimeStamp.

Declared In

MIKMIDISequence.h

getTempo:atTimeStamp:

- (BOOL)getTempo:(Float64 *)bpm atTimeStamp:(MusicTimeStamp)timeStamp
Discussion

Gets the bpm of the last tempo event before the specified time stamp.

Parameters

bpm

On output, the beats per minute of the tempo at the specified time stamp.

timeStamp

The time stamp that you would like to know the sequence’s tempo at.

Return Value

Whether or not getting the tempo was succesful.

Declared In

MIKMIDISequence.h

getTimeSignature:atTimeStamp:

- (BOOL)getTimeSignature:(MIKMIDITimeSignature *)signature atTimeStamp:(MusicTimeStamp)timeStamp

initWithData:

- (instancetype)initWithData:(NSData *)data
Discussion

This method is deprecated. Use initWithData:error: instead.

Initializes a new instance of MIKMIDISequence from MIDI data.

Parameters

data

The MIDI data for the new sequence.

Return Value

A new instance of MIKMIDISequence containing the MIDI data, or nil if an error occured.

Declared In

MIKMIDISequence.h

initWithData:error:

- (instancetype)initWithData:(NSData *)data error:(NSError **)error
Discussion

Initializes a new instance of MIKMIDISequence from MIDI data.

Parameters

data

An NSData instance containing the data for the MIDI sequence/file.

error

If an

Return Value

If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.

Declared In

MIKMIDISequence.h

initWithFileAtURL:error:

- (instancetype)initWithFileAtURL:(NSURL *)fileURL error:(NSError **)error
Discussion

Initilazes a new instance of MIKMIDISequence from a MIDI file.

Parameters

fileURL

The URL of the MIDI file.

error

If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.

Return Value

A new instance of MIKMIDISequence containing the loaded file’s MIDI sequence, or nil if an error occured.

Declared In

MIKMIDISequence.h

removeTrack:

- (BOOL)removeTrack:(MIKMIDITrack *)track
Discussion

Removes the specified MIDI track from the sequence.

Parameters

track

The track to remove.

Return Value

Whether or not removing the track was successful.

Declared In

MIKMIDISequence.h

setDestinationEndpoint:

- (void)setDestinationEndpoint:(MIKMIDIDestinationEndpoint *)destinationEndpoint
Discussion

Sets the destination endpoint for each track in the sequence.

Parameters

destinationEndpoint

The destination endpoint to set for each track in the sequence.

Declared In

MIKMIDISequence.h

setOverallTempo:

- (BOOL)setOverallTempo:(Float64)bpm
Discussion

Removes any existing tempo events and inserts a tempo event with the desired bpm at the beginning of the tempo track.

Parameters

bpm

The number of beats per minute for the new tempo.

Return Value

Whether or not setting the tempo of the sequence was successful.

Declared In

MIKMIDISequence.h

setOverallTimeSignature:

- (BOOL)setOverallTimeSignature:(MIKMIDITimeSignature)signature

setTempo:atTimeStamp:

- (BOOL)setTempo:(Float64)bpm atTimeStamp:(MusicTimeStamp)timeStamp
Discussion

Inserts a tempo event with the desired bpm into the tempo track at the specified time stamp.

Parameters

bpm

The number of beats per minute for the tempo.

timeStamp

The time stamp at which to set the tempo.

Return Value

Whether or not setting the tempo of the sequence was succesful.

Declared In

MIKMIDISequence.h

setTimeSignature:atTimeStamp:

- (BOOL)setTimeSignature:(MIKMIDITimeSignature)signature atTimeStamp:(MusicTimeStamp)timeStamp

tempoEvents

- (NSArray *)tempoEvents
Discussion

Returns an array of MIKMIDITempoEvent from the tempo track.

This is a convenience method, and is equivalent to calling -eventsOfClass:fromTimeStamp:toTimeStamp: on the tempo track with the parameters [MIKMIDITempoEvent class], 0, and kMusicTimeStamp_EndOfTrack respectively.

Return Value

An array of MIKMIDITempoEvent.

Declared In

MIKMIDISequence.h

timeSignatureEvents

- (NSArray *)timeSignatureEvents
Discussion

Returns an array of MIKMIDIEvent from the tempo track.

This is a convenience method, and is equivalent to calling -eventsOfClass:fromTimeStamp:toTimeStamp: on the tempo track with the parameters [MIKMIDIMetaTimeSignatureEvent class], 0, and kMusicTimeStamp_EndOfTrack respectively.

Return Value

Declared In

MIKMIDISequence.h

writeToURL:error:

- (BOOL)writeToURL:(NSURL *)fileURL error:(NSError **)error
Discussion

Writes the MIDI sequence in Standard MIDI File format to a file at the specified URL.

Parameters

fileURL

The URL to write the MIDI file to.

error

If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.

Return Value

Whether or not the file write was successful.

Declared In

MIKMIDISequence.h