Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::structure::arrangement::MidiClip Class Referencefinal

A Clip containing MIDI events. More...

#include <src/structure/arrangement/midi_clip.h>

Inheritance diagram for zrythm::structure::arrangement::MidiClip:
Collaboration diagram for zrythm::structure::arrangement::MidiClip:

Public Member Functions

 MidiClip (const dsp::TempoMapWrapper &tempo_map_wrapper, utils::IObjectRegistry &object_registry, QObject *parent=nullptr)
units::bpm_t source_bpm () const
 Source tempo for Absolute-mode anchor (default 0 = no anchor).
void set_source_bpm (units::bpm_t bpm)
std::string get_field_name_for_serialization (const MidiNote *) const override
std::string get_field_name_for_serialization (const MidiControlEvent *) const override
std::vector< ArrangerObjectListModel * > get_child_list_models () const override
void shift_all_children (dsp::ContentTick delta) override
 Shifts all child objects by delta content ticks.
std::optional< dsp::ContentTick > first_child_position () const override
 Returns the position of the first child, if any.
Public Member Functions inherited from zrythm::structure::arrangement::Clip
dsp::TimelinePositionposition () const override
dsp::ContentTimeWarpcontentWarp () const
dsp::TimebaseProvider * timebaseProvider () const
Q_INVOKABLE void setLengthTicks (double ticks)
Q_INVOKABLE QList< double > loopPointTimelineTicks (double displayEndTicks) const
 Timeline delta-tick positions of each loop wrap point.
double timelineLengthTicks () const
 Warp-aware length of this clip in timeline ticks.
Q_SIGNAL void timelineLengthTicksChanged ()
units::sample_t get_end_position_samples (bool end_position_inclusive) const
 Returns the end position of this clip in timeline samples.
units::sample_t get_sample_duration () const
 Returns the duration of this clip in timeline samples (end minus start), warp-aware.
bool is_hit (const units::sample_t frames, bool object_end_pos_inclusive=false) const
 Returns whether the clip is hit by the given timeline position.
bool is_hit_by_range (std::pair< units::sample_t, units::sample_t > global_frames, bool range_start_inclusive=true, bool range_end_inclusive=true, bool object_end_pos_inclusive=false) const
 Whether the clip is hit by the given range.
dsp::ContentPositionclipStartPosition () const
dsp::ContentPositionloopStartPosition () const
dsp::ContentPositionloopEndPosition () const
bool trackBounds () const
void setTrackBounds (bool track)
Q_SIGNAL void trackBoundsChanged (bool track)
void set_loop_range (dsp::ContentTick clip_start, dsp::ContentTick loop_start, dsp::ContentTick loop_end)
 Set the three loop positions atomically, bypassing the per-position clamping constraints.
bool looped () const
Q_SIGNAL void loopedChanged ()
Q_SIGNAL void contentChanged ()
 Emitted when the clip's content changes.
Q_SIGNAL void loopablePropertiesChanged ()
 Emitted when any loop-related property changes.
int get_num_loops (bool count_incomplete) const
 Returns the number of loops, optionally including incomplete ones.
dsp::ContentTick get_loop_length_in_ticks () const
 Returns the length of the loop in ticks.
Public Member Functions inherited from zrythm::structure::arrangement::ArrangerObject
auto type () const
dsp::ContentPositionlength () const
ArrangerObjectNamename () const
ArrangerObjectColorcolor () const
ArrangerObjectMuteFunctionalitymute () const
Q_SIGNAL void propertiesChanged ()
 Emitted when any of the properties of the object changed.
ArrangerObjectparentObject () const
void setParentObject (ArrangerObject *object)
Q_SIGNAL void parentObjectChanged (QObject *parentObject)
const dsp::TempoMap & get_tempo_map () const
const dsp::TempoMapWrapperget_tempo_map_wrapper () const
Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< ArrangerObject >
 UuidIdentifiableObject (QObject *parent=nullptr)
auto get_uuid () const
Public Member Functions inherited from zrythm::utils::UuidIdentifiableBase
 UuidIdentifiableBase (QObject *parent=nullptr)
 UuidIdentifiableBase (const QUuid &id, QObject *parent=nullptr)
QUuid raw_uuid () const
Public Member Functions inherited from zrythm::structure::arrangement::ArrangerObjectOwner< MidiNote >
 ArrangerObjectOwner (utils::IObjectRegistry &registry, T &derived)
auto & get_children_vector () const
auto get_children_view () const
auto get_sorted_children_view () const
void add_ticks_to_children (dsp::ContentTick ticks)
bool contains_object (const ArrangerObject::Uuid &id) const
 O(1) lookup if an object with the given ID exists.
ArrangerObjectListModelget_model () const
ArrangerObjectUuidReference remove_object (const ArrangerObject::Uuid &id)
void insert_object (const ArrangerObjectUuidReference &obj_ref, int idx)
void add_object (const ArrangerObjectUuidReference &obj_ref)
void clear_objects ()
virtual std::string get_field_name_for_serialization (const ChildT *) const=0
 Get the children field name to be used during serialization/deserialization.
Public Member Functions inherited from zrythm::structure::arrangement::ArrangerObjectOwner< MidiControlEvent >
 ArrangerObjectOwner (utils::IObjectRegistry &registry, T &derived)
auto & get_children_vector () const
auto get_children_view () const
auto get_sorted_children_view () const
void add_ticks_to_children (dsp::ContentTick ticks)
bool contains_object (const ArrangerObject::Uuid &id) const
 O(1) lookup if an object with the given ID exists.
ArrangerObjectListModelget_model () const
ArrangerObjectUuidReference remove_object (const ArrangerObject::Uuid &id)
void insert_object (const ArrangerObjectUuidReference &obj_ref, int idx)
void add_object (const ArrangerObjectUuidReference &obj_ref)
void clear_objects ()
virtual std::string get_field_name_for_serialization (const ChildT *) const=0
 Get the children field name to be used during serialization/deserialization.

Friends

void init_from (MidiClip &obj, const MidiClip &other, utils::ObjectCloneType clone_type)
void to_json (nlohmann::json &j, const MidiClip &clip)
void from_json (const nlohmann::json &j, MidiClip &clip)

Additional Inherited Members

Public Types inherited from zrythm::structure::arrangement::ArrangerObject
enum class  Type : std::uint8_t {
  MidiClip , AudioClip , ChordClip , AutomationClip ,
  MidiControlEvent , MidiNote , ChordObject , ScaleObject ,
  Marker , AutomationPoint , AudioSourceObject , TempoObject ,
  TimeSignatureObject
}
 The type of the object. More...
Public Types inherited from zrythm::utils::UuidIdentifiableObject< ArrangerObject >
using uuid_base_type
 Exposes the CRTP parameter for concept checking.
Public Types inherited from zrythm::structure::arrangement::ArrangerObjectOwner< MidiNote >
using ArrangerObjectChildType
Public Types inherited from zrythm::structure::arrangement::ArrangerObjectOwner< MidiControlEvent >
using ArrangerObjectChildType
Protected Types inherited from zrythm::structure::arrangement::ArrangerObject
enum class  ArrangerObjectFeatures : std::uint8_t {
  Bounds = 1 << 0 , Name = 1 << 1 , Color = 1 << 2 , Mute = 1 << 3 ,
  ClipOwned = 1 << 4
}
Protected Member Functions inherited from zrythm::structure::arrangement::Clip
 Clip (Type type, const dsp::TempoMapWrapper &tempo_map_wrapper, QObject *parent=nullptr) noexcept
Protected Member Functions inherited from zrythm::structure::arrangement::ArrangerObject
 ArrangerObject (Type type, const dsp::TempoMapWrapper &tempo_map_wrapper, ArrangerObjectFeatures features, QObject *parent=nullptr) noexcept
 Construct a new ArrangerObject.
Protected Member Functions inherited from zrythm::utils::UuidIdentifiableBase
void set_raw_uuid (const QUuid &id)
Properties inherited from zrythm::structure::arrangement::Clip
zrythm::dsp::ContentTimeWarpcontentWarp
zrythm::dsp::timebase::TimebaseProvidertimebaseProvider
double timelineLengthTicks
zrythm::dsp::ContentPositionclipStartPosition
zrythm::dsp::ContentPositionloopStartPosition
zrythm::dsp::ContentPositionloopEndPosition
bool trackBounds
bool looped
Properties inherited from zrythm::structure::arrangement::ArrangerObject
QML_ELEMENT zrythm::structure::arrangement::ArrangerObjectparentObject
zrythm::structure::arrangement::ArrangerObject::Type type
zrythm::dsp::Positionposition
zrythm::dsp::ContentPositionlength
zrythm::structure::arrangement::ArrangerObjectNamename
zrythm::structure::arrangement::ArrangerObjectColorcolor
zrythm::structure::arrangement::ArrangerObjectMuteFunctionalitymute

Detailed Description

A Clip containing MIDI events.

MidiClip represents a clip in the timeline that holds MIDI note and controller data. It is specific to instrument/MIDI tracks and can be constructed from a MIDI file or a chord descriptor.

Definition at line 22 of file midi_clip.h.

Member Function Documentation

◆ first_child_position()

std::optional< dsp::ContentTick > zrythm::structure::arrangement::MidiClip::first_child_position ( ) const
overridevirtual

Returns the position of the first child, if any.

Used by undo commands to capture/restore child positions.

Implements zrythm::structure::arrangement::Clip.

◆ get_child_list_models()

std::vector< ArrangerObjectListModel * > zrythm::structure::arrangement::MidiClip::get_child_list_models ( ) const
inlineoverridevirtual

Reimplemented from zrythm::structure::arrangement::ArrangerObject.

Definition at line 67 of file midi_clip.h.

◆ get_field_name_for_serialization() [1/2]

std::string zrythm::structure::arrangement::MidiClip::get_field_name_for_serialization ( const MidiControlEvent * ) const
inlineoverride

Definition at line 62 of file midi_clip.h.

◆ get_field_name_for_serialization() [2/2]

std::string zrythm::structure::arrangement::MidiClip::get_field_name_for_serialization ( const MidiNote * ) const
inlineoverride

Definition at line 57 of file midi_clip.h.

◆ shift_all_children()

void zrythm::structure::arrangement::MidiClip::shift_all_children ( dsp::ContentTick delta)
overridevirtual

Shifts all child objects by delta content ticks.

Implements zrythm::structure::arrangement::Clip.

◆ source_bpm()

units::bpm_t zrythm::structure::arrangement::MidiClip::source_bpm ( ) const
inlinenodiscard

Source tempo for Absolute-mode anchor (default 0 = no anchor).

Absolute mode is a no-op while this is 0.

Definition at line 52 of file midi_clip.h.

◆ from_json

void from_json ( const nlohmann::json & j,
MidiClip & clip )
friend

Definition at line 96 of file midi_clip.h.

◆ to_json

void to_json ( nlohmann::json & j,
const MidiClip & clip )
friend

Definition at line 88 of file midi_clip.h.


The documentation for this class was generated from the following file: