10#ifndef __AUDIO_MIDI_REGION_H__
11#define __AUDIO_MIDI_REGION_H__
25typedef void MIDI_FILE;
40 unsigned int track_name_hash,
56 const char * abs_path,
57 unsigned int track_name_hash,
72 unsigned int track_name_hash,
81#define midi_region_add_midi_note(region, midi_note, pub_events) \
82 midi_region_insert_midi_note ( \
83 region, midi_note, ((Region *) (region))->num_midi_notes, pub_events)
148 bool note_off_at_end,
149 bool is_note_off_for_loop_or_region_end,
227 const
bool add_region_start,
242 const
char * full_path,
244 const
bool export_full);
280 const
bool add_region_start,
297 int * num_velocities,
298 size_t * velocities_size,
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
void midi_region_write_to_midi_file(const Region *self, MIDI_FILE *mf, const bool add_region_start, bool export_full)
Exports the Region to an existing MIDI file instance.
MidiNote * midi_region_get_lowest_midi_note(Region *region)
Gets lowest midi note.
void midi_region_add_events(const Region *self, MidiEvents *events, const Position *start, const Position *end, const bool add_region_start, const bool full)
Adds the contents of the region converted into events.
void midi_region_free_members(Region *self)
Frees members only but not the midi region itself.
NONNULL void midi_region_export_to_midi_file(const Region *self, const char *full_path, int midi_version, const bool export_full)
Exports the Region to a specified MIDI file.
MidiNote * midi_region_get_last_midi_note(Region *region)
Gets last midi note.
MidiNote * midi_region_get_first_midi_note(Region *region)
Gets first midi note.
Region * midi_region_new_from_midi_file(const Position *start_pos, const char *abs_path, unsigned int track_name_hash, int lane_pos, int idx_inside_lane, int idx)
Creates a MIDI region from the given MIDI file path, starting at the given Position.
void midi_region_start_unended_note(Region *self, Position *start_pos, Position *end_pos, int pitch, int vel, int pub_events)
Starts an unended note with the given pitch and velocity and adds it to Region::midi_notes.
void midi_region_remove_all_midi_notes(Region *region)
Removes all MIDI ntoes and their components completely.
Region * midi_region_new(const Position *start_pos, const Position *end_pos, unsigned int track_name_hash, int lane_pos, int idx_inside_lane)
Creates a new Region for MIDI notes.
void midi_region_insert_midi_note(Region *region, MidiNote *midi_note, int idx, int pub_events)
Inserts the MidiNote to the given Region.
uint8_t midi_region_get_midi_ch(const Region *self)
Returns the MIDI channel that this region should be played on, starting from 1.
void midi_region_print_midi_notes(Region *self)
Prints the MidiNotes in the Region.
void midi_region_remove_midi_note(Region *region, MidiNote *midi_note, int free, int pub_event)
Removes the MIDI note from the Region.
MidiNote * midi_region_pop_unended_note(Region *self, int pitch)
Returns the midi note with the given pitch from the unended notes.
bool midi_region_is_note_playable(const Region *self, const MidiNote *midi_note)
Returns whether the given note is not muted and starts within any playable part of the region.
OPTIMIZE_O3 REALTIME void midi_region_fill_midi_events(Region *self, const EngineProcessTimeInfo *const time_nfo, bool note_off_at_end, bool is_note_off_for_loop_or_region_end, MidiEvents *midi_events)
Fills MIDI event queue from the region.
MidiNote * midi_region_get_highest_midi_note(Region *region)
Gets highest midi note.
Region * midi_region_new_from_chord_descr(const Position *pos, ChordDescriptor *descr, unsigned int track_name_hash, int lane_pos, int idx_inside_lane)
Create a region from the chord descriptor.
void midi_region_get_velocities_in_range(const Region *self, const Position *start_pos, const Position *end_pos, Velocity ***velocities, int *num_velocities, size_t *velocities_size, int inside)
Fills in the array with all the velocities in the project that are within or outside the range given.
Position end_pos
End Position, if the object has one.
Position pos
Position (or start Position if the object has length).
A ChordDescriptor describes a chord and is not linked to any specific object by itself.
Common struct to pass around during processing to avoid repeating the data in function arguments.
Container for passing midi events through ports.
A MIDI note inside a Region shown in the piano roll.
A Position is made up of bars.beats.sixteenths.ticks.
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.
Track to be inserted into the Project's Tracklist.
MidiNote * midi_note
Pointer back to the MIDI note.
uint8_t vel
Velocity value (0-127).