|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
A MIDI note inside a Region shown in the piano roll. More...
#include <src/gui/dsp/midi_note.h>


Public Types | |
| enum class | Notation { Musical , Pitch } |
| using | RegionT = MidiRegion |
Public Types inherited from ArrangerObject | |
| enum class | ResizeType { Normal , Loop , Fade , Stretch , StretchTempoChange } |
| Flag used in some functions. More... | |
| enum class | Type { MidiRegion , AudioRegion , ChordRegion , AutomationRegion , MidiNote , ChordObject , ScaleObject , Marker , AutomationPoint } |
| The type of the object. More... | |
| enum class | Flags { NonProject = 1 << 0 } |
| Flags. More... | |
| enum class | PositionType { Start , End , ClipStart , LoopStart , LoopEnd , FadeIn , FadeOut } |
| using | SelectionStatusGetter = std::function<bool (const Uuid &)> |
| using | Position = zrythm::dsp::Position |
| using | ArrangerObjectPtr = ArrangerObject * |
Public Member Functions | |
| int | getPitch () const |
| void | setPitch (int ipitch) |
| Q_SIGNAL void | pitchChanged () |
| void | set_cache_val (const uint8_t val) |
| utils::Utf8String | get_val_as_string (Notation notation, bool use_markup) const |
| Gets the MIDI note's value as a string (eg "C#4"). | |
| void | listen (bool listen) |
| Listen to the given MidiNote. | |
| void | shift_pitch (int delta) |
| Shifts MidiNote's position and/or value. | |
| void | set_velocity (int vel) |
| void | set_pitch (uint8_t val) |
| Sends a note off if currently playing and sets the pitch of the MidiNote. | |
| ArrangerObjectPtrVariant | add_clone_to_project (bool fire_events) const override |
| Appends the ArrangerObject to where it belongs in the project (eg, a Track), without taking into account its previous index (eg, before deletion if undoing). | |
| ArrangerObjectPtrVariant | insert_clone_to_project () const override |
| Inserts the object where it belongs in the project (eg, a Track). | |
| utils::Utf8String | gen_human_friendly_name () const override |
| Generates a human readable name for the object. | |
| bool | validate (bool is_project, dsp::FramesPerTick frames_per_tick) const override |
| Validates the arranger object. | |
| void | init_after_cloning (const MidiNote &other, ObjectCloneType clone_type) override |
| Initializes the cloned object. | |
Public Member Functions inherited from MuteableObject | |
| virtual bool | get_muted (bool check_parent) const |
| Gets the mute status of the object. | |
| void | set_muted (bool muted, bool fire_events) |
| Sets the mute status of the object. | |
Public Member Functions inherited from ArrangerObject | |
| auto | get_type () const |
| bool | is_start_hit_by_range (const dsp::Position &start, const dsp::Position &end, bool range_start_inclusive=true, bool range_end_inclusive=false) const |
| Returns whether the given object is hit by the given range. | |
| bool | is_start_hit_by_range (const signed_frame_t global_frames_start, const signed_frame_t global_frames_end, bool range_start_inclusive=true, bool range_end_inclusive=false) const |
| void | set_parent_on_base_qproperties (QObject &derived) |
| Set the parent on QObject's that are children of this class. | |
| auto | get_position () const |
| Getter. | |
| void | position_setter_validated (const dsp::Position &pos, dsp::TicksPerFrame ticks_per_frame) |
| The setter is for use in e.g. | |
| void | set_position_unvalidated (const dsp::Position &pos) |
| bool | is_position_valid (const dsp::Position &pos, PositionType pos_type, dsp::TicksPerFrame ticks_per_frame) const |
| Returns if the given Position is valid. | |
| bool | set_position (const dsp::Position &pos, PositionType pos_type, bool validate, dsp::TicksPerFrame ticks_per_frame) |
| Sets the given position on the object, optionally attempting to validate before. | |
| void | move (double ticks, dsp::FramesPerTick frames_per_tick) |
| Moves the object by the given amount of ticks. | |
| void | set_track_id (const TrackUuid &track_id) |
| void | set_track_id (std::optional< TrackUuid > track_id) |
| void | unset_track_id () |
| void | update_positions (bool from_ticks, bool bpm_change, dsp::FramesPerTick frames_per_tick) |
| Updates the positions in each child recursively. | |
| auto | get_track () const |
| Returns the Track this ArrangerObject is in. | |
| std::optional< TrackUuid > | get_track_id () const |
| std::optional< ArrangerObjectPtrVariant > | remove_from_project (bool free_obj, bool fire_events=false) |
| Removes the object (which can be obtained from find_in_project()) from its parent in the project. | |
| void | set_selection_status_getter (SelectionStatusGetter getter) |
| void | unset_selection_status_getter () |
| virtual bool | is_deletable () const |
| Returns whether the given object is deletable or not (eg, start marker). | |
Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< ArrangerObject > | |
| UuidIdentifiableObject (const Uuid &id) | |
| UuidIdentifiableObject (const UuidIdentifiableObject &other)=default | |
| UuidIdentifiableObject (UuidIdentifiableObject &&other)=default | |
| UuidIdentifiableObject & | operator= (const UuidIdentifiableObject &other)=default |
| UuidIdentifiableObject & | operator= (UuidIdentifiableObject &&other)=default |
| auto | get_uuid () const |
| void | copy_members_from (const UuidIdentifiableObject &other) |
Public Member Functions inherited from RegionOwnedObject | |
| RegionOwnedObject (ArrangerObjectRegistry &obj_registry) noexcept | |
| void | set_region_and_index (const Region ®ion) |
| Sets the region the object belongs to and the related index inside it. | |
| template<typename SelfT> | |
| void | get_global_start_pos (this const SelfT &self, dsp::Position &pos, dsp::FramesPerTick frames_per_tick) |
| Gets the global (timeline-based) start Position of the object. | |
| template<typename SelfT> | |
| auto | get_region (this const SelfT &self) |
| If the object is part of a Region, returns it, otherwise returns NULL. | |
Public Member Functions inherited from BoundedObject | |
| auto | get_end_position () const |
| Getter. | |
| void | parent_base_qproperties (QObject &derived) |
| void | end_position_setter_validated (const dsp::Position &pos, dsp::TicksPerFrame ticks_per_frame) |
| The setter is for use in e.g. | |
| void | set_end_position_unvalidated (const dsp::Position &pos) |
| auto | get_length_in_ticks () const |
| Returns the length in ticks. | |
| auto | get_length_in_frames () const |
| Returns the length in frames. | |
| void | resize (bool left, ResizeType type, double ticks, bool during_ui_action) |
| Resizes the object on the left side or right side by given amount of ticks, for objects that do not have loops (currently none? | |
| template<typename SelfT> requires (FinalArrangerObjectSubclass<SelfT>) | |
| void | set_start_pos_full_size (this SelfT &self, const Position &pos, dsp::FramesPerTick frames_per_tick) |
| Sets the end position of the ArrangerObject and also sets the loop end and fade out (if object supports those) so that they are at the end. | |
| template<typename SelfT> requires (FinalArrangerObjectSubclass<SelfT>) | |
| void | set_end_pos_full_size (this SelfT &self, const dsp::Position &pos, dsp::FramesPerTick frames_per_tick) |
| Sets the end position of the ArrangerObject and also sets the loop end and fade out (if object supports those) to that position. | |
| bool | is_hit (const dsp::Position &pos, bool object_end_pos_inclusive=false) const |
| Returns whether the object is hit by the given position (local position if non-timeline object). | |
| bool | is_hit (const signed_frame_t frames, bool object_end_pos_inclusive=false) const |
| bool | is_hit_by_range (const dsp::Position &start, const dsp::Position &end, bool range_start_inclusive=true, bool range_end_inclusive=false, bool object_end_pos_inclusive=false) const |
| Returns whether the given object is hit by the given range. | |
| bool | is_hit_by_range (signed_frame_t global_frames_start, signed_frame_t global_frames_end, bool range_start_inclusive=true, bool range_end_inclusive=false, bool object_end_pos_inclusive=false) const |
| virtual bool | is_inside_range (const dsp::Position &start, const dsp::Position &end) const |
| Checks if any part of the object is hit by the given range. | |
Public Member Functions inherited from ICloneable< MidiNote > | |
| std::unique_ptr< MidiNote > | clone_unique (ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
| std::shared_ptr< MidiNote > | clone_shared (ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
| MidiNote * | clone_raw_ptr (ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
| MidiNote * | clone_qobject (QObject *parent, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
| QScopedPointer< MidiNote > | clone_unique_qobject (QObject *parent, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
Data Fields | |
| Velocity * | vel_ {} |
| Velocity. | |
| uint8_t | pitch_ {} |
| The note/pitch, (0-127). | |
| uint8_t | cache_pitch_ {} |
| Cached note, for live operations. | |
| bool | currently_listened_ {} |
| Whether or not this note is currently listened to. | |
| uint8_t | last_listened_pitch_ {} |
| The note/pitch that is currently playing, if currently_listened_ is true. | |
Data Fields inherited from MuteableObject | |
| bool | muted_ = false |
| Whether muted or not. | |
Data Fields inherited from ArrangerObject | |
| Flags | flags_ {} |
| Track this object belongs to (cache to be set during graph calculation). | |
Data Fields inherited from RegionOwnedObject | |
| ArrangerObjectRegistry & | object_registry_ |
| std::optional< ArrangerObject::Uuid > | region_id_ |
| Parent region identifier for objects that are part of a region. | |
Data Fields inherited from BoundedObject | |
| PositionProxy * | end_pos_ = nullptr |
| End Position, if the object has one. | |
Data Fields inherited from ICloneable< MidiNote > | |
| friend | Derived |
Properties | |
| QML_ELEMENT int | pitch |
Friends | |
| void | to_json (nlohmann::json &j, const MidiNote ¬e) |
| void | from_json (const nlohmann::json &j, MidiNote ¬e) |
Additional Inherited Members | |
Static Public Attributes inherited from ArrangerObject | |
| static constexpr double | DEFAULT_NUDGE_TICKS = 0.1 |
Protected Member Functions inherited from MuteableObject | |
| void | copy_members_from (const MuteableObject &other, ObjectCloneType clone_type) |
Protected Member Functions inherited from ArrangerObject | |
| ArrangerObject (Type type, TrackResolver track_resolver) noexcept | |
| void | copy_members_from (const ArrangerObject &other, ObjectCloneType clone_type) |
| bool | are_members_valid (bool is_project, dsp::FramesPerTick frames_per_tick) const |
| To be called by validate() implementations. | |
Protected Member Functions inherited from RegionOwnedObject | |
| void | copy_members_from (const RegionOwnedObject &other, ObjectCloneType clone_type) |
Protected Member Functions inherited from BoundedObject | |
| void | copy_members_from (const BoundedObject &other, ObjectCloneType clone_type) |
| bool | are_members_valid (bool is_project, dsp::FramesPerTick frames_per_tick) const |
Protected Attributes inherited from ArrangerObject | |
| TrackResolver | track_resolver_ |
| PositionProxy * | pos_ = nullptr |
| Position (or start Position if the object has length). | |
| std::optional< TrackUuid > | track_id_ |
| ID of the track this object belongs to. | |
| std::optional< SelectionStatusGetter > | selection_status_getter_ |
| Whether part of an auditioner track. | |
A MIDI note inside a Region shown in the piano roll.
Definition at line 25 of file midi_note.h.
| using MidiNote::RegionT = MidiRegion |
Definition at line 39 of file midi_note.h.
|
strong |
Definition at line 46 of file midi_note.h.
|
overridevirtual |
Appends the ArrangerObject to where it belongs in the project (eg, a Track), without taking into account its previous index (eg, before deletion if undoing).
| ZrythmError | on failure. |
Implements ArrangerObject.
|
overridevirtual |
Generates a human readable name for the object.
If the object has a name, this returns a copy of the name, otherwise generates something appropriate.
Reimplemented from ArrangerObject.
| utils::Utf8String MidiNote::get_val_as_string | ( | Notation | notation, |
| bool | use_markup ) const |
Gets the MIDI note's value as a string (eg "C#4").
| use_markup | Use markup to show the octave as a superscript. |
|
inline |
Definition at line 56 of file midi_note.h.
|
overridevirtual |
Initializes the cloned object.
| ZrythmException | If the object could not be cloned. |
Implements ICloneable< MidiNote >.
|
overridevirtual |
Inserts the object where it belongs in the project (eg, a Track).
This function assumes that the object already knows the index where it should be inserted in its parent.
This is mostly used when undoing.
| ZrythmException | on failure. |
Implements ArrangerObject.
| void MidiNote::listen | ( | bool | listen | ) |
Listen to the given MidiNote.
| listen | Turn note on if 1, or turn it off if 0. |
|
inline |
Definition at line 71 of file midi_note.h.
| void MidiNote::set_pitch | ( | uint8_t | val | ) |
|
inline |
Definition at line 96 of file midi_note.h.
|
inline |
Definition at line 58 of file midi_note.h.
| void MidiNote::shift_pitch | ( | int | delta | ) |
Shifts MidiNote's position and/or value.
| delta | Y (0-127) |
|
overridevirtual |
Validates the arranger object.
| frames_per_tick | Frames per tick used when validating audio regions. Passing 0 will use the value from the current engine. |
Must only be implemented by final objects.
Implements ArrangerObject.
|
friend |
Definition at line 132 of file midi_note.h.
|
friend |
Definition at line 123 of file midi_note.h.
| uint8_t MidiNote::cache_pitch_ {} |
Cached note, for live operations.
Definition at line 150 of file midi_note.h.
| bool MidiNote::currently_listened_ {} |
Whether or not this note is currently listened to.
Definition at line 153 of file midi_note.h.
| uint8_t MidiNote::last_listened_pitch_ {} |
The note/pitch that is currently playing, if currently_listened_ is true.
Definition at line 157 of file midi_note.h.
| uint8_t MidiNote::pitch_ {} |
The note/pitch, (0-127).
Definition at line 147 of file midi_note.h.
| Velocity* MidiNote::vel_ {} |
Definition at line 144 of file midi_note.h.
|
readwrite |
Definition at line 36 of file midi_note.h.