Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2023 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __ZRYTHM_H__
11#define __ZRYTHM_H__
12
13#include "zrythm-config.h"
14
15#include <stdbool.h>
16
17#include <glib.h>
18
19#include "zix/sem.h"
20#include <gio/gio.h>
21
22typedef struct Project Project;
23typedef struct Symap Symap;
25typedef struct EventManager EventManager;
26typedef struct PluginManager PluginManager;
27typedef struct FileManager FileManager;
29typedef struct Settings Settings;
30typedef struct Log Log;
31typedef struct CairoCaches CairoCaches;
32typedef struct PCGRand PCGRand;
33
40#define ZRYTHM (zrythm)
41
42#define ZRYTHM_PROJECTS_DIR "projects"
43
44#define MAX_RECENT_PROJECTS 20
45#define DEBUGGING (G_UNLIKELY (ZRYTHM && ZRYTHM->debug))
46#define ZRYTHM_TESTING (G_UNLIKELY (ZRYTHM && ZRYTHM->testing))
47#define ZRYTHM_GENERATING_PROJECT (ZRYTHM->generating_project)
48#define ZRYTHM_HAVE_UI (ZRYTHM && ZRYTHM->have_ui)
49
50#ifdef HAVE_LSP_DSP
51# define ZRYTHM_USE_OPTIMIZED_DSP (G_LIKELY (ZRYTHM->use_optimized_dsp))
52#else
53# define ZRYTHM_USE_OPTIMIZED_DSP false
54#endif
55
180
187typedef struct Zrythm
188{
190 const char * exe_path;
191
196
201
210
212 char * recent_projects[MAX_RECENT_PROJECTS + 1];
213 int num_recent_projects;
214
216 char ** templates;
217
224
228
231
234
243
244 EventManager * event_manager;
245
248
251
254
259
264
266 PCGRand * rand;
267
271 bool debug;
272
279
283
285 // Log * log;
286
290
294
295 CairoCaches * cairo_caches;
296
299
302
304 char * version;
305
313
323
326} Zrythm;
327
331extern Zrythm * zrythm;
332
333void
334zrythm_add_to_recent_projects (Zrythm * self, const char * filepath);
335
336void
337zrythm_remove_recent_project (char * filepath);
338
346MALLOC
347char *
348zrythm_get_version (bool with_v);
349
356bool
357zrythm_is_release (bool official);
358
359char *
360zrythm_fetch_latest_release_ver_finish (GAsyncResult * result, GError ** error);
361
367void
369 GAsyncReadyCallback callback,
370 gpointer callback_data);
371
376bool
377zrythm_is_latest_release (const char * remote_latest_release);
378
386void
387zrythm_get_version_with_capabilities (char * buf, bool include_system_info);
388
393char *
395
402char *
404
411char *
413
424char *
426
437char *
438zrythm_get_user_dir (bool force_default);
439
446NONNULL bool
447zrythm_init_user_dirs_and_files (Zrythm * self, GError ** error);
448
452NONNULL void
454
462Zrythm *
463zrythm_new (const char * exe_path, bool have_ui, bool testing, bool optimized_dsp);
464
468void
470
475#endif /* __ZRYTHM_H__ */
char * zrythm_get_system_info(void)
Returns system info (mainly used for bug reports).
void zrythm_fetch_latest_release_ver_async(GAsyncReadyCallback callback, gpointer callback_data)
void zrythm_free(Zrythm *self)
Frees the instance and any unfreed members.
char * zrythm_get_user_dir(bool force_default)
Gets the zrythm directory, either from the settings if non-empty, or the default ($XDG_DATA_DIR/zryth...
Zrythm * zrythm
Global variable, should be available to all files.
ZrythmDirType
Type of Zrythm directory.
Definition zrythm.h:60
Zrythm * zrythm_new(const char *exe_path, bool have_ui, bool testing, bool optimized_dsp)
Creates a new Zrythm instance.
bool zrythm_is_latest_release(const char *remote_latest_release)
Returns whether the given release string is the latest release.
void zrythm_get_version_with_capabilities(char *buf, bool include_system_info)
Returns the version and the capabilities.
NONNULL bool zrythm_init_user_dirs_and_files(Zrythm *self, GError **error)
Initializes/creates the default dirs/files in the user directory.
bool zrythm_is_release(bool official)
Returns whether the current Zrythm version is a release version.
char * zrythm_get_dir(ZrythmDirType type)
Returns a Zrythm directory specified by type.
MALLOC char * zrythm_get_version(bool with_v)
Returns the version string.
char * zrythm_get_prefix(void)
Returns the prefix or in the case of windows the root dir (C/program files/zrythm) or in the case of ...
NONNULL void zrythm_init_templates(Zrythm *self)
Initializes the array of project templates.
char * zrythm_get_default_user_dir(void)
Returns the default user "zrythm" dir.
@ ZRYTHM_DIR_SYSTEM_THEMESDIR
Themes.
Definition zrythm.h:119
@ ZRYTHM_DIR_USER_GDB
Gdb backtrace files.
Definition zrythm.h:174
@ ZRYTHM_DIR_USER_PROJECTS
Subdirs of ZRYTHM_DIR_USER_TOP.
Definition zrythm.h:154
@ ZRYTHM_DIR_USER_BACKTRACE
Backtraces.
Definition zrythm.h:177
@ ZRYTHM_DIR_USER_PROFILING
Profiling files.
Definition zrythm.h:171
@ ZRYTHM_DIR_SYSTEM_PARENT_LIBDIR
libdir name under ZRYTHM_DIR_SYSTEM_PREFIX.
Definition zrythm.h:86
@ ZRYTHM_DIR_SYSTEM_SPECIAL_LV2_PLUGINS_DIR
Special external Zrythm plugins path (not part of the Zrythm source code).
Definition zrythm.h:133
@ ZRYTHM_DIR_SYSTEM_PREFIX
The prefix, or in the case of windows installer the root dir (C/program files/zrythm),...
Definition zrythm.h:76
@ ZRYTHM_DIR_SYSTEM_ZRYTHM_LIBDIR
libdir/zrythm
Definition zrythm.h:89
@ ZRYTHM_DIR_SYSTEM_ZRYTHM_DATADIR
share/zrythm
Definition zrythm.h:110
@ ZRYTHM_DIR_USER_TOP
Main zrythm directory from gsettings.
Definition zrythm.h:151
@ ZRYTHM_DIR_USER_THEMES_CSS
User CSS themes.
Definition zrythm.h:159
@ ZRYTHM_DIR_SYSTEM_SCRIPTSDIR
Scripts.
Definition zrythm.h:116
@ ZRYTHM_DIR_USER_SCRIPTS
User scripts.
Definition zrythm.h:165
@ ZRYTHM_DIR_SYSTEM_BUNDLED_PLUGINSDIR
libdir/zrythm/lv2
Definition zrythm.h:92
@ ZRYTHM_DIR_SYSTEM_BUNDLED_SOURCEVIEW_LANGUAGE_SPECS_DIR
"gtksourceview-5/language-specs" under "share/zrythm".
Definition zrythm.h:107
@ ZRYTHM_DIR_SYSTEM_PARENT_DATADIR
"share" under ZRYTHM_DIR_SYSTEM_PREFIX.
Definition zrythm.h:82
@ ZRYTHM_DIR_SYSTEM_SAMPLESDIR
Samples.
Definition zrythm.h:113
@ ZRYTHM_DIR_SYSTEM_FONTSDIR
The directory fonts/zrythm under datadir.
Definition zrythm.h:136
@ ZRYTHM_DIR_SYSTEM_THEMES_ICONS_DIR
Icon themes.
Definition zrythm.h:125
@ ZRYTHM_DIR_USER_LOG
Log files.
Definition zrythm.h:168
@ ZRYTHM_DIR_USER_THEMES_ICONS
User icon themes.
Definition zrythm.h:162
@ ZRYTHM_DIR_SYSTEM_TEMPLATES
Project templates.
Definition zrythm.h:139
@ ZRYTHM_DIR_SYSTEM_THEMES_CSS_DIR
CSS themes.
Definition zrythm.h:122
@ ZRYTHM_DIR_SYSTEM_BINDIR
"bin" under ZRYTHM_DIR_SYSTEM_PREFIX.
Definition zrythm.h:79
@ ZRYTHM_DIR_SYSTEM_LOCALEDIR
Localization under "share".
Definition zrythm.h:95
@ ZRYTHM_DIR_SYSTEM_SOURCEVIEW_LANGUAGE_SPECS_DIR
"gtksourceview-5/language-specs" under "share".
Definition zrythm.h:101
Caches for cairo.
Definition cairo.h:29
Chord preset pack manager.
Event manager for the UI.
Definition log.h:24
The PluginManager is responsible for scanning and keeping track of available Plugin's.
Contains all of the info that will be serialized into a project file.
Definition project.h:158
Definition symap.h:36
To be used throughout the program.
Definition zrythm.h:188
bool opening_template
Whether the open file is a template to be used to create a new project from.
Definition zrythm.h:227
Symap * symap
String interner for internal things.
Definition zrythm.h:258
FileManager * file_manager
File manager.
Definition zrythm.h:250
bool have_ui
Log settings.
Definition zrythm.h:289
char ** templates
NULL terminated array of project template absolute paths.
Definition zrythm.h:216
bool debug
In debug mode or not (determined by GSetting).
Definition zrythm.h:271
PCGRand * rand
Random number generator.
Definition zrythm.h:266
char * demo_template
Demo project template used when running for the first time.
Definition zrythm.h:223
RecordingManager * recording_manager
Recording manager.
Definition zrythm.h:247
char * open_filename
Filename to open passed through the command line.
Definition zrythm.h:242
Project * project
Project data.
Definition zrythm.h:209
int undo_stack_len
Undo stack length, used during tests.
Definition zrythm.h:301
GPid pipewire_pid
Process ID for pipewire (used in tests).
Definition zrythm.h:325
char * recent_projects[MAX_RECENT_PROJECTS+1]
+1 to ensure last element is NULL in case full.
Definition zrythm.h:212
bool generating_project
Whether this is a dummy instance used when generating projects.
Definition zrythm.h:282
char * create_project_path
Path to create a project in, including its title.
Definition zrythm.h:233
bool testing
Used when running the tests.
Definition zrythm.h:278
Symap * error_domain_symap
String interner for error domains.
Definition zrythm.h:263
Settings * settings
Application settings.
Definition zrythm.h:200
bool use_pipewire_in_tests
Whether to use pipewire in tests.
Definition zrythm.h:322
ChordPresetPackManager * chord_preset_pack_manager
Chord preset pack manager.
Definition zrythm.h:253
char * version
Cached version (without 'v').
Definition zrythm.h:304
char * testing_dir
Zrythm directory used during unit tests.
Definition zrythm.h:298
PluginManager * plugin_manager
Manages plugins (loading, instantiating, etc.)
Definition zrythm.h:195
bool open_newer_backup
Whether to open a newer backup if found.
Definition zrythm.h:312
bool use_optimized_dsp
Whether to use optimized DSP when available.
Definition zrythm.h:293
bool creating_project
Whether creating a new project, either from a template or blank.
Definition zrythm.h:230
const char * exe_path
argv[0].
Definition zrythm.h:190