Project module

Project initialization, saving and loading.

Contents

Classes

struct Project
Contains all of the info that will be serialized into a project file.

Enums

enum SelectionType { SELECTION_TYPE_TRACK, SELECTION_TYPE_PLUGIN, SELECTION_TYPE_EDITOR }
Selection type, used for displaying info in the inspector.
enum ProjectCompressionFlag { PROJECT_COMPRESS_FILE, PROJECT_COMPRESS_DATA }
Flag to pass to project_compress() and project_decompress().

Typedefs

using SelectionType = enum SelectionType
Selection type, used for displaying info in the inspector.
using ProjectCompressionFlag = enum ProjectCompressionFlag
Flag to pass to project_compress() and project_decompress().
using Project = struct Project
Contains all of the info that will be serialized into a project file.

Functions

void project_sanity_check(Project* self)
Checks that everything is okay with the project.
auto project_load(char* filename, const int is_template) -> int
If project has a filename set, it loads that.
auto project_save(Project* self, const char* _dir, const int is_backup, const int show_notification, const bool async) -> int
Saves the project to a project file in the given dir.
auto project_autosave_cb(void* data) -> int
Autosave callback.
auto project_get_backups_dir(Project* self) -> char*
Returns the backups dir for the given Project.
auto project_get_exports_dir(Project* self) -> char*
Returns the exports dir for the given Project.
auto project_get_states_dir(Project* self, const int is_backup) -> char*
Returns the states dir for the given Project.
auto project_get_pool_dir(Project* self) -> char*
Returns the pool dir for the given Project.
auto project_get_project_file_path(Project* self, const int is_backup) -> char*
Returns the full project file (project.yml) path.
void project_init_selections(Project* self)
Initializes the selections in the project.
auto _project_compress(bool compress, char** dest, size_t* dest_size, ProjectCompressionFlag dest_type, const char* src, const size_t src_size, ProjectCompressionFlag src_type) -> char*
Compresses/decompress a project from a file/data to a file/data.
void project_set_has_range(int has_range)
Sets if the project has range and updates UI.
void project_tear_down(Project* self)
Tears down the project.
void settings_init(Settings* self)
Initializes settings.
void settings_reset_to_factory(int confirm, int exit_on_finish)
Resets settings to defaults.
void settings_print(int pretty_print)
Prints the current settings.
void settings_free_members(Settings* self)
Frees settings.

Function documentation

int project_load(char* filename, const int is_template)

If project has a filename set, it loads that.

Parameters
filename
is_template Load the project as a template and create a new project from it.
Returns 0 if successful, non-zero otherwise.

Otherwise it loads the default project.

int project_save(Project* self, const char* _dir, const int is_backup, const int show_notification, const bool async)

Saves the project to a project file in the given dir.

Parameters
self
_dir
is_backup 1 if this is a backup. Backups will be saved as <original filename>.bak<num>.
show_notification Show a notification in the UI that the project was saved.
async Save asynchronously in another thread.
Returns Non-zero if error.

int project_autosave_cb(void* data)

Autosave callback.

This will keep getting called at regular short intervals, and if enough time has passed and it's okay to save it will autosave, otherwise it will wait until the next interval and check again.

char* project_get_states_dir(Project* self, const int is_backup)

Returns the states dir for the given Project.

Parameters
self
is_backup 1 to get the states dir of the current backup instead of the main project.

char* project_get_project_file_path(Project* self, const int is_backup)

Returns the full project file (project.yml) path.

Parameters
self
is_backup 1 to get the project file of the current backup instead of the main project.

void project_init_selections(Project* self)

Initializes the selections in the project.

char* _project_compress(bool compress, char** dest, size_t* dest_size, ProjectCompressionFlag dest_type, const char* src, const size_t src_size, ProjectCompressionFlag src_type)

Compresses/decompress a project from a file/data to a file/data.

Parameters
compress True to compress, false to decompress.
dest out Pointer to a location to allocate memory.
dest_size out Pointer to a location to store the size of the allocated memory.
dest_type
src Input buffer or filepath.
src_size Input buffer size, if not filepath.
src_type
Returns Error message if error, otherwise NULL.

void settings_init(Settings* self)

Initializes settings.

void settings_reset_to_factory(int confirm, int exit_on_finish)

Resets settings to defaults.

Parameters
confirm
exit_on_finish Exit with a code on finish.

void settings_print(int pretty_print)

Prints the current settings.

void settings_free_members(Settings* self)

Frees settings.