pub unsafe extern "C-unwind" fn MusicSequenceFileCreate(
in_sequence: MusicSequence,
in_file_ref: &CFURL,
in_file_type: MusicSequenceFileTypeID,
in_flags: MusicSequenceFileFlags,
in_resolution: i16,
) -> i32MusicPlayer and objc2-core-foundation only.Expand description
Create a file from a sequence
This function can be (and is most commonly) used to create a MIDI file from the events in a sequence. Only MIDI based events are used when creating the MIDI file. MIDI files are normally beat based, but can also have a SMPTE (or real-time rather than beat time) representation.
inResolution is relationship between “tick” and quarter note for saving to Standard MIDI File
- pass in zero to use default - this will be the value that is currently set on the tempo track
- see the comments for the set track property’s time resolution
The different Sequence types determine the kinds of files that can be created:
Beats When saving a MIDI file, it saves a beats (PPQ) based axis
Seconds When saving a MIDI file, it will save it as a SMPTE resolution - so you should specify this resolution when creating the MIDI file. If zero is specified, 25 fps and 40 ticks/frame is used (a time scale of a millisecond)
Samples You cannot save to a MIDI file with this sequence type
The complete meaning of the 16-bit “division” field in a MIDI File’s MThd chunk.
If it is positive, then a tick represents 1/D quarter notes.
If it negative:
bits 14-8 are a signed 7-bit number representing the SMPTE format: -24, -25, -29 (drop), -30 bits 7-0 represents the number of ticks per SMPTE frame typical values: 4, 10, 80, 100
You can obtain millisecond resolution by specifying 25 frames/sec and 40 divisions/frame.
30 fps with 80 bits (ticks) per frame: 0xE250 ((char)0xE2 == -30)
Parameter inSequence: the sequence
Parameter inFileRef: the location of the file to create
Parameter inFileType: the type of file to create
Parameter inFlags: flags to control the file creation
Parameter inResolution: the resolution (depending on file type and sequence type)
§Safety
in_sequence must be a valid pointer.