6#include "structure/tracks/channel.h"
7#include "structure/tracks/processable_track.h"
9#define DEFINE_CHANNEL_TRACK_QML_PROPERTIES(ClassType) \
11 Q_PROPERTY (Channel * channel READ channel CONSTANT)
13namespace zrythm::structure::tracks
18class ChannelTrack :
virtual public ProcessableTrack
24 ~ChannelTrack ()
override =
default;
26 Channel * channel ()
const {
return channel_.get (); }
33 return channel_->get_fader ().currently_muted ();
41 return channel_->get_fader ().currently_listened ();
51 bool currently_soloed ()
const override
53 return channel_->get_fader ().currently_soloed ();
87 set_soloed (
bool solo,
bool trigger_undo,
bool auto_select,
bool fire_events);
93 set_muted (
bool mute,
bool trigger_undo,
bool auto_select,
bool fire_events);
95 void set_output (std::optional<Track::Uuid>
id) { output_track_uuid_ = id; }
97 bool has_output ()
const {
return output_track_uuid_.has_value (); }
99 auto output_track ()
const
101 return track_registry_.find_by_id_or_throw (output_track_uuid_.value ());
104 GroupTargetTrack &output_track_as_group_target ()
const;
107 friend void init_from (
109 const ChannelTrack &other,
120 static constexpr auto kChannelKey =
"channel"sv;
121 static constexpr auto kOutputIdKey =
"outputId"sv;
122 friend void to_json (nlohmann::json &j,
const ChannelTrack &c)
124 j[kChannelKey] = c.channel_;
125 j[kOutputIdKey] = c.output_track_uuid_;
127 friend void from_json (
const nlohmann::json &j,
ChannelTrack &c)
129 c.channel_ = c.generate_channel ();
130 j.at (kChannelKey).get_to (*c.channel_);
131 j.at (kOutputIdKey).get_to (c.output_track_uuid_);
143 std::optional<Uuid> output_track_uuid_;
145 TrackRegistry &track_registry_;
148using ChannelTrackVariant = std::variant<
158using ChannelTrackPtrVariant = to_pointer_variant<ChannelTrackVariant>;
Abstract class for a track that has a channel in the mixer.
void init_channel()
Initializes the channel.
bool currently_muted() const override
Returns if the track is muted.
void set_soloed(bool solo, bool trigger_undo, bool auto_select, bool fire_events)
Sets track soloed, updates UI and optionally adds the action to the undo stack.
bool get_implied_soloed() const override
Returns whether the fader is not soloed on its own but its direct out (or its direct out's direct out...
bool currently_listened() const override
Returns if the track is listened.
void set_muted(bool mute, bool trigger_undo, bool auto_select, bool fire_events)
Sets track muted and optionally adds the action to the undo stack.
void set_listened(bool listen, bool trigger_undo, bool auto_select, bool fire_events)
Generates a menu to be used for channel-related items, eg, fader buttons, direct out,...
Represents a channel strip on the mixer.
A unique pointer for QObject objects that also works with QObject-based ownership.