4#ifndef __AUDIO_AUTOMATION_TRACKLIST_H__
5#define __AUDIO_AUTOMATION_TRACKLIST_H__
7#include "gui/dsp/automation_track.h"
8#include "plugins/plugin_slot.h"
10#include <QAbstractListModel>
14using namespace zrythm;
31class AutomationTracklist final
32 :
public QAbstractListModel,
33 public ICloneable<AutomationTracklist>
40 PortRegistry &port_registry,
41 ArrangerObjectRegistry &object_registry,
43 QObject * parent =
nullptr);
48 AutomationTrackPtrRole = Qt::UserRole + 1,
54 QHash<int, QByteArray> roleNames ()
const override;
55 int rowCount (
const QModelIndex &parent = QModelIndex ())
const override;
57 data (
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
60 showNextAvailableAutomationTrack (
AutomationTrack * current_automation_track);
67 const AutomationTracklist &other,
75 TrackPtrVariant get_track ()
const;
108 return ats_.at (index);
111 auto &get_automation_tracks_in_record_mode () {
return ats_in_record_mode_; }
112 auto &get_automation_tracks_in_record_mode ()
const
114 return ats_in_record_mode_;
202 void append_objects (std::vector<ArrangerObject *> objects)
const;
222 void print_regions ()
const;
224 auto &get_visible_automation_tracks () {
return visible_ats_; }
225 auto &get_visible_automation_tracks ()
const {
return visible_ats_; }
227 auto &get_automation_tracks () {
return ats_; }
228 auto &get_automation_tracks ()
const {
return ats_; }
230 ControlPort &get_port (dsp::PortIdentifier::PortUuid
id)
const;
232 void set_caches (CacheType types);
235 static constexpr std::string_view kAutomationTracksKey =
"automationTracks";
236 friend void to_json (nlohmann::json &j,
const AutomationTracklist &ats)
238 j[kAutomationTracksKey] = ats.ats_;
240 friend void from_json (
const nlohmann::json &j, AutomationTracklist &ats);
242 auto &get_port_registry () {
return port_registry_; }
243 auto &get_port_registry ()
const {
return port_registry_; }
246 ArrangerObjectRegistry &object_registry_;
247 PortRegistry &port_registry_;
262 std::vector<AutomationTrack *> ats_;
268 std::vector<AutomationTrack *> ats_in_record_mode_;
273 std::vector<AutomationTrack *> visible_ats_;
278 AutomatableTrack &track_;
Interface for a track that has automatable parameters.
void set_at_index(AutomationTrack &at, int index, bool push_down)
Sets the index of the AutomationTrack and swaps it with the AutomationTrack at that index or pushes t...
void init_after_cloning(const AutomationTracklist &other, ObjectCloneType clone_type) override
Initializes the cloned object.
bool validate() const
Verifies the identifiers on a live automation tracklist (in the project, not a clone).
AutomationTrack * get_automation_track_by_port_id(dsp::PortIdentifier::PortUuid id) const
Returns the AutomationTrack corresponding to the given Port.
void unselect_all()
Unselects all arranger objects.
AutomationTrack * get_first_invisible_at() const
Used when the add button is added and a new automation track is requested to be shown.
AutomationTrack * get_at_from_port(const ControlPort &port) const
Returns the AutomationTrack corresponding to the given Port.
AutomationTrack * add_automation_track(AutomationTrack &at)
Adds the given automation track.
AutomationTrack * get_visible_at_after_delta(const AutomationTrack &at, int delta) const
Returns the AutomationTrack after delta visible AutomationTrack's.
void init_loaded()
Inits a loaded AutomationTracklist.
AutomationTrack * remove_at(AutomationTrack &at, bool free, bool fire_events)
Removes the AutomationTrack from the AutomationTracklist, optionally freeing it.
void update_positions(bool from_ticks, bool bpm_change)
Updates the frames of each position in each child of the automation tracklist recursively.
void clear_objects()
Removes all objects recursively.
int get_num_regions() const
Counts the total number of regions in the automation tracklist.
void remove_channel_ats(gui::Channel *ch)
Removes the AutomationTrack's associated with this channel from the AutomationTracklist in the corres...
AutomationTrack * get_plugin_at(plugins::PluginSlot slot, int port_index, const utils::Utf8String &symbol)
Gets the automation track matching the given arguments.
void print_ats() const
Prints info about all the automation tracks.
int get_num_visible() const
Returns the number of visible AutomationTrack's.
Represents a channel strip on the mixer.
Lightweight UTF-8 string wrapper with safe conversions.