53#define PROJECT_SCHEMA_VERSION 5
55#define PROJECT ZRYTHM->project
56#define DEFAULT_PROJECT_NAME "Untitled Project"
57#define PROJECT_FILE "project.zpj"
58#define PROJECT_BACKUPS_DIR "backups"
59#define PROJECT_PLUGINS_DIR "plugins"
60#define PROJECT_PLUGIN_STATES_DIR "states"
61#define PROJECT_PLUGIN_EXT_COPIES_DIR "ext_file_copies"
62#define PROJECT_PLUGIN_EXT_LINKS_DIR "ext_file_links"
63#define PROJECT_EXPORTS_DIR "exports"
64#define PROJECT_STEMS_DIR "stems"
65#define PROJECT_POOL_DIR "pool"
66#define PROJECT_FINISHED_FILE "FINISHED"
70 PROJECT_PATH_PROJECT_FILE,
90 PROJECT_PATH_EXPORTS_STEMS,
94 PROJECT_PATH_FINISHED_FILE,
126static const cyaml_strval_t selection_type_strings[] = {
142 PROJECT_COMPRESS_FILE,
143 PROJECT_COMPRESS_DATA,
146#define PROJECT_DECOMPRESS_FILE PROJECT_COMPRESS_FILE
147#define PROJECT_DECOMPRESS_DATA PROJECT_COMPRESS_DATA
239 double piano_roll_zoom;
307static const cyaml_schema_field_t project_fields_schema[] = {
308 YAML_FIELD_INT (
Project, schema_version),
309 YAML_FIELD_STRING_PTR (
Project, title),
310 YAML_FIELD_STRING_PTR (
Project, datetime_str),
311 YAML_FIELD_STRING_PTR (
Project, version),
315 tracklist_fields_schema),
319 clip_editor_fields_schema),
323 timeline_fields_schema),
327 snap_grid_fields_schema),
331 snap_grid_fields_schema),
334 quantize_opts_timeline,
335 quantize_options_fields_schema),
338 quantize_opts_editor,
339 quantize_options_fields_schema),
343 engine_fields_schema),
347 mixer_selections_fields_schema),
351 timeline_selections_fields_schema),
354 midi_arranger_selections,
355 midi_arranger_selections_fields_schema),
359 chord_selections_fields_schema),
362 automation_selections,
363 automation_selections_fields_schema),
367 audio_selections_fields_schema),
370 tracklist_selections,
371 tracklist_selections_fields_schema),
374 region_link_group_manager,
375 region_link_group_manager_fields_schema),
378 port_connections_manager,
379 port_connections_manager_fields_schema),
383 midi_mappings_fields_schema),
387 undo_manager_fields_schema),
391 selection_type_strings),
396static const cyaml_schema_value_t project_schema = {
416 bool show_notification;
421 ProgressInfo * progress_info;
425project_save_data_new (
void);
443project_get_arranger_selections_for_last_selection (
459COLD WARN_UNUSED_RESULT
Project *
462 const char * prj_dir,
476WARN_UNUSED_RESULT COLD
bool
478 const char * filename,
479 const bool is_template,
495WARN_UNUSED_RESULT
bool
499 const bool is_backup,
500 const bool show_notification,
558 const size_t _src_size,
562#define project_compress(a, b, c, d, e, f, error) \
563 _project_compress (true, a, b, c, d, e, f, error)
565#define project_decompress(a, b, c, d, e, f, error) \
566 _project_compress (false, a, b, c, d, e, f, error)
API for selections in the AudioArrangerWidget.
API for selections in the AutomationArrangerWidget.
The clip/region editor backend.
API for selections in the piano roll.
API for MIDI notes in the PianoRoll.
A region in the timeline.
Zrythm * zrythm
Global variable, should be available to all files.
bool project_fix_audio_regions(Project *self)
void project_free(Project *self)
Tears down the project.
NONNULL Project * project_clone(const Project *src, bool for_backup, GError **error)
Deep-clones the given project.
void project_validate(Project *self)
Checks that everything is okay with the project.
int project_autosave_cb(void *data)
Autosave callback.
COLD WARN_UNUSED_RESULT Project * project_create_default(Project *self, const char *prj_dir, bool headless, bool with_engine, GError **error)
Creates a default project.
bool _project_compress(bool compress, char **_dest, size_t *_dest_size, ProjectCompressionFlag dest_type, const char *_src, const size_t _src_size, ProjectCompressionFlag src_type, GError **error)
Compresses/decompress a project from a file/data to a file/data.
WARN_UNUSED_RESULT bool project_save(Project *self, const char *_dir, const bool is_backup, const bool show_notification, const bool async, GError **error)
Saves the project to a project file in the given dir.
char * project_get_existing_yaml(Project *self, bool backup, GError **error)
Returns the YAML representation of the saved project file.
COLD Project * project_new(Zrythm *zrythm)
Creates an empty project object.
COLD void project_init_selections(Project *self)
Initializes the selections in the project.
ProjectCompressionFlag
Flag to pass to project_compress() and project_decompress().
SelectionType
Selection type, used for controlling which part of the interface is selected, for copy-paste,...
MALLOC NONNULL char * project_get_path(Project *self, ProjectPath path, bool backup)
Returns the requested project path as a newly allocated string.
WARN_UNUSED_RESULT COLD bool project_load(const char *filename, const bool is_template, GError **error)
If project has a filename set, it loads that.
@ PROJECT_PATH_PLUGINS
Plugins path.
@ PROJECT_PATH_PLUGIN_EXT_COPIES
External files for plugin states, under the STATES dir.
@ PROJECT_PATH_PLUGIN_STATES
Path for state .ttl files.
@ PROJECT_PATH_PLUGIN_EXT_LINKS
External files for plugin states, under the STATES dir.
@ SELECTION_TYPE_INSERT
Insert selections in the mixer.
@ SELECTION_TYPE_TRACKLIST
Track selection in tracklist or mixer.
@ SELECTION_TYPE_MIDI_FX
MIDI FX selections in the mixer.
@ SELECTION_TYPE_EDITOR
Editor arranger.
@ SELECTION_TYPE_MODULATOR
Modulator slot.
@ SELECTION_TYPE_TIMELINE
Timeline or pinned timeline.
@ SELECTION_TYPE_INSTRUMENT
Instrument slot.
#define YAML_FIELD_MAPPING_PTR(owner, member, schema)
Mapping pointer to a struct.
#define YAML_VALUE_PTR(cc, fields_schema)
Schema to be used as a pointer.
#define YAML_FIELD_MAPPING_PTR_OPTIONAL(owner, member, schema)
Mapping pointer to a struct.
API for selections in the piano roll.
Mapping MIDI CC to controls.
Ports that transfer audio/midi/other signals to one another.
Port connections manager.
Manager of linked region groups.
Selections to be used for the AudioArrangerWidget's current selections, copying, undoing,...
Selections to be used for the AutomationArrangerWidget's current selections, copying,...
Selections to be used for the ChordArrangerWidget's current selections, copying, undoing,...
Clip editor serializable backend.
A collection of selected MidiNote's.
All MIDI mappings in Zrythm.
Selections to be used for the timeline's current selections, copying, undoing, etc.
Port connections manager.
bool has_error
Whether an error occurred during saving.
Project * project
Project clone (with memcpy).
char * project_file_path
Full path to save to.
bool finished
To be set to true when the thread finishes.
Contains all of the info that will be serialized into a project file.
ChordSelections * chord_selections
Selected objects in the ChordObjectArrangerWidget.
TimelineSelections * timeline_selections
Selected objects in the TimelineArrangerWidget.
Timeline * timeline
Timeline widget backend.
Tool tool
Currently selected tool (select - normal, select - stretch, edit, delete, ramp, audition)
ZixSem save_sem
Semaphore used to block saving.
char * dir
Path to save the project in.
bool loaded
If a project is currently loaded or not.
QuantizeOptions * quantize_opts_editor
Quantize info for the piano roll.
SelectionType last_selection
The last thing selected in the GUI.
SnapGrid * snap_grid_editor
Snap/Grid info for the editor.
MidiArrangerSelections * midi_arranger_selections
Selected MidiNote's in the MidiArrangerWidget.
UndoableAction * last_saved_action
Used to check if the project has unsaved changes.
QuantizeOptions * quantize_opts_timeline
Quantize info for the timeline.
SnapGrid * snap_grid_timeline
Snap/Grid info for the timeline.
double timeline_zoom
Zoom levels.
AudioEngine * audio_engine
The audio backend.
AutomationSelections * automation_selections
Selected objects in the AutomationArrangerWidget.
char * backup_dir
Backup dir to save the project during the current save call.
MixerSelections * mixer_selections
Plugin selections in the Mixer.
bool loading_from_backup
Whether the current is currently being loaded from a backup file.
gint64 last_successful_autosave_time
Last successful autosave timestamp.
RegionLinkGroupManager * region_link_group_manager
Manager for region link groups.
UndoableAction * last_action_in_last_successful_autosave
Last undoable action in the previous successful autosave.
char * title
Project title.
char * datetime_str
Datetime string to add to the project file.
ClipEditor * clip_editor
Backend for the widget.
TracklistSelections * tracklist_selections
Selected Track's.
AudioSelections * audio_selections
Selected objects in the audio editor.
char * version
Zrythm version, for serialization.
MidiMappings * midi_mappings
MIDI bindings.
Manager of region link groups.
Selections to be used for the timeline's current selections, copying, undoing, etc.
Clip editor serializable backend.
Selections to be used for the tracklist's current selections, copying, undoing, etc.
The Tracklist contains all the tracks in the Project.
Base struct to be inherited by implementing undoable actions.
To be used throughout the program.
Current TimelineArranger selections.