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 \
47 (G_UNLIKELY (ZRYTHM && ZRYTHM->testing))
48#define ZRYTHM_GENERATING_PROJECT (ZRYTHM->generating_project)
49#define ZRYTHM_HAVE_UI (ZRYTHM && ZRYTHM->have_ui)
50
51#ifdef HAVE_LSP_DSP
52# define ZRYTHM_USE_OPTIMIZED_DSP \
53 (G_LIKELY (ZRYTHM->use_optimized_dsp))
54#else
55# define ZRYTHM_USE_OPTIMIZED_DSP false
56#endif
57
182
189typedef struct Zrythm
190{
192 const char * exe_path;
193
198
203
214
216 char * recent_projects[MAX_RECENT_PROJECTS + 1];
217 int num_recent_projects;
218
221 char ** templates;
222
230
234
238
242
251
252 EventManager * event_manager;
253
256
259
262
267
272
274 PCGRand * rand;
275
279 bool debug;
280
287
291
293 //Log * log;
294
301 double progress;
302
306
310
311 CairoCaches * cairo_caches;
312
315
318
320 char * version;
321
329
339
342} Zrythm;
343
347extern Zrythm * zrythm;
348
349void
350zrythm_add_to_recent_projects (
351 Zrythm * self,
352 const char * filepath);
353
354void
355zrythm_remove_recent_project (char * filepath);
356
364MALLOC
365char *
366zrythm_get_version (bool with_v);
367
374bool
375zrythm_is_release (bool official);
376
377char *
378zrythm_fetch_latest_release_ver_finish (
379 GAsyncResult * result,
380 GError ** error);
381
387void
389 GAsyncReadyCallback callback,
390 gpointer callback_data);
391
396bool
397zrythm_is_latest_release (const char * remote_latest_release);
398
406void
408 char * buf,
409 bool include_system_info);
410
415char *
417
424char *
426
433char *
435
446char *
448
459char *
460zrythm_get_user_dir (bool force_default);
461
468NONNULL bool
470 Zrythm * self,
471 GError ** error);
472
476NONNULL void
478
486Zrythm *
488 const char * exe_path,
489 bool have_ui,
490 bool testing,
491 bool optimized_dsp);
492
496void
498
503#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:62
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:121
@ ZRYTHM_DIR_USER_GDB
Gdb backtrace files.
Definition zrythm.h:176
@ ZRYTHM_DIR_USER_PROJECTS
Subdirs of ZRYTHM_DIR_USER_TOP.
Definition zrythm.h:156
@ ZRYTHM_DIR_USER_BACKTRACE
Backtraces.
Definition zrythm.h:179
@ ZRYTHM_DIR_USER_PROFILING
Profiling files.
Definition zrythm.h:173
@ ZRYTHM_DIR_SYSTEM_PARENT_LIBDIR
libdir name under ZRYTHM_DIR_SYSTEM_PREFIX.
Definition zrythm.h:88
@ ZRYTHM_DIR_SYSTEM_SPECIAL_LV2_PLUGINS_DIR
Special external Zrythm plugins path (not part of the Zrythm source code).
Definition zrythm.h:135
@ ZRYTHM_DIR_SYSTEM_PREFIX
The prefix, or in the case of windows installer the root dir (C/program files/zrythm),...
Definition zrythm.h:78
@ ZRYTHM_DIR_SYSTEM_ZRYTHM_LIBDIR
libdir/zrythm
Definition zrythm.h:91
@ ZRYTHM_DIR_SYSTEM_ZRYTHM_DATADIR
share/zrythm
Definition zrythm.h:112
@ ZRYTHM_DIR_USER_TOP
Main zrythm directory from gsettings.
Definition zrythm.h:153
@ ZRYTHM_DIR_USER_THEMES_CSS
User CSS themes.
Definition zrythm.h:161
@ ZRYTHM_DIR_SYSTEM_SCRIPTSDIR
Scripts.
Definition zrythm.h:118
@ ZRYTHM_DIR_USER_SCRIPTS
User scripts.
Definition zrythm.h:167
@ ZRYTHM_DIR_SYSTEM_BUNDLED_PLUGINSDIR
libdir/zrythm/lv2
Definition zrythm.h:94
@ ZRYTHM_DIR_SYSTEM_BUNDLED_SOURCEVIEW_LANGUAGE_SPECS_DIR
"gtksourceview-5/language-specs" under "share/zrythm".
Definition zrythm.h:109
@ ZRYTHM_DIR_SYSTEM_PARENT_DATADIR
"share" under ZRYTHM_DIR_SYSTEM_PREFIX.
Definition zrythm.h:84
@ ZRYTHM_DIR_SYSTEM_SAMPLESDIR
Samples.
Definition zrythm.h:115
@ ZRYTHM_DIR_SYSTEM_FONTSDIR
The directory fonts/zrythm under datadir.
Definition zrythm.h:138
@ ZRYTHM_DIR_SYSTEM_THEMES_ICONS_DIR
Icon themes.
Definition zrythm.h:127
@ ZRYTHM_DIR_USER_LOG
Log files.
Definition zrythm.h:170
@ ZRYTHM_DIR_USER_THEMES_ICONS
User icon themes.
Definition zrythm.h:164
@ ZRYTHM_DIR_SYSTEM_TEMPLATES
Project templates.
Definition zrythm.h:141
@ ZRYTHM_DIR_SYSTEM_THEMES_CSS_DIR
CSS themes.
Definition zrythm.h:124
@ ZRYTHM_DIR_SYSTEM_BINDIR
"bin" under ZRYTHM_DIR_SYSTEM_PREFIX.
Definition zrythm.h:81
@ ZRYTHM_DIR_SYSTEM_LOCALEDIR
Localization under "share".
Definition zrythm.h:97
@ ZRYTHM_DIR_SYSTEM_SOURCEVIEW_LANGUAGE_SPECS_DIR
"gtksourceview-5/language-specs" under "share".
Definition zrythm.h:103
Caches for cairo.
Definition cairo.h:27
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:157
Definition symap.h:34
To be used throughout the program.
Definition zrythm.h:190
bool opening_template
Whether the open file is a template to be used to create a new project from.
Definition zrythm.h:233
Symap * symap
String interner for internal things.
Definition zrythm.h:266
FileManager * file_manager
File manager.
Definition zrythm.h:258
bool have_ui
1 if Zrythm has a UI, 0 if headless (eg, when unit-testing).
Definition zrythm.h:305
char ** templates
NULL terminated array of project template absolute paths.
Definition zrythm.h:221
bool debug
In debug mode or not (determined by GSetting).
Definition zrythm.h:279
PCGRand * rand
Random number generator.
Definition zrythm.h:274
char * demo_template
Demo project template used when running for the first time.
Definition zrythm.h:229
RecordingManager * recording_manager
Recording manager.
Definition zrythm.h:255
char * open_filename
Filename to open passed through the command line.
Definition zrythm.h:250
Project * project
Project data.
Definition zrythm.h:213
int undo_stack_len
Undo stack length, used during tests.
Definition zrythm.h:317
GPid pipewire_pid
Process ID for pipewire (used in tests).
Definition zrythm.h:341
double progress
Log settings.
Definition zrythm.h:301
char * recent_projects[MAX_RECENT_PROJECTS+1]
+1 to ensure last element is NULL in case full.
Definition zrythm.h:216
bool generating_project
Whether this is a dummy instance used when generating projects.
Definition zrythm.h:290
char * create_project_path
Path to create a project in, including its title.
Definition zrythm.h:241
bool testing
Used when running the tests.
Definition zrythm.h:286
Symap * error_domain_symap
String interner for error domains.
Definition zrythm.h:271
Settings * settings
Application settings.
Definition zrythm.h:202
bool use_pipewire_in_tests
Whether to use pipewire in tests.
Definition zrythm.h:338
ChordPresetPackManager * chord_preset_pack_manager
Chord preset pack manager.
Definition zrythm.h:261
char * version
Cached version (without 'v').
Definition zrythm.h:320
char * testing_dir
Zrythm directory used during unit tests.
Definition zrythm.h:314
PluginManager * plugin_manager
Manages plugins (loading, instantiating, etc.)
Definition zrythm.h:197
bool open_newer_backup
Whether to open a newer backup if found.
Definition zrythm.h:328
bool use_optimized_dsp
Whether to use optimized DSP when available.
Definition zrythm.h:309
bool creating_project
Whether creating a new project, either from a template or blank.
Definition zrythm.h:237
const char * exe_path
argv[0].
Definition zrythm.h:192