|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
The Tracklist contains all the tracks in the Project. More...
#include <src/gui/dsp/tracklist.h>


Public Types | |
| enum class | PinOption { PinnedOnly , UnpinnedOnly , Both } |
| Used in track search functions. More... | |
| enum | TrackRoles { TrackPtrRole = Qt::UserRole + 1 , TrackNameRole } |
| using | TrackUuid = Track::Uuid |
Public Member Functions | |
| Tracklist (QObject *parent=nullptr) | |
| Tracklist (Project &project, PortRegistry &port_registry, TrackRegistry &track_registry, dsp::PortConnectionsManager *port_connections_manager) | |
| Tracklist (SampleProcessor &sample_processor, PortRegistry &port_registry, TrackRegistry &track_registry, dsp::PortConnectionsManager *port_connections_manager) | |
| QHash< int, QByteArray > | roleNames () const override |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
| TempoTrack * | getTempoTrack () const |
| Q_INVOKABLE void | setExclusivelySelectedTrack (QVariant track) |
| auto | get_track_span () const |
| bool | is_in_active_project () const |
| bool | is_auditioner () const |
| void | init_after_cloning (const Tracklist &other, ObjectCloneType clone_type) override |
| Initializes the cloned object. | |
| void | init_loaded (PortRegistry &port_registry, Project *project, SampleProcessor *sample_processor) |
| Initializes the tracklist when loading a project. | |
| void | init_loaded (PortRegistry &port_registry, Project &project) |
| void | init_loaded (PortRegistry &port_registry, SampleProcessor &sample_processor) |
| TrackPtrVariant | insert_track (const TrackUuidReference &track_id, int pos, AudioEngine &engine, bool publish_events, bool recalc_graph) |
| Adds given track to given spot in tracklist. | |
| TrackPtrVariant | append_track (auto track_id, AudioEngine &engine, bool publish_events, bool recalc_graph) |
| Calls insert_track with the given options. | |
| void | remove_track (const TrackUuid &track_id) |
| Removes the given track from the tracklist. | |
| void | move_track (TrackUuid track_id, int pos, bool always_before_pos, std::optional< std::reference_wrapper< Router > > router) |
Moves a track from its current position to the position given by pos. | |
| std::optional< TrackPtrVariant > | get_track (const TrackUuid &id) const |
| void | set_track_pinned (TrackUuid track_id, bool pinned, int publish_events, int recalc_graph) |
| Pins or unpins the Track. | |
| bool | validate () const |
| ChordTrack * | get_chord_track () const |
| std::optional< TrackPtrVariant > | get_first_visible_track (bool pinned) const |
| Returns the first visible Track. | |
| std::optional< TrackPtrVariant > | get_prev_visible_track (Track::TrackUuid track_id) const |
| Returns the previous visible Track in the same Tracklist as the given one (ie, pinned or not). | |
| std::optional< TrackPtrVariant > | get_next_visible_track (Track::TrackUuid track_id) const |
| Returns the next visible Track in the same Tracklist as the given one (ie, pinned or not). | |
| int | get_last_pos (PinOption pin_opt=PinOption::Both, bool visible_only=false) const |
| Returns the index of the last Track. | |
| std::optional< TrackPtrVariant > | get_last_track (PinOption pin_opt=PinOption::Both, bool visible_only=false) const |
| Returns the last Track. | |
| std::optional< TrackPtrVariant > | get_visible_track_after_delta (Track::TrackUuid track_id, int delta) const |
| Returns the Track after delta visible Track's. | |
| int | get_visible_track_diff (Track::TrackUuid src_track, Track::TrackUuid dest_track) const |
| Returns the number of visible Tracks between src and dest (negative if dest is before src). | |
| bool | multiply_track_heights (double multiplier, bool visible_only, bool check_only, bool fire_events) |
| Multiplies all tracks' heights and returns if the operation was valid. | |
| void | handle_click (TrackUuid track_id, bool ctrl, bool shift, bool dragged) |
| Handle a click selection. | |
| std::vector< ArrangerObjectPtrVariant > | get_timeline_objects_in_range (std::optional< std::pair< dsp::Position, dsp::Position > > range=std::nullopt) const |
| void | clear_selections_for_object_siblings (const ArrangerObject::Uuid &object_id) |
| Clears either the timeline selections or the clip editor selections. | |
| void | import_regions (std::vector< std::vector< std::shared_ptr< Region > > > ®ion_arrays, const FileImportInfo *import_info, TracksReadyCallback ready_cb) |
| Imports regions from a region array. | |
| void | move_region_to_track (ArrangerObjectPtrVariant region, const Track::Uuid &to_track_id, int lane_or_at_index, int index) |
| Moves the Region to the given Track, maintaining the selection status of the Region. | |
| void | move_plugin_automation (const Plugin::Uuid &plugin_id, const Track::Uuid &prev_track_id, const Track::Uuid &track_id_to_move_to, zrythm::plugins::PluginSlot new_slot) |
| Moves the Plugin's automation from one Channel to another. | |
| void | move_plugin (const Plugin::Uuid &plugin_id, const Track::Uuid &target_track_id, plugins::PluginSlot slot, bool confirm_overwrite) |
| Moves the plugin to the given slot in the given channel. | |
| zrythm::gui::Channel * | get_channel_for_plugin (const Plugin::Uuid &plugin_id) |
| void | import_files (std::optional< std::vector< utils::Utf8String > > uri_list, const FileDescriptor *orig_file, const Track *track, const TrackLane *lane, int index, const zrythm::dsp::Position *pos, TracksReadyCallback ready_cb) |
| Begins file import Handles a file drop inside the timeline or in empty space in the tracklist. | |
| bool | track_name_is_unique (const utils::Utf8String &name, TrackUuid track_to_skip) const |
| Returns whether the track name is not taken. | |
| bool | is_track_pinned (size_t index) const |
Returns whether the track at index is pinned. | |
| auto | get_track_index (const Track::TrackUuid &track_id) const |
| auto | get_track_at_index (size_t index) const |
| auto | get_track_ref_at_index (size_t index) const |
| bool | is_track_pinned (Track::TrackUuid track_id) const |
| auto | get_selection_manager () |
| void | select_foldable_children_of_current_selections () |
| Also selects the children of foldable tracks in the currently selected tracks. | |
| auto | get_pinned_tracks_cutoff_index () const |
| void | set_pinned_tracks_cutoff_index (size_t index) |
| auto | track_count () const |
| void | mark_track_for_bounce (TrackPtrVariant track_var, bool bounce, bool mark_regions, bool mark_children, bool mark_parents) |
| Marks the track for bouncing. | |
| void | mark_all_tracks_for_bounce (bool bounce) |
Public Member Functions inherited from ICloneable< Tracklist > | |
| std::unique_ptr< Tracklist > | clone_unique (ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
| std::shared_ptr< Tracklist > | clone_shared (ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
| Tracklist * | clone_raw_ptr (ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
| Tracklist * | clone_qobject (QObject *parent, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
| QScopedPointer< Tracklist > | clone_unique_qobject (QObject *parent, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const |
Data Fields | |
| ChordTrack * | chord_track_ = nullptr |
| The chord track, for convenience. | |
| MarkerTrack * | marker_track_ = nullptr |
| The marker track, for convenience. | |
| TempoTrack * | tempo_track_ = nullptr |
| The tempo track, for convenience. | |
| ModulatorTrack * | modulator_track_ = nullptr |
| The modulator track, for convenience. | |
| MasterTrack * | master_track_ = nullptr |
| The master track, for convenience. | |
| Project * | project_ = nullptr |
| Pointer to owner project, if any. | |
| QPointer< dsp::PortConnectionsManager > | port_connections_manager_ |
| Width of track widgets. | |
Data Fields inherited from ICloneable< Tracklist > | |
| friend | Derived |
Static Public Attributes | |
| static constexpr std::array< Track::Type, 4 > | unique_track_types_ |
| A list of track types that must be unique in the tracklist. | |
Properties | |
| QML_ELEMENT TempoTrack * | tempoTrack |
Friends | |
| void | to_json (nlohmann::json &j, const Tracklist &t) |
| void | from_json (const nlohmann::json &j, Tracklist &t) |
The Tracklist contains all the tracks in the Project.
There should be a clear separation between the Tracklist and the Mixer. The Tracklist should be concerned with Tracks in the arranger, and the Mixer should be concerned with Channels, routing and Port connections.
Definition at line 31 of file tracklist.h.
| using Tracklist::TrackUuid = Track::Uuid |
Definition at line 38 of file tracklist.h.
|
strong |
Used in track search functions.
Definition at line 43 of file tracklist.h.
| enum Tracklist::TrackRoles |
Definition at line 50 of file tracklist.h.
|
inline |
Calls insert_track with the given options.
Definition at line 140 of file tracklist.h.
| void Tracklist::clear_selections_for_object_siblings | ( | const ArrangerObject::Uuid & | object_id | ) |
Clears either the timeline selections or the clip editor selections.
| object_id | The object that is part of the target selections. |
| std::optional< TrackPtrVariant > Tracklist::get_first_visible_track | ( | bool | pinned | ) | const |
Returns the first visible Track.
| pinned | 1 to check the pinned tracklist, 0 to check the non-pinned tracklist. |
| int Tracklist::get_last_pos | ( | PinOption | pin_opt = PinOption::Both, |
| bool | visible_only = false ) const |
|
inline |
Returns the last Track.
| pin_opt | Pin option. |
| visible_only | Only consider visible Track's. |
Definition at line 237 of file tracklist.h.
|
inline |
Definition at line 467 of file tracklist.h.
|
inline |
Definition at line 434 of file tracklist.h.
|
inline |
Definition at line 173 of file tracklist.h.
|
inline |
Definition at line 415 of file tracklist.h.
|
inline |
Definition at line 408 of file tracklist.h.
|
inline |
Definition at line 422 of file tracklist.h.
|
inline |
Definition at line 93 of file tracklist.h.
| std::optional< TrackPtrVariant > Tracklist::get_visible_track_after_delta | ( | Track::TrackUuid | track_id, |
| int | delta ) const |
| int Tracklist::get_visible_track_diff | ( | Track::TrackUuid | src_track, |
| Track::TrackUuid | dest_track ) const |
Returns the number of visible Tracks between src and dest (negative if dest is before src).
The caller is responsible for checking that both tracks are in the same tracklist (ie, pinned or not).
| void Tracklist::import_files | ( | std::optional< std::vector< utils::Utf8String > > | uri_list, |
| const FileDescriptor * | orig_file, | ||
| const Track * | track, | ||
| const TrackLane * | lane, | ||
| int | index, | ||
| const zrythm::dsp::Position * | pos, | ||
| TracksReadyCallback | ready_cb ) |
Begins file import Handles a file drop inside the timeline or in empty space in the tracklist.
| uri_list | URI list, if URI list was dropped. |
| file | File, if FileDescriptor was dropped. |
| track | Track, if any. |
| lane | TrackLane, if any. |
| index | Index to insert new tracks at, or -1 to insert at end. |
| pos | Position the file was dropped at, if inside track. |
| ZrythmException | on error. |
| void Tracklist::import_regions | ( | std::vector< std::vector< std::shared_ptr< Region > > > & | region_arrays, |
| const FileImportInfo * | import_info, | ||
| TracksReadyCallback | ready_cb ) |
Imports regions from a region array.
| region_arrays | |
| import_info | |
| ready_cb |
| ZrythmException | on error. |
|
overridevirtual |
Initializes the cloned object.
| ZrythmException | If the object could not be cloned. |
Implements ICloneable< Tracklist >.
|
inline |
Definition at line 113 of file tracklist.h.
|
inline |
Definition at line 118 of file tracklist.h.
| TrackPtrVariant Tracklist::insert_track | ( | const TrackUuidReference & | track_id, |
| int | pos, | ||
| AudioEngine & | engine, | ||
| bool | publish_events, | ||
| bool | recalc_graph ) |
Adds given track to given spot in tracklist.
| publish_events | Publish UI events. |
| recalc_graph | Recalculate routing graph. |
|
inline |
Definition at line 97 of file tracklist.h.
|
inline |
Returns whether the track at index is pinned.
Definition at line 403 of file tracklist.h.
|
inline |
Definition at line 429 of file tracklist.h.
|
inline |
Definition at line 489 of file tracklist.h.
| void Tracklist::mark_track_for_bounce | ( | TrackPtrVariant | track_var, |
| bool | bounce, | ||
| bool | mark_regions, | ||
| bool | mark_children, | ||
| bool | mark_parents ) |
Marks the track for bouncing.
| mark_children | Whether to mark all children tracks as well. Used when exporting stems on the specific track stem only. IMPORTANT: Track.bounce_to_master must be set beforehand if this is true. |
| mark_parents | Whether to mark all parent tracks as well. |
| void Tracklist::move_plugin | ( | const Plugin::Uuid & | plugin_id, |
| const Track::Uuid & | target_track_id, | ||
| plugins::PluginSlot | slot, | ||
| bool | confirm_overwrite ) |
Moves the plugin to the given slot in the given channel.
If a plugin already exists, it deletes it and replaces it.
| confirm_overwrite | Whether to show a dialog to confirm the overwrite when a plugin already exists. |
| void Tracklist::move_region_to_track | ( | ArrangerObjectPtrVariant | region, |
| const Track::Uuid & | to_track_id, | ||
| int | lane_or_at_index, | ||
| int | index ) |
Moves the Region to the given Track, maintaining the selection status of the Region.
Assumes that the Region is already in a TrackLane or AutomationTrack.
| lane_or_at_index | If MIDI or audio, lane position. If automation, automation track index in the automation tracklist. If -1, the track lane or automation track index will be inferred from the region. |
| index | If MIDI or audio, index in lane in the new track to insert the region to, or -1 to append. If automation, index in the automation track. |
| ZrythmException | on error. |
| void Tracklist::move_track | ( | TrackUuid | track_id, |
| int | pos, | ||
| bool | always_before_pos, | ||
| std::optional< std::reference_wrapper< Router > > | router ) |
Moves a track from its current position to the position given by pos.
| pos | Position to insert at, or -1 to insert at the end. |
| always_before_pos | Whether the track should always be put before the track currently at pos. If this is true, when moving down, the resulting track position will be pos - 1. |
| router | If given, the processing graph will be soft-recalculated. |
| bool Tracklist::multiply_track_heights | ( | double | multiplier, |
| bool | visible_only, | ||
| bool | check_only, | ||
| bool | fire_events ) |
Multiplies all tracks' heights and returns if the operation was valid.
| visible_only | Only apply to visible tracks. |
| void Tracklist::remove_track | ( | const TrackUuid & | track_id | ) |
Removes the given track from the tracklist.
Also disconnects the channel (breaks its internal & external connections) and removes any plugins (if any).
|
inline |
Also selects the children of foldable tracks in the currently selected tracks.
Definition at line 443 of file tracklist.h.
|
inline |
Definition at line 468 of file tracklist.h.
|
inline |
Definition at line 472 of file tracklist.h.
| bool Tracklist::track_name_is_unique | ( | const utils::Utf8String & | name, |
| TrackUuid | track_to_skip ) const |
Returns whether the track name is not taken.
| track_to_skip | Track to skip when searching. |
|
friend |
Definition at line 506 of file tracklist.h.
|
friend |
Definition at line 498 of file tracklist.h.
| ChordTrack* Tracklist::chord_track_ = nullptr |
The chord track, for convenience.
Definition at line 551 of file tracklist.h.
| MarkerTrack* Tracklist::marker_track_ = nullptr |
The marker track, for convenience.
Definition at line 554 of file tracklist.h.
| MasterTrack* Tracklist::master_track_ = nullptr |
The master track, for convenience.
Definition at line 563 of file tracklist.h.
| ModulatorTrack* Tracklist::modulator_track_ = nullptr |
The modulator track, for convenience.
Definition at line 560 of file tracklist.h.
| QPointer<dsp::PortConnectionsManager> Tracklist::port_connections_manager_ |
Width of track widgets.
Definition at line 587 of file tracklist.h.
| Project* Tracklist::project_ = nullptr |
Pointer to owner project, if any.
Definition at line 582 of file tracklist.h.
| TempoTrack* Tracklist::tempo_track_ = nullptr |
The tempo track, for convenience.
Definition at line 557 of file tracklist.h.
|
staticconstexpr |
A list of track types that must be unique in the tracklist.
Definition at line 88 of file tracklist.h.
|
read |
Definition at line 35 of file tracklist.h.