MIDI file handling.
More...
#include <src/gui/backend/io/midi_file.h>
|
| enum class | Format { MIDI0
, MIDI1
, MIDI2
} |
| using | TrackIndex = unsigned int |
|
|
| MidiFile (Format format) |
| | Construct a new Midi File object for writing.
|
| | MidiFile (const fs::path &path) |
| | Construct a new Midi File object for reading.
|
|
bool | track_has_midi_note_events (TrackIndex track_idx) const |
| | Returns whether the given track in the midi file has data.
|
|
int | get_num_tracks (bool non_empty_only) const |
| | Returns the number of tracks in the MIDI file.
|
|
Format | get_format () const |
| int | get_ppqn () const |
| | Get the PPQN (Parts Per Quarter Note) of the MIDI file.
|
| void | into_region (structure::arrangement::MidiRegion ®ion, int midi_track_idx) const |
| | Reads the contents of the MIDI file into a region.
|
|
| static void | export_midi_region_to_midi_file (const structure::arrangement::MidiRegion ®ion, const fs::path &full_path, int midi_version, bool export_full) |
| | Exports the Region to a specified MIDI file.
|
| static void | export_midi_lane_to_sequence (juce::MidiMessageSequence &message_sequence, const structure::tracks::Tracklist &tracklist, const structure::tracks::Track &track, const structure::tracks::TrackLane &lane, dsp::MidiEventVector *events, std::optional< double > start, std::optional< double > end, bool lanes_as_tracks, bool use_track_or_lane_pos) |
| | Writes the lane to the given MIDI sequence.
|
| static void | export_track_to_sequence (juce::MidiMessageSequence &message_sequence, const structure::tracks::Tracklist &tracklist, const structure::tracks::Track &track, dsp::MidiEventVector *events, std::optional< double > start, std::optional< double > end, int track_index, bool lanes_as_tracks, bool use_track_pos) |
| | Writes the track to the given MIDI file.
|
MIDI file handling.
Definition at line 33 of file midi_file.h.
◆ TrackIndex
| using MidiFile::TrackIndex = unsigned int |
◆ Format
| enum class MidiFile::Format |
|
strong |
◆ MidiFile()
| MidiFile::MidiFile |
( |
const fs::path & | path | ) |
|
Construct a new Midi File object for reading.
- Parameters
-
- Exceptions
-
◆ export_midi_lane_to_sequence()
| void MidiFile::export_midi_lane_to_sequence |
( |
juce::MidiMessageSequence & | message_sequence, |
|
|
const structure::tracks::Tracklist & | tracklist, |
|
|
const structure::tracks::Track & | track, |
|
|
const structure::tracks::TrackLane & | lane, |
|
|
dsp::MidiEventVector * | events, |
|
|
std::optional< double > | start, |
|
|
std::optional< double > | end, |
|
|
bool | lanes_as_tracks, |
|
|
bool | use_track_or_lane_pos ) |
|
static |
Writes the lane to the given MIDI sequence.
- Parameters
-
| lanes_as_tracks | Export lanes as separate MIDI tracks. |
| use_track_or_lane_pos | Whether to use the track position (or lane position if lanes_as_tracks is true) in the MIDI data. The MIDI track will be set to 1 if false. |
| events | Track events, if not using lanes as tracks. |
| start | Events before this position (global ticks) will be skipped. |
| end | Events after this position (global ticks) will be skipped. |
◆ export_midi_region_to_midi_file()
| void MidiFile::export_midi_region_to_midi_file |
( |
const structure::arrangement::MidiRegion & | region, |
|
|
const fs::path & | full_path, |
|
|
int | midi_version, |
|
|
bool | export_full ) |
|
static |
Exports the Region to a specified MIDI file.
FIXME: this needs refactoring. taken out of MidiRegion class.
- Parameters
-
| full_path | Absolute path to the MIDI file. |
| export_full | Traverse loops and export the MIDI file as it would be played inside Zrythm. If this is false, only the original region (from true start to true end) is exported. |
◆ export_track_to_sequence()
| void MidiFile::export_track_to_sequence |
( |
juce::MidiMessageSequence & | message_sequence, |
|
|
const structure::tracks::Tracklist & | tracklist, |
|
|
const structure::tracks::Track & | track, |
|
|
dsp::MidiEventVector * | events, |
|
|
std::optional< double > | start, |
|
|
std::optional< double > | end, |
|
|
int | track_index, |
|
|
bool | lanes_as_tracks, |
|
|
bool | use_track_pos ) |
|
inlinestatic |
Writes the track to the given MIDI file.
- Parameters
-
| use_track_pos | Whether to use the track position in the MIDI data. The track will be set to 1 if false. |
| events | Track events, if not using lanes as tracks or using track position. |
| lanes_as_tracks | Export lanes as separate tracks (only possible with MIDI type 1). This will calculate a unique MIDI track number for the region's lane. |
| use_track_or_lane_pos | Whether to use the track/lane position in the MIDI data. The MIDI track will be set to 1 if false. |
| start | Events before this position will be skipped. |
| end | Events after this position will be skipped. |
Definition at line 144 of file midi_file.h.
◆ get_ppqn()
| int MidiFile::get_ppqn |
( |
| ) |
const |
Get the PPQN (Parts Per Quarter Note) of the MIDI file.
- Returns
- int
- Exceptions
-
◆ into_region()
| void MidiFile::into_region |
( |
structure::arrangement::MidiRegion & | region, |
|
|
int | midi_track_idx ) const |
Reads the contents of the MIDI file into a region.
- Parameters
-
| region | A freshly created region to fill. |
| midi_track_idx | The index of this track, starting from 0. This will be sequential, ie, if idx 1 is requested and the MIDI file only has tracks 5 and 7, it will use track 7. |
- Exceptions
-
The documentation for this class was generated from the following file: