Functions
The following functions are available globally.
-
Returns the number of MIDITimeStamps that would occur during a specified time interval.
Declaration
Objective-C
Float64 MIKMIDIClockMIDITimeStampsPerTimeInterval(NSTimeInterval timeInterval)
Swift
func MIKMIDIClockMIDITimeStampsPerTimeInterval(_ timeInterval: TimeInterval) -> Float64
Parameters
timeInterval
The number of seconds to convert into number of MIDITimeStamps.
Return Value
The number of MIDITimeStamps that would occur in the specified time interval.
-
Returns the number of seconds per each MIDITimeStamp.
Declaration
Objective-C
Float64 MIKMIDIClockSecondsPerMIDITimeStamp()
Swift
func MIKMIDIClockSecondsPerMIDITimeStamp() -> Float64
Return Value
Then number of seconds per each MIDITimeStamp.
-
Allocates and returns (by reference) a CoreMIDI MIDIPacketList created from an array of MIKMIDICommand instances. The created MIDIPacketList will be sized according to the number of commands and their contents. Ownership is transfered to the caller which becomes responsible for freeing the allocated memory. Used by MIKMIDI when sending commands. Typically, this is not needed by clients of MIKMIDI.
Declaration
Objective-C
BOOL MIKCreateMIDIPacketListFromCommands( MIDIPacketList *_Nonnull *_Nonnull outPacketList, NSArray<MIKMIDICommand *> *_Nonnull commands)
Swift
func MIKCreateMIDIPacketListFromCommands(_ outPacketList: UnsafeMutablePointer<UnsafeMutablePointer<MIDIPacketList>>, _ commands: [MIKMIDICommand]) -> Bool
Parameters
outPacketList
A pointer to a pointer to a MIDIPacketList structure which will point to the created MIDIPacketList upon success.
commands
An array of MIKMIDICommand instances.
Return Value
YES if creating the packet list was successful, NO if an error occurred.
-
This is currently undocumented. Documentation contributions are always welcome!
Declaration
Objective-C
NSString *MIKMIDIDefaultLocalizedErrorDescriptionForErrorCode(MIKMIDIErrorCode code)
Swift
func MIKMIDIDefaultLocalizedErrorDescriptionForErrorCode(_ code: MIKMIDIErrorCode) -> String
-
Convenience function to create a MIDITimeSignature struct.
For example, to create a time signature struct for 4/4 time: MIKMIDITimeSignatureMake(4, 4)
Declaration
Objective-C
static inline MIKMIDITimeSignature MIKMIDITimeSignatureMake(UInt8 numerator, UInt8 denominator)
Swift
func MIKMIDITimeSignatureMake(_ numerator: UInt8, _ denominator: UInt8) -> MIKMIDITimeSignature
Parameters
numerator
The numerator for the time signature, or number of beats per measure.
denominator
The denominator for the time signature, or fraction of a note per beat.
Return Value
An MIKMIDITimeSignature struct.
-
This is currently undocumented. Documentation contributions are always welcome!
Declaration
Objective-C
NSString * _Nullable MIKStringPropertyFromMIDIObject(MIDIObjectRef object, CFStringRef propertyID, NSError *__autoreleasing*error)
Swift
func MIKStringPropertyFromMIDIObject(_ object: MIDIObjectRef, _ propertyID: CFString, _ error: NSErrorPointer) -> String?
-
This is currently undocumented. Documentation contributions are always welcome!
Declaration
Objective-C
BOOL MIKSetStringPropertyOnMIDIObject(MIDIObjectRef object, CFStringRef propertyID, NSString *string, NSError *__autoreleasing*error)
Swift
func MIKSetStringPropertyOnMIDIObject(_ object: MIDIObjectRef, _ propertyID: CFString, _ string: String, _ error: NSErrorPointer) -> Bool
-
This is currently undocumented. Documentation contributions are always welcome!
Declaration
Objective-C
SInt32 MIKIntegerPropertyFromMIDIObject(MIDIObjectRef object, CFStringRef propertyID, NSError *__autoreleasing*error)
Swift
func MIKIntegerPropertyFromMIDIObject(_ object: MIDIObjectRef, _ propertyID: CFString, _ error: NSErrorPointer) -> Int32
-
This is currently undocumented. Documentation contributions are always welcome!
Declaration
Objective-C
BOOL MIKSetIntegerPropertyFromMIDIObject(MIDIObjectRef object, CFStringRef propertyID, SInt32 integerValue, NSError *__autoreleasing*error)
Swift
func MIKSetIntegerPropertyFromMIDIObject(_ object: MIDIObjectRef, _ propertyID: CFString, _ integerValue: Int32, _ error: NSErrorPointer) -> Bool
-
This is currently undocumented. Documentation contributions are always welcome!
Declaration
Objective-C
MIDIObjectType MIKMIDIObjectTypeOfObject(MIDIObjectRef object, NSError *__autoreleasing*error)
Swift
func MIKMIDIObjectTypeOfObject(_ object: MIDIObjectRef, _ error: NSErrorPointer) -> MIDIObjectType
-
This is currently undocumented. Documentation contributions are always welcome!
Declaration
Objective-C
NSString *MIKMIDIMappingAttributeStringForInteractionType(MIKMIDIResponderType type)
Swift
func MIKMIDIMappingAttributeStringForInteractionType(_ type: MIKMIDIResponderType) -> String
-
This is currently undocumented. Documentation contributions are always welcome!
Declaration
Objective-C
MIKMIDIResponderType MIKMIDIMappingInteractionTypeForAttributeString(NSString *string)
Swift
func MIKMIDIMappingInteractionTypeForAttributeString(_ string: String) -> MIKMIDIResponderType
-
This is currently undocumented. Documentation contributions are always welcome!
Declaration
Objective-C
NSInteger MIKMIDIStandardLengthOfMessageForCommandType(MIKMIDICommandType commandType)
Swift
func MIKMIDIStandardLengthOfMessageForCommandType(_ commandType: MIKMIDICommandType) -> Int
-
This is currently undocumented. Documentation contributions are always welcome!
Declaration
Objective-C
MIDIPacket MIKMIDIPacketCreate(MIDITimeStamp timeStamp, UInt16 length, MIKArrayOf(NSNumber *) *data /*max length 256*/)
Swift
func MIKMIDIPacketCreate(_ timeStamp: MIDITimeStamp, _ length: UInt16, _ data: [NSNumber]) -> MIDIPacket
-
Creates and returns a pointer to an MIDIPacket struct containing the given commands. This function dynamically allocates its result, and can create packets containing more than 256 bytes.
@note: You must free the resulting MIDIPacket pointer when you are done with it by calling MIKMIDIPacketFree().
Declaration
Objective-C
MIDIPacket *_Nonnull MIKMIDIPacketCreateFromCommands( MIDITimeStamp timeStamp, NSArray<MIKMIDICommand *> *_Nonnull commands)
Swift
func MIKMIDIPacketCreateFromCommands(_ timeStamp: MIDITimeStamp, _ commands: [MIKMIDICommand]) -> UnsafeMutablePointer<MIDIPacket>
Parameters
timeStamp
The timestamp for the commands in the resulting packet. Individual timestamps in the command objects themselves are ignored.
commands
An array of MIKMIDICommand objects to include in the result.
Return Value
A pointer to MIDIPacket struct.
-
Frees the memory allocated for the packet. This should only be called with packets that were dynamically allocated using MIKMIDIPacketCreateFromCommands().
Declaration
Objective-C
void MIKMIDIPacketFree(MIDIPacket *_Nonnull packet)
Swift
func MIKMIDIPacketFree(_ packet: UnsafeMutablePointer<MIDIPacket>)
Parameters
packet
A pointer to an MIDIPacket struct created with MIKMIDIPacketCreateFromCommands().
-
This is currently undocumented. Documentation contributions are always welcome!
Declaration
Objective-C
MIDITimeStamp MIKMIDIGetCurrentTimeStamp(void)
Swift
func MIKMIDIGetCurrentTimeStamp() -> MIDITimeStamp
-
Returns whether a given MIDI note number corresponds to a “black key” on a piano.
Declaration
Objective-C
BOOL MIKMIDINoteIsBlackKey(NSInteger noteNumber)
Swift
func MIKMIDINoteIsBlackKey(_ noteNumber: Int) -> Bool
Parameters
noteNumber
The MIDI note number for the note. Between 0 and 127.
Return Value
YES if the passed in note number is a flat / sharp note, NO otherwise.
-
Returns the note letter of the passed in MIDI note number as a string. Notes that correspond to a “black key” on the piano will always be presented as sharp.
See
MIKMIDINoteLetterAndOctaveForMIDINote()
Declaration
Objective-C
NSString *_Nonnull MIKMIDINoteLetterForMIDINoteNumber(UInt8 noteNumber)
Swift
func MIKMIDINoteLetterForMIDINoteNumber(_ noteNumber: UInt8) -> String
Parameters
noteNumber
The MIDI note number for the note. Between 0 and 127.
Return Value
A string containing the human readable MIDI note letter for the MIDI note. e.g. C for MIDI note number 60.
-
The note letter and octave of the passed in MIDI note. 0 is considered to be the first octave, so the note C0 is equal to MIDI note 0.
See
MIKMIDINoteLetterForMIDINoteNumber()
Declaration
Objective-C
NSString *_Nonnull MIKMIDINoteLetterAndOctaveForMIDINote(UInt8 noteNumber)
Swift
func MIKMIDINoteLetterAndOctaveForMIDINote(_ noteNumber: UInt8) -> String
Parameters
noteNumber
The MIDI note number you would like the note letter for. Between 0 and 127. e.g. C for MIDI note number 60.
Return Value
A string representing the note letter and octave of the MIDI note.