10#ifndef __AUDIO_MIDI_REGION_H__
11#define __AUDIO_MIDI_REGION_H__
26typedef void MIDI_FILE;
41 unsigned int track_name_hash,
57 const char * abs_path,
58 unsigned int track_name_hash,
73 unsigned int track_name_hash,
82#define midi_region_add_midi_note(region, midi_note, pub_events) \
83 midi_region_insert_midi_note ( \
84 region, midi_note, ((ZRegion *) (region))->num_midi_notes, pub_events)
149 bool note_off_at_end,
150 bool is_note_off_for_loop_or_region_end,
228 const
bool add_region_start,
243 const
char * full_path,
245 const
bool export_full);
281 const
bool add_region_start,
298 int * num_velocities,
299 size_t * velocities_size,
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
ZRegion * 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.
MidiNote * midi_region_get_lowest_midi_note(ZRegion *region)
Gets lowest midi note.
OPTIMIZE_O3 REALTIME void midi_region_fill_midi_events(ZRegion *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.
void midi_region_start_unended_note(ZRegion *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 ZRegion::midi_notes.
void midi_region_get_velocities_in_range(const ZRegion *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.
void midi_region_remove_midi_note(ZRegion *region, MidiNote *midi_note, int free, int pub_event)
Removes the MIDI note from the Region.
MidiNote * midi_region_get_last_midi_note(ZRegion *region)
Gets last midi note.
uint8_t midi_region_get_midi_ch(const ZRegion *self)
Returns the MIDI channel that this region should be played on, starting from 1.
MidiNote * midi_region_pop_unended_note(ZRegion *self, int pitch)
Returns the midi note with the given pitch from the unended notes.
NONNULL void midi_region_export_to_midi_file(const ZRegion *self, const char *full_path, int midi_version, const bool export_full)
Exports the ZRegion to a specified MIDI file.
void midi_region_free_members(ZRegion *self)
Frees members only but not the midi region itself.
void midi_region_insert_midi_note(ZRegion *region, MidiNote *midi_note, int idx, int pub_events)
Inserts the MidiNote to the given ZRegion.
MidiNote * midi_region_get_first_midi_note(ZRegion *region)
Gets first midi note.
void midi_region_print_midi_notes(ZRegion *self)
Prints the MidiNotes in the Region.
void midi_region_add_events(const ZRegion *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.
MidiNote * midi_region_get_highest_midi_note(ZRegion *region)
Gets highest midi note.
void midi_region_remove_all_midi_notes(ZRegion *region)
Removes all MIDI ntoes and their components completely.
void midi_region_write_to_midi_file(const ZRegion *self, MIDI_FILE *mf, const bool add_region_start, bool export_full)
Exports the ZRegion to an existing MIDI file instance.
bool midi_region_is_note_playable(const ZRegion *self, const MidiNote *midi_note)
Returns whether the given note is not muted and starts within any playable part of the region.
ZRegion * 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.
ZRegion * 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 ZRegion for MIDI notes.
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 ZRegion shown in the piano roll.
A Position is made up of bars.beats.sixteenths.ticks.
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).
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.