12#ifndef __GUI_BACKEND_PIANO_ROLL_H__
13#define __GUI_BACKEND_PIANO_ROLL_H__
19#include <cyaml/cyaml.h>
29#define PIANO_ROLL_SCHEMA_VERSION 1
31#define PIANO_ROLL (CLIP_EDITOR->piano_roll)
34 static const char * drum_labels[47] = { \
35 "Acoustic Bass Drum", \
89 MIDI_MODIFIER_VELOCITY,
90 MIDI_MODIFIER_PITCH_WHEEL,
91 MIDI_MODIFIER_MOD_WHEEL,
92 MIDI_MODIFIER_AFTERTOUCH,
106typedef enum PianoRollNoteNotation
108 PIANO_ROLL_NOTE_NOTATION_MUSICAL,
109 PIANO_ROLL_NOTE_NOTATION_PITCH,
110} PianoRollNoteNotation;
157midi_note_descriptor_new (
void);
179 int num_current_notes;
208static const cyaml_strval_t midi_modifier_strings[] = {
209 {
"Velocity", MIDI_MODIFIER_VELOCITY },
210 {
"Pitch Wheel", MIDI_MODIFIER_PITCH_WHEEL},
211 {
"Mod Wheel", MIDI_MODIFIER_MOD_WHEEL },
212 {
"Aftertouch", MIDI_MODIFIER_AFTERTOUCH },
215static const cyaml_schema_field_t piano_roll_fields_schema[] = {
216 YAML_FIELD_INT (
PianoRoll, schema_version),
217 YAML_FIELD_FLOAT (
PianoRoll, notes_zoom),
218 YAML_FIELD_ENUM (
PianoRoll, midi_modifier, midi_modifier_strings),
222 editor_settings_fields_schema),
227static const cyaml_schema_value_t piano_roll_schema = {
237#define piano_roll_is_next_key_black(x) piano_roll_is_key_black (x + 1)
239#define piano_roll_is_prev_key_black(x) piano_roll_is_key_black (x - 1)
268piano_roll_set_notes_zoom (
PianoRoll * self,
float notes_zoom,
int fire_events);
314piano_roll_get_visible_notes (
323 for (
int i = 0; i < 128; i++)
356piano_roll_new (
void);
MidiModifier
A MIDI modifier to use to display data for.
Track * piano_roll_get_current_track(const PianoRoll *self)
Returns the current track whose regions are being shown in the piano roll.
PianoRoll * piano_roll_clone(const PianoRoll *src)
Only clones what is needed for serialization.
int piano_roll_is_key_black(int note)
Returns if the key is black.
void piano_roll_set_midi_modifier(PianoRoll *self, MidiModifier modifier)
Sets the MIDI modifier.
void piano_roll_add_current_note(PianoRoll *self, int note)
Adds the note if it doesn't exist in the array.
int piano_roll_contains_current_note(PianoRoll *self, int note)
Returns 1 if it contains the given note, 0 otherwise.
const MidiNoteDescriptor * piano_roll_find_midi_note_descriptor_by_val(PianoRoll *self, bool drum_mode, const uint8_t val)
Returns the MidiNoteDescriptor matching the value (0-127).
PianoRollHighlighting
Highlighting for the piano roll.
void piano_roll_remove_current_note(PianoRoll *self, int note)
Removes the note if it exists in the array.
void piano_roll_init_loaded(PianoRoll *self)
Inits the PianoRoll after a Project has been loaded.
void piano_roll_init(PianoRoll *self)
Initializes the PianoRoll.
void piano_roll_set_highlighting(PianoRoll *self, PianoRollHighlighting highlighting)
Updates the highlighting and notifies the UI.
#define YAML_FIELD_MAPPING_EMBEDDED(owner, member, schema)
Mapping embedded inside the struct.
#define YAML_VALUE_PTR(cc, fields_schema)
Schema to be used as a pointer.
A descriptor for a MidiNote, used by the piano roll.
int index
The index to display the note at.
char * note_name
Name of the note, from C-2 to B8.
int visible
Whether the note is visible or not.
int marked
Whether the note is highlighted/marked or not.
char * custom_name
Custom name, from midnam or GM MIDI specs, etc.
char * note_name_pango
Note name with extra formatting.
int value
The actual value (0-127).
Piano roll serializable backend.
MidiNoteDescriptor * drum_descriptors[128]
Drum mode descriptors.
int current_notes[128]
Currently pressed notes (used only at runtime).
float notes_zoom
Notes zoom level.
PianoRollHighlighting highlighting
Highlighting notes depending on the current chord or scale.
MidiModifier midi_modifier
Selected MidiModifier.
MidiNoteDescriptor * piano_descriptors[128]
Piano roll mode descriptors.
Track to be inserted into the Project's Tracklist.
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.