44class Project final :
public QObject
49 QString title READ getTitle WRITE setTitle NOTIFY titleChanged FINAL)
51 QString directory READ directory WRITE setDirectory NOTIFY directoryChanged
61 clipPlaybackService CONSTANT FINAL)
70 tempoObjectManager CONSTANT FINAL)
77 friend struct PluginBuilderForDeserialization;
80 using TrackUuid = structure::tracks::TrackUuid;
81 using PluginPtrVariant = plugins::PluginPtrVariant;
82 using PluginRegistry = plugins::PluginRegistry;
87 std::shared_ptr<juce::AudioDeviceManager> device_manager,
88 std::shared_ptr<juce::AudioPluginFormatManager> plugin_format_manager,
89 plugins::PluginHostWindowFactory plugin_host_window_provider,
92 QObject * parent =
nullptr);
94 Z_DISABLE_COPY_MOVE (Project)
100 QString getTitle ()
const;
101 void setTitle (
const QString &title);
102 QString directory ()
const;
103 void setDirectory (
const QString &directory);
115 Q_SIGNAL
void titleChanged (
const QString &title);
116 Q_SIGNAL
void directoryChanged (
const QString &directory);
117 Q_SIGNAL
void aboutToBeDeleted ();
125 fs::path get_directory (
bool for_backup)
const;
128 auto * arrangerObjectFactory ()
const
130 return arranger_object_factory_.get ();
133 friend void init_from (
135 const Project &other,
147 Q_INVOKABLE Project *
clone (
bool for_backup)
const;
172 get_final_track_dependencies ()
const;
174 auto &get_file_audio_source_registry ()
const
176 return *file_audio_source_registry_;
178 auto &get_track_registry ()
const {
return *track_registry_; }
179 auto &get_plugin_registry ()
const {
return *plugin_registry_; }
180 auto &get_port_registry ()
const {
return *port_registry_; }
181 auto &get_param_registry ()
const {
return *param_registry_; }
182 auto &get_arranger_object_registry ()
const
184 return *arranger_object_registry_;
194 std::optional<dsp::PortPtrVariant>
197 return get_port_registry ().find_by_id (
id);
201 find_param_by_id (
const dsp::ProcessorParameter::Uuid &
id)
const
203 const auto opt_var = get_param_registry ().find_by_id (
id);
204 if (opt_var.has_value ())
206 return std::get<dsp::ProcessorParameter *> (opt_var.value ());
211 std::optional<plugins::PluginPtrVariant>
212 find_plugin_by_id (plugins::Plugin::Uuid
id)
const
214 return get_plugin_registry ().find_by_id (
id);
217 std::optional<zrythm::structure::tracks::TrackPtrVariant>
218 find_track_by_id (structure::tracks::Track::Uuid
id)
const
220 return get_track_registry ().find_by_id (
id);
223 std::optional<zrythm::structure::arrangement::ArrangerObjectPtrVariant>
224 find_arranger_object_by_id (
225 structure::arrangement::ArrangerObject::Uuid
id)
const
227 return get_arranger_object_registry ().find_by_id (
id);
230 const auto &get_tempo_map ()
const {
return tempo_map_; }
233 static constexpr auto kTempoMapKey =
"tempoMap"sv;
234 static constexpr auto kFileAudioSourceRegistryKey =
235 "fileAudioSourceRegistry"sv;
236 static constexpr auto kPortRegistryKey =
"portRegistry"sv;
237 static constexpr auto kParameterRegistryKey =
"paramRegistry"sv;
238 static constexpr auto kPluginRegistryKey =
"pluginRegistry"sv;
239 static constexpr auto kArrangerObjectRegistryKey =
"arrangerObjectRegistry"sv;
240 static constexpr auto kTrackRegistryKey =
"trackRegistry"sv;
241 static constexpr auto kTitleKey =
"title"sv;
242 static constexpr auto kDatetimeKey =
"datetime"sv;
243 static constexpr auto kVersionKey =
"version"sv;
244 static constexpr auto kSnapGridTimelineKey =
"snapGridTimeline"sv;
245 static constexpr auto kSnapGridEditorKey =
"snapGridEditor"sv;
246 static constexpr auto kTransportKey =
"transport"sv;
247 static constexpr auto kAudioPoolKey =
"audioPool"sv;
248 static constexpr auto kTracklistKey =
"tracklist"sv;
249 static constexpr auto kRegionLinkGroupManagerKey =
"regionLinkGroupManager"sv;
250 static constexpr auto kPortConnectionsManagerKey =
"portConnectionsManager"sv;
251 static constexpr auto kTempoObjectManagerKey =
"tempoObjectManager"sv;
252 static constexpr auto DOCUMENT_TYPE =
"ZrythmProject"sv;
253 static constexpr auto FORMAT_MAJOR_VER = 2;
254 static constexpr auto FORMAT_MINOR_VER = 1;
255 friend void to_json (nlohmann::json &j,
const Project &project);
256 friend void from_json (
const nlohmann::json &j, Project &project);
259 utils::AppSettings &app_settings_;
260 dsp::TempoMap tempo_map_;
263 plugins::PluginHostWindowFactory plugin_host_window_provider_;
265 dsp::FileAudioSourceRegistry * file_audio_source_registry_{};
266 dsp::PortRegistry * port_registry_{};
268 PluginRegistry * plugin_registry_{};
269 structure::arrangement::ArrangerObjectRegistry * arranger_object_registry_{};
270 structure::tracks::TrackRegistry * track_registry_{};
302 std::shared_ptr<juce::AudioDeviceManager> device_manager_;
304 std::shared_ptr<juce::AudioPluginFormatManager> plugin_format_manager_;
332 std::unique_ptr<dsp::AudioPool>
pool_;
347 boost::unordered_flat_map<
348 structure::tracks::TrackUuid,
349 structure::tracks::TrackPtrVariant>
354 clip_playback_service_;
356 std::unique_ptr<structure::arrangement::ArrangerObjectFactory>
357 arranger_object_factory_;
359 std::unique_ptr<structure::tracks::TrackFactory> track_factory_;
362 tempo_object_manager_;
376 int format_minor_ = 0;