|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
Base class for all objects in the arranger. More...
#include <src/gui/dsp/arranger_object.h>


Public Types | |
| 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 | |
| auto | get_type () const |
| virtual utils::Utf8String | gen_human_friendly_name () const |
| Generates a human readable name for the object. | |
| 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 |
| virtual bool | validate (bool is_project, dsp::FramesPerTick frames_per_tick) const =0 |
| Validates the arranger object. | |
| virtual ArrangerObjectPtrVariant | add_clone_to_project (bool fire_events) const =0 |
| 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). | |
| virtual ArrangerObjectPtrVariant | insert_clone_to_project () const =0 |
| Inserts the object where it belongs in the project (eg, a Track). | |
| 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) |
Data Fields | |
| Flags | flags_ {} |
| Track this object belongs to (cache to be set during graph calculation). | |
Static Public Attributes | |
| static constexpr double | DEFAULT_NUDGE_TICKS = 0.1 |
Protected Member Functions | |
| 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 Attributes | |
| 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. | |
Friends | |
| bool | operator== (const ArrangerObject &lhs, const ArrangerObject &rhs) |
| void | to_json (nlohmann::json &j, const ArrangerObject &arranger_object) |
| void | from_json (const nlohmann::json &j, ArrangerObject &arranger_object) |
Base class for all objects in the arranger.
The ArrangerObject class is the base class for all objects that can be placed in the arranger, such as regions, MIDI notes, chord objects, etc. It provides common functionality and properties shared by all these objects.
Definition at line 74 of file arranger_object.h.
Definition at line 146 of file arranger_object.h.
Definition at line 141 of file arranger_object.h.
| using ArrangerObject::SelectionStatusGetter = std::function<bool (const Uuid &)> |
Definition at line 79 of file arranger_object.h.
|
strong |
| Enumerator | |
|---|---|
| NonProject | This object is not a project object, but an object used temporarily eg. when undoing/ redoing. |
Definition at line 120 of file arranger_object.h.
|
strong |
Definition at line 130 of file arranger_object.h.
|
strong |
Flag used in some functions.
| Enumerator | |
|---|---|
| StretchTempoChange | Used when we want to resize to contents when BPM changes.
|
Definition at line 86 of file arranger_object.h.
|
strong |
The type of the object.
Definition at line 104 of file arranger_object.h.
|
pure virtual |
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. |
Implemented in AutomationPoint, ChordObject, Marker, MidiNote, RegionImpl< RegionT >, RegionImpl< AudioRegion >, RegionImpl< AutomationRegion >, RegionImpl< ChordRegion >, RegionImpl< ChordRegion >, RegionImpl< MidiRegion >, and ScaleObject.
|
inlinevirtual |
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 in ChordObject, MidiNote, NamedObject, and ScaleObject.
Definition at line 156 of file arranger_object.h.
|
inline |
Getter.
Definition at line 211 of file arranger_object.h.
|
inline |
Returns the Track this ArrangerObject is in.
Definition at line 284 of file arranger_object.h.
|
inline |
Definition at line 290 of file arranger_object.h.
|
inline |
Definition at line 148 of file arranger_object.h.
|
pure virtual |
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. |
Implemented in AutomationPoint, ChordObject, Marker, MidiNote, RegionImpl< RegionT >, RegionImpl< AudioRegion >, RegionImpl< AutomationRegion >, RegionImpl< ChordRegion >, RegionImpl< ChordRegion >, RegionImpl< MidiRegion >, and ScaleObject.
|
inlinevirtual |
Returns whether the given object is deletable or not (eg, start marker).
Reimplemented in Marker.
Definition at line 347 of file arranger_object.h.
| bool ArrangerObject::is_position_valid | ( | const dsp::Position & | pos, |
| PositionType | pos_type, | ||
| dsp::TicksPerFrame | ticks_per_frame ) const |
Returns if the given Position is valid.
| pos | The position to set to. |
| pos_type | The type of Position to set in the ArrangerObject. |
|
inline |
Returns whether the given object is hit by the given range.
| start | Start position. |
| end | End position. |
| range_start_inclusive | Whether pos_ == start is allowed. Can't imagine a case where this would be false, but kept an option just in case. |
| range_end_inclusive | Whether pos_ == end is allowed. |
Definition at line 172 of file arranger_object.h.
|
inline |
Definition at line 185 of file arranger_object.h.
| void ArrangerObject::position_setter_validated | ( | const dsp::Position & | pos, |
| dsp::TicksPerFrame | ticks_per_frame ) |
The setter is for use in e.g.
the digital meters whereas the set_pos func is used during arranger actions.
| std::optional< ArrangerObjectPtrVariant > ArrangerObject::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 ArrangerObject::set_parent_on_base_qproperties | ( | QObject & | derived | ) |
Set the parent on QObject's that are children of this class.
This is needed because we can only inherit from QObject on final classes, and this is not a final class, so final classes deriving from this are expected to call this method to establish the parent-child relationship.
| derived | The derived class instance. |
| bool ArrangerObject::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.
| pos | The position to set to. |
| pos_type | The type of Position to set in the ArrangerObject. |
| validate | Validate the Position before setting it. |
|
inline |
Definition at line 223 of file arranger_object.h.
|
inline |
Definition at line 338 of file arranger_object.h.
|
inline |
Definition at line 261 of file arranger_object.h.
|
inline |
Definition at line 262 of file arranger_object.h.
|
inline |
Definition at line 342 of file arranger_object.h.
|
inline |
Definition at line 266 of file arranger_object.h.
| void ArrangerObject::update_positions | ( | bool | from_ticks, |
| bool | bpm_change, | ||
| dsp::FramesPerTick | frames_per_tick ) |
Updates the positions in each child recursively.
| from_ticks | Whether to update the positions based on ticks (true) or frames (false). |
| frames_per_tick | This will be used when doing position conversions via dependency injection instead of relying on the current project's transport. |
|
pure virtual |
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.
Implemented in AudioRegion, AutomationPoint, AutomationRegion, ChordObject, ChordRegion, Marker, MidiNote, MidiRegion, and ScaleObject.
|
friend |
Definition at line 379 of file arranger_object.h.
|
friend |
Definition at line 349 of file arranger_object.h.
|
friend |
Definition at line 370 of file arranger_object.h.
|
staticconstexpr |
Definition at line 81 of file arranger_object.h.
| Flags ArrangerObject::flags_ {} |
Track this object belongs to (cache to be set during graph calculation).
Whether deleted with delete tool.
This is used to simply hide these objects until the action finishes so that they can be cloned for the actions. Flags.
Definition at line 419 of file arranger_object.h.
|
protected |
Position (or start Position if the object has length).
Definition at line 393 of file arranger_object.h.
|
protected |
Whether part of an auditioner track.
Definition at line 426 of file arranger_object.h.
|
protected |
ID of the track this object belongs to.
If this is null, then this object is not part of a track.
Definition at line 404 of file arranger_object.h.
|
protected |
Definition at line 388 of file arranger_object.h.