30 DEFINE_ARRANGER_OBJECT_OWNER_QML_PROPERTIES (
34 DEFINE_ARRANGER_OBJECT_OWNER_QML_PROPERTIES (
38 Q_PROPERTY (QString name READ name WRITE setName NOTIFY nameChanged)
39 Q_PROPERTY (
double height READ height WRITE setHeight NOTIFY heightChanged)
40 Q_PROPERTY (
bool muted READ muted WRITE setMuted NOTIFY muteChanged)
41 Q_PROPERTY (
bool soloed READ soloed WRITE setSoloed NOTIFY soloChanged)
43 std::uint8_t midiChannel READ midiChannel WRITE setMidiChannel NOTIFY
48 static constexpr double DEFAULT_HEIGHT = 48;
56 static constexpr auto default_format_str = QT_TR_NOOP_UTF8 (
"Lane {}");
60 structure::arrangement::ArrangerObjectRegistry &obj_registry_;
61 dsp::FileAudioSourceRegistry &file_audio_source_registry_;
67 arrangement::ArrangerObjectOwner<arrangement::MidiRegion> (
68 dependencies.obj_registry_,
69 dependencies.file_audio_source_registry_,
71 arrangement::ArrangerObjectOwner<arrangement::AudioRegion> (
72 dependencies.obj_registry_,
73 dependencies.file_audio_source_registry_,
75 soloed_lanes_exist_func_ (
76 std::move (dependencies.soloed_lanes_exist_func_))
86 QString name ()
const {
return name_.to_qstring (); }
87 void setName (
const QString &name)
89 const auto std_name = utils::Utf8String::from_qstring (name);
90 if (name_ == std_name)
94 Q_EMIT nameChanged (name);
96 Q_SIGNAL
void nameChanged (
const QString &name);
98 double height ()
const {
return height_; }
99 void setHeight (
const double height)
105 Q_EMIT heightChanged (height);
107 Q_SIGNAL
void heightChanged (
double height);
109 bool soloed ()
const {
return solo_; }
110 void setSoloed (
bool solo)
116 Q_EMIT soloChanged (solo);
118 Q_SIGNAL
void soloChanged (
bool solo);
120 bool muted ()
const {
return mute_; }
121 void setMuted (
bool mute)
127 Q_EMIT muteChanged (mute);
129 Q_SIGNAL
void muteChanged (
bool mute);
142 if (soloed_lanes_exist_func_ () && !soloed ())
148 std::uint8_t midiChannel ()
const {
return midi_ch_; }
149 void setMidiChannel (std::uint8_t midi_ch)
151 if (midi_ch_ == midi_ch)
155 Q_EMIT midiChannelChanged (midi_ch);
157 Q_SIGNAL
void midiChannelChanged (std::uint8_t midi_ch);
178 return "midiRegions";
183 return "audioRegions";
187 static constexpr std::string_view kNameKey =
"name";
188 static constexpr std::string_view kHeightKey =
"height";
189 static constexpr std::string_view kMuteKey =
"mute";
190 static constexpr std::string_view kSoloKey =
"solo";
191 static constexpr std::string_view kMidiChannelKey =
"midiChannel";
192 friend void to_json (nlohmann::json &j,
const TrackLane &lane)
194 to_json (j,
static_cast<const UuidIdentifiableObject &
> (lane));
203 j[kNameKey] = lane.name_;
204 j[kHeightKey] = lane.height_;
205 j[kMuteKey] = lane.mute_;
206 j[kSoloKey] = lane.solo_;
207 j[kMidiChannelKey] = lane.midi_ch_;
209 friend void from_json (
const nlohmann::json &j, TrackLane &lane)
211 from_json (j,
static_cast<UuidIdentifiableObject &
> (lane));
214 static_cast<arrangement::ArrangerObjectOwner<arrangement::MidiRegion> &
> (
218 static_cast<arrangement::ArrangerObjectOwner<arrangement::AudioRegion> &
> (
220 j.at (kNameKey).get_to (lane.name_);
221 j.at (kHeightKey).get_to (lane.height_);
222 j.at (kMuteKey).get_to (lane.mute_);
223 j.at (kSoloKey).get_to (lane.solo_);
224 j.at (kMidiChannelKey).get_to (lane.midi_ch_);
227 friend void init_from (
229 const TrackLane &other,
232 obj.name_ = other.name_;
233 obj.height_ = other.height_;
234 obj.mute_ = other.mute_;
235 obj.solo_ = other.solo_;
236 obj.midi_ch_ = other.midi_ch_;
243 utils::Utf8String name_;
246 double height_{ DEFAULT_HEIGHT };
259 uint8_t midi_ch_ = 0;
261 BOOST_DESCRIBE_CLASS (
263 (utils::UuidIdentifiableObject<TrackLane>),
266 (name_, height_, mute_, solo_, midi_ch_))