Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
engine.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2018-2023 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-FileCopyrightText: © 2020 Ryan Gonzalez <rymg19 at gmail dot com>
3// SPDX-License-Identifier: LicenseRef-ZrythmLicense
4
11#ifndef __AUDIO_ENGINE_H__
12#define __AUDIO_ENGINE_H__
13
14#include "zrythm-config.h"
15
16#include "dsp/control_room.h"
17#include "dsp/exporter.h"
18#include "dsp/ext_port.h"
20#include "dsp/pan.h"
21#include "dsp/pool.h"
23#include "dsp/transport.h"
24#include "utils/types.h"
25
26#include "zix/sem.h"
27
28#ifdef HAVE_JACK
29# include "weak_libjack.h"
30#endif
31
32#ifdef HAVE_PULSEAUDIO
33# include <pulse/pulseaudio.h>
34#endif
35
36#ifdef HAVE_PORT_AUDIO
37# include <portaudio.h>
38#endif
39
40#ifdef HAVE_ALSA
41# include <alsa/asoundlib.h>
42#endif
43
44#ifdef HAVE_SDL
45# include <SDL2/SDL_audio.h>
46#endif
47
48#ifdef HAVE_RTAUDIO
49# include <rtaudio_c.h>
50#endif
51
52typedef struct StereoPorts StereoPorts;
53typedef struct Port Port;
54typedef struct Channel Channel;
55typedef struct Plugin Plugin;
56typedef struct Tracklist Tracklist;
57typedef struct ExtPort ExtPort;
58typedef struct MidiMappings MidiMappings;
59typedef struct WindowsMmeDevice WindowsMmeDevice;
60typedef struct Router Router;
61typedef struct Metronome Metronome;
62typedef struct Project Project;
64typedef struct ObjectPool ObjectPool;
65typedef struct MPMCQueue MPMCQueue;
66
73#define AUDIO_ENGINE_SCHEMA_VERSION 2
74
75#define BLOCK_LENGTH 4096 // should be set by backend
76#define MIDI_BUF_SIZE 1024 // should be set by backend
77
78#define MIDI_IN_NUM_EVENTS AUDIO_ENGINE->midi_in->midi_events->num_events
79
80#define AUDIO_ENGINE (PROJECT->audio_engine)
81#define MANUAL_PRESS_EVENTS \
82 (AUDIO_ENGINE->midi_editor_manual_press->midi_events)
83
84#define DENORMAL_PREVENTION_VAL (AUDIO_ENGINE->denormal_prevention_val)
85
86#define engine_is_in_active_project(self) (self->project == PROJECT)
87
90#define engine_set_run(engine, _run) g_atomic_int_set (&(engine)->run, _run)
91#define engine_get_run(engine) g_atomic_int_get (&(engine)->run)
92
93#define engine_has_handled_buffer_size_change(engine) \
94 ((engine)->audio_backend != AUDIO_BACKEND_JACK || \
95 ((engine)->audio_backend == AUDIO_BACKEND_JACK && \
96 g_atomic_int_get (&(engine)->handled_jack_buffer_size_change) == 1))
97
98#define ENGINE_MAX_EVENTS 100
99
100#define engine_queue_push_back_event(q, x) mpmc_queue_push_back (q, (void *) x)
101
102#define engine_queue_dequeue_event(q, x) mpmc_queue_dequeue (q, (void *) x)
103
107#define ENGINE_EVENTS_PUSH(et, _arg, _uint_arg, _float_arg) \
108 if (true) \
109 { \
110 AudioEngineEvent * _ev = \
111 (AudioEngineEvent *) object_pool_get (AUDIO_ENGINE->ev_pool); \
112 _ev->file = __FILE__; \
113 _ev->func = __func__; \
114 _ev->lineno = __LINE__; \
115 _ev->type = et; \
116 _ev->arg = (void *) _arg; \
117 _ev->uint_arg = _uint_arg; \
118 _ev->float_arg = _float_arg; \
119 if (zrythm_app->gtk_thread == g_thread_self ()) \
120 { \
121 _ev->backtrace = backtrace_get ("", 40, false); \
122 g_debug ( \
123 "pushing engine event " #et " (%s:%d) uint: %u | float: %f", \
124 __func__, __LINE__, _uint_arg, _float_arg); \
125 } \
126 engine_queue_push_back_event (AUDIO_ENGINE->ev_queue, _ev); \
127 }
128
133{
134 AUDIO_ENGINE_EVENT_BUFFER_SIZE_CHANGE,
135 AUDIO_ENGINE_EVENT_SAMPLE_RATE_CHANGE,
137
141typedef struct AudioEngineEvent
142{
144 void * arg;
145 uint32_t uint_arg;
146 float float_arg;
147 const char * file;
148 const char * func;
149 int lineno;
150 char * backtrace;
152
157{
158 AUDIO_ENGINE_BUFFER_SIZE_16,
159 AUDIO_ENGINE_BUFFER_SIZE_32,
160 AUDIO_ENGINE_BUFFER_SIZE_64,
161 AUDIO_ENGINE_BUFFER_SIZE_128,
162 AUDIO_ENGINE_BUFFER_SIZE_256,
163 AUDIO_ENGINE_BUFFER_SIZE_512,
164 AUDIO_ENGINE_BUFFER_SIZE_1024,
165 AUDIO_ENGINE_BUFFER_SIZE_2048,
166 AUDIO_ENGINE_BUFFER_SIZE_4096,
167 NUM_AUDIO_ENGINE_BUFFER_SIZES,
169
170static const char * buffer_size_str[] = {
171 "16", "32", "64", "128", "256",
172 "512", N_ ("1,024"), N_ ("2,048"), N_ ("4,096"),
173};
174
175static inline const char *
176engine_buffer_size_to_string (AudioEngineBufferSize buf_size)
177{
178 return buffer_size_str[buf_size];
179}
180
185{
186 AUDIO_ENGINE_SAMPLERATE_22050,
187 AUDIO_ENGINE_SAMPLERATE_32000,
188 AUDIO_ENGINE_SAMPLERATE_44100,
189 AUDIO_ENGINE_SAMPLERATE_48000,
190 AUDIO_ENGINE_SAMPLERATE_88200,
191 AUDIO_ENGINE_SAMPLERATE_96000,
192 AUDIO_ENGINE_SAMPLERATE_192000,
193 NUM_AUDIO_ENGINE_SAMPLERATES,
195
196static const char * sample_rate_str[] = {
197 N_ ("22,050"), N_ ("32,000"), N_ ("44,100"), N_ ("48,000"),
198 N_ ("88,200"), N_ ("96,000"), N_ ("192,000"),
199};
200
201static inline const char *
202engine_sample_rate_to_string (AudioEngineSamplerate sample_rate)
203{
204 return sample_rate_str[sample_rate];
205}
206
207typedef enum AudioBackend
208{
209 AUDIO_BACKEND_DUMMY,
210 AUDIO_BACKEND_DUMMY_LIBSOUNDIO,
211 AUDIO_BACKEND_ALSA,
212 AUDIO_BACKEND_ALSA_LIBSOUNDIO,
213 AUDIO_BACKEND_ALSA_RTAUDIO,
214 AUDIO_BACKEND_JACK,
215 AUDIO_BACKEND_JACK_LIBSOUNDIO,
216 AUDIO_BACKEND_JACK_RTAUDIO,
217 AUDIO_BACKEND_PULSEAUDIO,
218 AUDIO_BACKEND_PULSEAUDIO_LIBSOUNDIO,
219 AUDIO_BACKEND_PULSEAUDIO_RTAUDIO,
220 AUDIO_BACKEND_COREAUDIO_LIBSOUNDIO,
221 AUDIO_BACKEND_COREAUDIO_RTAUDIO,
222 AUDIO_BACKEND_SDL,
223 AUDIO_BACKEND_WASAPI_LIBSOUNDIO,
224 AUDIO_BACKEND_WASAPI_RTAUDIO,
225 AUDIO_BACKEND_ASIO_RTAUDIO,
226 NUM_AUDIO_BACKENDS,
227} AudioBackend;
228
229static inline bool
230audio_backend_is_rtaudio (AudioBackend backend)
231{
232 return backend == AUDIO_BACKEND_ALSA_RTAUDIO
233 || backend == AUDIO_BACKEND_JACK_RTAUDIO
234 || backend == AUDIO_BACKEND_PULSEAUDIO_RTAUDIO
235 || backend == AUDIO_BACKEND_COREAUDIO_RTAUDIO
236 || backend == AUDIO_BACKEND_WASAPI_RTAUDIO
237 || backend == AUDIO_BACKEND_ASIO_RTAUDIO;
238}
239
240__attribute__ ((unused)) static const char * audio_backend_str[] = {
241 /* TRANSLATORS: Dummy backend */
242 N_ ("Dummy"), N_ ("Dummy (libsoundio)"),
243 "ALSA (not working)", "ALSA (libsoundio)",
244 "ALSA (rtaudio)", "JACK",
245 "JACK (libsoundio)", "JACK (rtaudio)",
246 "PulseAudio", "PulseAudio (libsoundio)",
247 "PulseAudio (rtaudio)", "CoreAudio (libsoundio)",
248 "CoreAudio (rtaudio)", "SDL",
249 "WASAPI (libsoundio)", "WASAPI (rtaudio)",
250 "ASIO (rtaudio)",
251};
252
273
274typedef enum MidiBackend
275{
276 MIDI_BACKEND_DUMMY,
277 MIDI_BACKEND_ALSA,
278 MIDI_BACKEND_ALSA_RTMIDI,
279 MIDI_BACKEND_JACK,
280 MIDI_BACKEND_JACK_RTMIDI,
281 MIDI_BACKEND_WINDOWS_MME,
282 MIDI_BACKEND_WINDOWS_MME_RTMIDI,
283 MIDI_BACKEND_COREMIDI_RTMIDI,
284 NUM_MIDI_BACKENDS,
285} MidiBackend;
286
287static inline bool
288midi_backend_is_rtmidi (MidiBackend backend)
289{
290 return backend == MIDI_BACKEND_ALSA_RTMIDI || backend == MIDI_BACKEND_JACK_RTMIDI
291 || backend == MIDI_BACKEND_WINDOWS_MME_RTMIDI
292 || backend == MIDI_BACKEND_COREMIDI_RTMIDI;
293}
294
295static const char * midi_backend_str[] = {
296 /* TRANSLATORS: Dummy backend */
297 N_ ("Dummy"),
298 N_ ("ALSA Sequencer (not working)"),
299 N_ ("ALSA Sequencer (rtmidi)"),
300 "JACK MIDI",
301 "JACK MIDI (rtmidi)",
302 "Windows MME",
303 "Windows MME (rtmidi)",
304 "CoreMIDI (rtmidi)",
305};
306
307typedef enum AudioEngineJackTransportType
308{
309 AUDIO_ENGINE_JACK_TIMEBASE_MASTER,
310 AUDIO_ENGINE_JACK_TRANSPORT_CLIENT,
311 AUDIO_ENGINE_NO_JACK_TRANSPORT,
312} AudioEngineJackTransportType;
313
314static const cyaml_strval_t jack_transport_type_strings[] = {
315 {"Timebase master", AUDIO_ENGINE_JACK_TIMEBASE_MASTER },
316 { "Transport client", AUDIO_ENGINE_JACK_TRANSPORT_CLIENT},
317 { "No JACK transport", AUDIO_ENGINE_NO_JACK_TRANSPORT },
318};
319
321{
324
326 float bpm;
327
330
331 /* - below are used as cache to avoid re-calculations - */
332
334 int32_t bar;
335
337 int32_t beat;
338
340 int32_t sixteenth;
341
344
348
351
354
358
362typedef struct AudioEngine
363{
364 int schema_version;
365
371 uint_fast64_t cycle;
372
373#ifdef HAVE_JACK
375 jack_client_t * client;
376#else
377 void * client;
378#endif
379
388
393 AudioEngineJackTransportType transport_type;
394
396 AudioBackend audio_backend;
397
399 MidiBackend midi_backend;
400
403
406
409
412
418
421
424
427
430
437
444
447
450
458
466
474
475#if 0
481 gint64 last_midi_activity;
482#endif
483
496
504
512
518
520 volatile gint run;
521
524
527
529 volatile gint panic;
530
531 //ZixSem alsa_callback_start;
532
533 /* ----------- ALSA --------------- */
534#ifdef HAVE_ALSA
536 snd_pcm_t * playback_handle;
537 snd_seq_t * seq_handle;
538 snd_pcm_hw_params_t * hw_params;
539 snd_pcm_sw_params_t * sw_params;
540
549 //MidiEvents alsa_midi_events;
550
553 //ZixSem alsa_midi_events_sem;
554#else
555 void * playback_handle;
556 void * seq_handle;
557 void * hw_params;
558 void * sw_params;
559#endif
560
563
564 /* ------------------------------- */
565
568
572
573#ifdef HAVE_PORT_AUDIO
574 PaStream * pa_stream;
575#else
576 void * pa_stream;
577#endif
578
586 float * pa_out_buf;
587
588#ifdef _WOE32
590 WindowsMmeDevice * mme_in_devs[1024];
591 int num_mme_in_devs;
592 WindowsMmeDevice * mme_out_devs[1024];
593 int num_mme_out_devs;
594#else
595 void * mme_in_devs[1024];
596 int num_mme_in_devs;
597 void * mme_out_devs[1024];
598 int num_mme_out_devs;
599#endif
600
601#ifdef HAVE_SDL
602 SDL_AudioDeviceID dev;
603#else
604 uint32_t sdl_dev;
605#endif
606
607#ifdef HAVE_RTAUDIO
608 rtaudio_t rtaudio;
609#else
610 void * rtaudio;
611#endif
612
613#ifdef HAVE_PULSEAUDIO
614 pa_threaded_mainloop * pulse_mainloop;
615 pa_context * pulse_context;
616 pa_stream * pulse_stream;
617#else
618 void * pulse_mainloop;
619 void * pulse_context;
620 void * pulse_stream;
621#endif
622 gboolean pulse_notified_underflow;
623
628
631
636
637 /* note: these 2 are ignored at the moment */
642
645
649
653
657
660
663
668
669 SampleProcessor * sample_processor;
670
674
677
686
697 float denormal_prevention_val;
698
699 /* --- trial version flags --- */
700
704
708
709 /* --- end trial version flags --- */
710
719
721 BounceStep bounce_step;
722
726
729
730 /* --- events --- */
731
744
750
753
756
759
762
763 /* --- end events --- */
764
766 volatile gint cycle_running;
767
770
772 bool setup;
773
776
779
786
792
797
802
804
805static const cyaml_schema_field_t engine_fields_schema[] = {
806 YAML_FIELD_INT (AudioEngine, schema_version),
807 YAML_FIELD_ENUM (AudioEngine, transport_type, jack_transport_type_strings),
808 YAML_FIELD_INT (AudioEngine, sample_rate),
809 YAML_FIELD_FLOAT (AudioEngine, frames_per_tick),
810 YAML_FIELD_MAPPING_PTR (AudioEngine, monitor_out, stereo_ports_fields_schema),
811 YAML_FIELD_MAPPING_PTR (AudioEngine, midi_editor_manual_press, port_fields_schema),
812 YAML_FIELD_MAPPING_PTR (AudioEngine, midi_in, port_fields_schema),
813 YAML_FIELD_MAPPING_PTR (AudioEngine, transport, transport_fields_schema),
814 YAML_FIELD_MAPPING_PTR (AudioEngine, pool, audio_pool_fields_schema),
815 YAML_FIELD_MAPPING_PTR (AudioEngine, control_room, control_room_fields_schema),
818 sample_processor,
819 sample_processor_fields_schema),
822 hw_in_processor,
823 hardware_processor_fields_schema),
826 hw_out_processor,
827 hardware_processor_fields_schema),
828
829 CYAML_FIELD_END
830};
831
832static const cyaml_schema_value_t engine_schema = {
833 YAML_VALUE_PTR (AudioEngine, engine_fields_schema),
834};
835
836void
837engine_realloc_port_buffers (AudioEngine * self, nframes_t buf_size);
838
839COLD NONNULL_ARGS (
840 1) void engine_init_loaded (AudioEngine * self, Project * project);
841
848COLD WARN_UNUSED_RESULT AudioEngine *
849engine_new (Project * project);
850
851typedef struct EngineState
852{
860
866void
868 AudioEngine * self,
869 EngineState * state,
870 bool force_pause,
871 bool with_fadeout);
872
873void
874engine_resume (AudioEngine * self, EngineState * state);
875
881void
883
884void
885engine_append_ports (AudioEngine * self, GPtrArray * ports);
886
891void
893
898void
900
907COLD void
908engine_activate (AudioEngine * self, bool activate);
909
921void
923 AudioEngine * self,
924 const int beats_per_bar,
925 const bpm_t bpm,
926 const sample_rate_t sample_rate,
927 bool thread_check,
928 bool update_from_ticks,
929 bool bpm_change);
930
936int
938
947NONNULL HOT bool
949
956NONNULL HOT int
957engine_process (AudioEngine * self, const nframes_t total_frames_to_process);
958
967NONNULL HOT void
969 AudioEngine * self,
970 const nframes_t roll_nframes,
971 const nframes_t nframes);
972
977NONNULL void
979
984int
986
991int
993
1002void
1003engine_set_buffer_size (AudioEngine * self, uint32_t buf_size);
1004
1009#define engine_is_port_own(self, port) \
1010 (port == MONITOR_FADER->stereo_in->l || port == MONITOR_FADER->stereo_in->r \
1011 || port == MONITOR_FADER->stereo_out->l \
1012 || port == MONITOR_FADER->stereo_out->r)
1013
1017const char *
1018engine_audio_backend_to_string (AudioBackend backend);
1019
1020AudioBackend
1021engine_audio_backend_from_string (const char * str);
1022
1026static inline const char *
1027engine_midi_backend_to_string (MidiBackend backend)
1028{
1029 return midi_backend_str[backend];
1030}
1031
1032MidiBackend
1033engine_midi_backend_from_string (const char * str);
1034
1039void
1041
1050void
1051engine_set_default_backends (bool reset_to_dummy);
1052
1058COLD NONNULL AudioEngine *
1060
1064COLD NONNULL void
1066
1071#endif
The control room backend.
External ports.
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
AudioEngineSamplerate
Samplerates to be used in comboboxes.
Definition engine.h:185
AudioEngineEventType
Audio engine event type.
Definition engine.h:133
void engine_set_default_backends(bool reset_to_dummy)
Detects the best backends on the system and sets them to GSettings.
void engine_setup(AudioEngine *self)
Sets up the audio engine after the project is initialized/loaded.
void engine_wait_for_pause(AudioEngine *self, EngineState *state, bool force_pause, bool with_fadeout)
AudioEngineBufferSize
Buffer sizes to be used in combo boxes.
Definition engine.h:157
const char * engine_audio_backend_to_string(AudioBackend backend)
Returns the audio backend as a string.
COLD WARN_UNUSED_RESULT AudioEngine * engine_new(Project *project)
Create a new audio engine.
int engine_samplerate_enum_to_int(AudioEngineSamplerate samplerate)
Returns the int value corresponding to the given AudioEngineSamplerate.
void engine_pre_setup(AudioEngine *self)
Sets up the audio engine before the project is initialized/loaded.
void engine_wait_n_cycles(AudioEngine *self, int n)
Waits for n processing cycles to finish.
NONNULL HOT void engine_post_process(AudioEngine *self, const nframes_t roll_nframes, const nframes_t nframes)
To be called after processing for common logic.
NONNULL HOT bool engine_process_prepare(AudioEngine *self, nframes_t nframes)
To be called by each implementation to prepare the structures before processing.
COLD NONNULL void engine_free(AudioEngine *self)
Closes any connections and free's data.
void engine_reset_bounce_mode(AudioEngine *self)
Reset the bounce mode on the engine, all tracks and regions to OFF.
NONNULL void engine_fill_out_bufs(AudioEngine *self, const nframes_t nframes)
Called to fill in the external buffers at the end of the processing cycle.
BounceMode
Mode used when bouncing, either during exporting or when bouncing tracks or regions to audio.
Definition engine.h:258
COLD void engine_activate(AudioEngine *self, bool activate)
Activates the audio engine to start processing and receiving events.
void engine_update_frames_per_tick(AudioEngine *self, const int beats_per_bar, const bpm_t bpm, const sample_rate_t sample_rate, bool thread_check, bool update_from_ticks, bool bpm_change)
Updates frames per tick based on the time sig, the BPM, and the sample rate.
COLD NONNULL AudioEngine * engine_clone(const AudioEngine *src)
Clones the audio engine.
void engine_set_buffer_size(AudioEngine *self, uint32_t buf_size)
Request the backend to set the buffer size.
int engine_process_events(AudioEngine *self)
GSourceFunc to be added using idle add.
NONNULL HOT int engine_process(AudioEngine *self, const nframes_t total_frames_to_process)
Processes current cycle.
int engine_buffer_size_enum_to_int(AudioEngineBufferSize buffer_size)
Returns the int value corresponding to the given AudioEngineBufferSize.
@ BOUNCE_OFF
Don't bounce.
Definition engine.h:260
@ BOUNCE_INHERIT
Bounce if parent is bouncing.
Definition engine.h:271
@ BOUNCE_ON
Bounce.
Definition engine.h:263
uint32_t sample_rate_t
Sample rate.
Definition types.h:37
float bpm_t
The BPM type.
Definition types.h:49
uint32_t nframes_t
Frame count.
Definition types.h:34
uint8_t midi_byte_t
MIDI byte.
Definition types.h:31
#define YAML_FIELD_MAPPING_PTR(owner, member, schema)
Mapping pointer to a struct.
Definition yaml.h:37
#define YAML_VALUE_PTR(cc, fields_schema)
Schema to be used as a pointer.
Definition yaml.h:202
Hardware processor for the routing graph.
Panning mono sources.
PanAlgorithm
See https://www.harmonycentral.com/articles/the-truth-about-panning-laws.
Definition pan.h:52
PanLaw
These are only useful when changing mono to stereo.
Definition pan.h:29
Audio file pool.
Sample processor.
Audio engine event.
Definition engine.h:142
int32_t beat
Current beat (within bar).
Definition engine.h:337
double tick_within_beat
Current tick-within-beat.
Definition engine.h:350
int32_t sixteenth_within_bar
Current sixteenth (within bar).
Definition engine.h:343
double tick_within_bar
Current tick (within bar).
Definition engine.h:353
int32_t ninetysixth_notes
Total 1/96th notes completed up to current pos.
Definition engine.h:356
int32_t sixteenth_within_song
Current sixteenth (within song, ie, total sixteenths).
Definition engine.h:347
bool is_rolling
Transport is rolling.
Definition engine.h:323
double playhead_ticks
Exact playhead position (in ticks).
Definition engine.h:329
int32_t bar
Current bar.
Definition engine.h:334
int32_t sixteenth
Current sixteenth (within beat).
Definition engine.h:340
The audio engine.
Definition engine.h:363
HardwareProcessor * hw_in_processor
Input device processor.
Definition engine.h:426
AudioEnginePositionInfo pos_nfo_at_end
Expected position info at the end of the current cycle.
Definition engine.h:801
double ticks_per_frame
Reciprocal of AudioEngine::frames_per_tick.
Definition engine.h:417
double frames_per_tick
Number of frames/samples per tick.
Definition engine.h:411
bool bounce_with_parents
Whether currently bouncing with parents (cache).
Definition engine.h:725
nframes_t remaining_latency_preroll
When first set, it is equal to the max playback latency of all initial trigger nodes.
Definition engine.h:667
nframes_t nframes
Number of frames/samples in the current cycle, per channel.
Definition engine.h:511
size_t midi_buf_size
Size of MIDI port buffers in bytes.
Definition engine.h:405
volatile gint cycle_running
Whether the cycle is currently running.
Definition engine.h:766
ControlRoom * control_room
The ControlRoom.
Definition engine.h:446
Port * midi_editor_manual_press
Manual note press events from the piano roll.
Definition engine.h:495
gint64 last_timestamp_start
Timestamp at start of previous cycle.
Definition engine.h:659
int capture_cc
To be set to 1 when the CC from the Midi in port should be captured.
Definition engine.h:673
bool setup
Whether the engine is already set up.
Definition engine.h:772
PanLaw pan_law
Pan law.
Definition engine.h:639
volatile gint run
Ok to process or not.
Definition engine.h:520
gint64 last_events_process_started
Time last event processing started.
Definition engine.h:758
gint64 zrythm_start_time
Time at start to keep track if trial limit is reached.
Definition engine.h:703
volatile gint filled_stereo_out_bufs
Flag used when processing in some backends.
Definition engine.h:567
gint handled_jack_buffer_size_change
Whether pending jack buffer change was handled (buffers reallocated).
Definition engine.h:387
gint64 timestamp_start
Timestamp at the start of the current cycle.
Definition engine.h:652
AudioEnginePositionInfo pos_nfo_before
Position info at the end of the previous cycle before moving the transport.
Definition engine.h:791
int processing_events
Whether currently processing events.
Definition engine.h:755
StereoPorts * dummy_input
Used during tests to pass input data for recording.
Definition engine.h:457
Port * midi_in
Port used for receiving MIDI in messages for binding CC and other non-recording purposes.
Definition engine.h:503
AudioBackend audio_backend
Current audio backend.
Definition engine.h:396
sample_rate_t sample_rate
Sample rate.
Definition engine.h:408
nframes_t block_length
Audio buffer size (block length), per channel.
Definition engine.h:402
AudioPool * pool
Audio file pool.
Definition engine.h:449
AudioEngineJackTransportType transport_type
Whether transport master/client or no connection with jack transport.
Definition engine.h:393
Metronome * metronome
The metronome.
Definition engine.h:728
int limit_reached
Flag to keep track of the first time the limit is reached.
Definition engine.h:707
MPMCQueue * ev_queue
Event queue.
Definition engine.h:743
bool updating_frames_per_tick
True while updating frames per tick.
Definition engine.h:785
gint exporting
1 if currently exporting.
Definition engine.h:526
MidiBackend midi_backend
Current MIDI backend.
Definition engine.h:399
bool preparing_to_export
To be set to true when preparing to export.
Definition engine.h:523
gint64 last_xrun_notification
Last time an XRUN notification was shown.
Definition engine.h:685
StereoPorts * monitor_out
Monitor - these should be the last ports in the signal chain.
Definition engine.h:465
Router * router
The processing graph router.
Definition engine.h:423
gint preparing_for_process
Flag used to check if we are inside engine_process_prepare().
Definition engine.h:571
gint64 last_events_processed
Time last event processing completed.
Definition engine.h:761
BounceMode bounce_mode
If this is on, only tracks/regions marked as "for bounce" will be allowed to make sound.
Definition engine.h:718
guint process_source_id
ID of the event processing source func.
Definition engine.h:752
BounceStep bounce_step
Bounce step cache.
Definition engine.h:721
ObjectPool * ev_pool
Object pool of event structs to avoid allocation.
Definition engine.h:749
ZixSem port_operation_lock
Semaphore for blocking DSP while a plugin and its ports are deleted.
Definition engine.h:517
AudioEnginePositionInfo pos_nfo_current
Position info at the start of the current cycle.
Definition engine.h:796
Project * project
Pointer to owner project, if any.
Definition engine.h:778
float * pa_out_buf
Port Audio output buffer.
Definition engine.h:586
gint64 max_time_taken
Max time taken to process in the last few cycles.
Definition engine.h:648
float * alsa_out_buf
ALSA audio buffer.
Definition engine.h:562
Transport * transport
Timeline metadata like BPM, time signature, etc.
Definition engine.h:635
gint64 last_timestamp_end
Timestamp at end of previous cycle.
Definition engine.h:662
bool denormal_prevention_val_positive
Whether the denormal prevention value (1e-12 ~ 1e-20) is positive.
Definition engine.h:696
Port * midi_clock_out
MIDI Clock output.
Definition engine.h:443
GThread * dummy_audio_thread
Dummy audio DSP processing thread.
Definition engine.h:627
uint_fast64_t cycle
Cycle count to know which cycle we are in.
Definition engine.h:371
gint64 last_time_taken
Time taken to process in the last cycle.
Definition engine.h:644
PanAlgorithm pan_algo
Pan algorithm.
Definition engine.h:641
bool pre_setup
Whether the engine is already pre-set up.
Definition engine.h:769
Port * midi_clock_in
MIDI Clock input TODO.
Definition engine.h:436
midi_byte_t last_cc[3]
Last MIDI CC captured.
Definition engine.h:676
volatile gint panic
Send note off MIDI everywhere.
Definition engine.h:529
gint64 timestamp_end
Expected timestamp at the end of the current cycle.
Definition engine.h:656
int stop_dummy_audio_thread
Set to 1 to stop the dummy audio thread.
Definition engine.h:630
HardwareProcessor * hw_out_processor
Output device processor.
Definition engine.h:429
int trigger_midi_activity
Flag to tell the UI that this channel had MIDI activity.
Definition engine.h:473
int buf_size_set
True iff buffer size callback fired.
Definition engine.h:420
bool activated
Whether the engine is currently activated.
Definition engine.h:775
An audio pool is a pool of audio files and their corresponding float arrays in memory that are refere...
Definition pool.h:39
A Channel is part of a Track (excluding Tracks that don't have Channels) and contains information rel...
Definition channel.h:61
The control room allows to specify how Listen will work on each Channel and to set overall volume aft...
bool looping
Transport loop.
Definition engine.h:858
int running
Engine running.
Definition engine.h:854
bool playing
Playback.
Definition engine.h:856
External port.
Definition ext_port.h:77
Hardware processor.
Multiple Producer Multiple Consumer lock-free queue.
Definition mpmc_queue.h:69
Metronome settings.
Definition metronome.h:41
All MIDI mappings in Zrythm.
The base plugin Inheriting plugins must have this as a child.
Definition plugin.h:71
Must ONLY be created via port_new()
Definition port.h:140
Contains all of the info that will be serialized into a project file.
Definition project.h:157
A processor to be used in the routing graph for playing samples independent of the timeline.
L & R port, for convenience.
Definition port.h:568
The Tracklist contains all the tracks in the Project.
Definition tracklist.h:63
The transport.
Definition transport.h:192
Transport API.
Custom types.