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 \
79 AUDIO_ENGINE->midi_in->midi_events->num_events
80
81#define AUDIO_ENGINE (PROJECT->audio_engine)
82#define MANUAL_PRESS_EVENTS \
83 (AUDIO_ENGINE->midi_editor_manual_press->midi_events)
84
85#define DENORMAL_PREVENTION_VAL \
86 (AUDIO_ENGINE->denormal_prevention_val)
87
88#define engine_is_in_active_project(self) \
89 (self->project == PROJECT)
90
93#define engine_set_run(engine, _run) \
94 g_atomic_int_set (&(engine)->run, _run)
95#define engine_get_run(engine) \
96 g_atomic_int_get (&(engine)->run)
97
98#define engine_has_handled_buffer_size_change(engine) \
99 ((engine)->audio_backend != AUDIO_BACKEND_JACK || \
100 ((engine)->audio_backend == AUDIO_BACKEND_JACK && \
101 g_atomic_int_get (&(engine)->handled_jack_buffer_size_change) == 1))
102
103#define ENGINE_MAX_EVENTS 100
104
105#define engine_queue_push_back_event(q, x) \
106 mpmc_queue_push_back (q, (void *) x)
107
108#define engine_queue_dequeue_event(q, x) \
109 mpmc_queue_dequeue (q, (void *) x)
110
114#define ENGINE_EVENTS_PUSH(et, _arg, _uint_arg, _float_arg) \
115 if (true) \
116 { \
117 AudioEngineEvent * _ev = (AudioEngineEvent *) \
118 object_pool_get (AUDIO_ENGINE->ev_pool); \
119 _ev->file = __FILE__; \
120 _ev->func = __func__; \
121 _ev->lineno = __LINE__; \
122 _ev->type = et; \
123 _ev->arg = (void *) _arg; \
124 _ev->uint_arg = _uint_arg; \
125 _ev->float_arg = _float_arg; \
126 if (zrythm_app->gtk_thread == g_thread_self ()) \
127 { \
128 _ev->backtrace = backtrace_get ("", 40, false); \
129 g_debug ( \
130 "pushing engine event " #et \
131 " (%s:%d) uint: %u | float: %f", \
132 __func__, __LINE__, _uint_arg, _float_arg); \
133 } \
134 engine_queue_push_back_event ( \
135 AUDIO_ENGINE->ev_queue, _ev); \
136 }
137
142{
143 AUDIO_ENGINE_EVENT_BUFFER_SIZE_CHANGE,
144 AUDIO_ENGINE_EVENT_SAMPLE_RATE_CHANGE,
146
150typedef struct AudioEngineEvent
151{
153 void * arg;
154 uint32_t uint_arg;
155 float float_arg;
156 const char * file;
157 const char * func;
158 int lineno;
159 char * backtrace;
161
166{
167 AUDIO_ENGINE_BUFFER_SIZE_16,
168 AUDIO_ENGINE_BUFFER_SIZE_32,
169 AUDIO_ENGINE_BUFFER_SIZE_64,
170 AUDIO_ENGINE_BUFFER_SIZE_128,
171 AUDIO_ENGINE_BUFFER_SIZE_256,
172 AUDIO_ENGINE_BUFFER_SIZE_512,
173 AUDIO_ENGINE_BUFFER_SIZE_1024,
174 AUDIO_ENGINE_BUFFER_SIZE_2048,
175 AUDIO_ENGINE_BUFFER_SIZE_4096,
176 NUM_AUDIO_ENGINE_BUFFER_SIZES,
178
179static const char * buffer_size_str[] = {
180 "16", "32", "64", "128", "256",
181 "512", N_ ("1,024"), N_ ("2,048"), N_ ("4,096"),
182};
183
184static inline const char *
185engine_buffer_size_to_string (AudioEngineBufferSize buf_size)
186{
187 return buffer_size_str[buf_size];
188}
189
194{
195 AUDIO_ENGINE_SAMPLERATE_22050,
196 AUDIO_ENGINE_SAMPLERATE_32000,
197 AUDIO_ENGINE_SAMPLERATE_44100,
198 AUDIO_ENGINE_SAMPLERATE_48000,
199 AUDIO_ENGINE_SAMPLERATE_88200,
200 AUDIO_ENGINE_SAMPLERATE_96000,
201 AUDIO_ENGINE_SAMPLERATE_192000,
202 NUM_AUDIO_ENGINE_SAMPLERATES,
204
205static const char * sample_rate_str[] = {
206 N_ ("22,050"), N_ ("32,000"), N_ ("44,100"), N_ ("48,000"),
207 N_ ("88,200"), N_ ("96,000"), N_ ("192,000"),
208};
209
210static inline const char *
211engine_sample_rate_to_string (
212 AudioEngineSamplerate sample_rate)
213{
214 return sample_rate_str[sample_rate];
215}
216
217typedef enum AudioBackend
218{
219 AUDIO_BACKEND_DUMMY,
220 AUDIO_BACKEND_DUMMY_LIBSOUNDIO,
221 AUDIO_BACKEND_ALSA,
222 AUDIO_BACKEND_ALSA_LIBSOUNDIO,
223 AUDIO_BACKEND_ALSA_RTAUDIO,
224 AUDIO_BACKEND_JACK,
225 AUDIO_BACKEND_JACK_LIBSOUNDIO,
226 AUDIO_BACKEND_JACK_RTAUDIO,
227 AUDIO_BACKEND_PULSEAUDIO,
228 AUDIO_BACKEND_PULSEAUDIO_LIBSOUNDIO,
229 AUDIO_BACKEND_PULSEAUDIO_RTAUDIO,
230 AUDIO_BACKEND_COREAUDIO_LIBSOUNDIO,
231 AUDIO_BACKEND_COREAUDIO_RTAUDIO,
232 AUDIO_BACKEND_SDL,
233 AUDIO_BACKEND_WASAPI_LIBSOUNDIO,
234 AUDIO_BACKEND_WASAPI_RTAUDIO,
235 AUDIO_BACKEND_ASIO_RTAUDIO,
236 NUM_AUDIO_BACKENDS,
237} AudioBackend;
238
239static inline bool
240audio_backend_is_rtaudio (AudioBackend backend)
241{
242 return backend == AUDIO_BACKEND_ALSA_RTAUDIO
243 || backend == AUDIO_BACKEND_JACK_RTAUDIO
244 || backend == AUDIO_BACKEND_PULSEAUDIO_RTAUDIO
245 || backend == AUDIO_BACKEND_COREAUDIO_RTAUDIO
246 || backend == AUDIO_BACKEND_WASAPI_RTAUDIO
247 || backend == AUDIO_BACKEND_ASIO_RTAUDIO;
248}
249
250__attribute__ ((
251 unused)) static const char * audio_backend_str[] = {
252 /* TRANSLATORS: Dummy backend */
253 N_ ("Dummy"), N_ ("Dummy (libsoundio)"),
254 "ALSA (not working)", "ALSA (libsoundio)",
255 "ALSA (rtaudio)", "JACK",
256 "JACK (libsoundio)", "JACK (rtaudio)",
257 "PulseAudio", "PulseAudio (libsoundio)",
258 "PulseAudio (rtaudio)", "CoreAudio (libsoundio)",
259 "CoreAudio (rtaudio)", "SDL",
260 "WASAPI (libsoundio)", "WASAPI (rtaudio)",
261 "ASIO (rtaudio)",
262};
263
284
285typedef enum MidiBackend
286{
287 MIDI_BACKEND_DUMMY,
288 MIDI_BACKEND_ALSA,
289 MIDI_BACKEND_ALSA_RTMIDI,
290 MIDI_BACKEND_JACK,
291 MIDI_BACKEND_JACK_RTMIDI,
292 MIDI_BACKEND_WINDOWS_MME,
293 MIDI_BACKEND_WINDOWS_MME_RTMIDI,
294 MIDI_BACKEND_COREMIDI_RTMIDI,
295 NUM_MIDI_BACKENDS,
296} MidiBackend;
297
298static inline bool
299midi_backend_is_rtmidi (MidiBackend backend)
300{
301 return backend == MIDI_BACKEND_ALSA_RTMIDI
302 || backend == MIDI_BACKEND_JACK_RTMIDI
303 || backend == MIDI_BACKEND_WINDOWS_MME_RTMIDI
304 || backend == MIDI_BACKEND_COREMIDI_RTMIDI;
305}
306
307static const char * midi_backend_str[] = {
308 /* TRANSLATORS: Dummy backend */
309 N_ ("Dummy"),
310 N_ ("ALSA Sequencer (not working)"),
311 N_ ("ALSA Sequencer (rtmidi)"),
312 "JACK MIDI",
313 "JACK MIDI (rtmidi)",
314 "Windows MME",
315 "Windows MME (rtmidi)",
316 "CoreMIDI (rtmidi)",
317};
318
319typedef enum AudioEngineJackTransportType
320{
321 AUDIO_ENGINE_JACK_TIMEBASE_MASTER,
322 AUDIO_ENGINE_JACK_TRANSPORT_CLIENT,
323 AUDIO_ENGINE_NO_JACK_TRANSPORT,
324} AudioEngineJackTransportType;
325
326static const cyaml_strval_t jack_transport_type_strings[] = {
327 {"Timebase master", AUDIO_ENGINE_JACK_TIMEBASE_MASTER },
328 { "Transport client", AUDIO_ENGINE_JACK_TRANSPORT_CLIENT},
329 { "No JACK transport", AUDIO_ENGINE_NO_JACK_TRANSPORT },
330};
331
333{
336
338 float bpm;
339
342
343 /* - below are used as cache to avoid re-calculations - */
344
346 int32_t bar;
347
349 int32_t beat;
350
352 int32_t sixteenth;
353
356
360
363
366
370
374typedef struct AudioEngine
375{
376 int schema_version;
377
383 uint_fast64_t cycle;
384
385#ifdef HAVE_JACK
387 jack_client_t * client;
388#else
389 void * client;
390#endif
391
400
405 AudioEngineJackTransportType transport_type;
406
408 AudioBackend audio_backend;
409
411 MidiBackend midi_backend;
412
415
418
421
424
430
433
436
439
442
449
456
459
462
470
478
486
487#if 0
493 gint64 last_midi_activity;
494#endif
495
508
516
524
530
532 volatile gint run;
533
536
539
541 volatile gint panic;
542
543 //ZixSem alsa_callback_start;
544
545 /* ----------- ALSA --------------- */
546#ifdef HAVE_ALSA
548 snd_pcm_t * playback_handle;
549 snd_seq_t * seq_handle;
550 snd_pcm_hw_params_t * hw_params;
551 snd_pcm_sw_params_t * sw_params;
552
561 //MidiEvents alsa_midi_events;
562
565 //ZixSem alsa_midi_events_sem;
566#else
567 void * playback_handle;
568 void * seq_handle;
569 void * hw_params;
570 void * sw_params;
571#endif
572
575
576 /* ------------------------------- */
577
580
584
585#ifdef HAVE_PORT_AUDIO
586 PaStream * pa_stream;
587#else
588 void * pa_stream;
589#endif
590
598 float * pa_out_buf;
599
600#ifdef _WOE32
602 WindowsMmeDevice * mme_in_devs[1024];
603 int num_mme_in_devs;
604 WindowsMmeDevice * mme_out_devs[1024];
605 int num_mme_out_devs;
606#else
607 void * mme_in_devs[1024];
608 int num_mme_in_devs;
609 void * mme_out_devs[1024];
610 int num_mme_out_devs;
611#endif
612
613#ifdef HAVE_SDL
614 SDL_AudioDeviceID dev;
615#else
616 uint32_t sdl_dev;
617#endif
618
619#ifdef HAVE_RTAUDIO
620 rtaudio_t rtaudio;
621#else
622 void * rtaudio;
623#endif
624
625#ifdef HAVE_PULSEAUDIO
626 pa_threaded_mainloop * pulse_mainloop;
627 pa_context * pulse_context;
628 pa_stream * pulse_stream;
629#else
630 void * pulse_mainloop;
631 void * pulse_context;
632 void * pulse_stream;
633#endif
634 gboolean pulse_notified_underflow;
635
640
643
648
649 /* note: these 2 are ignored at the moment */
654
657
661
665
669
672
675
680
681 SampleProcessor * sample_processor;
682
686
689
698
709 float denormal_prevention_val;
710
711 /* --- trial version flags --- */
712
716
720
721 /* --- end trial version flags --- */
722
731
733 BounceStep bounce_step;
734
738
741
742 /* --- events --- */
743
756
762
765
768
771
774
775 /* --- end events --- */
776
778 volatile gint cycle_running;
779
782
784 bool setup;
785
788
791
798
804
809
814
816
817static const cyaml_schema_field_t engine_fields_schema[] = {
818 YAML_FIELD_INT (AudioEngine, schema_version),
819 YAML_FIELD_ENUM (
821 transport_type,
822 jack_transport_type_strings),
823 YAML_FIELD_INT (AudioEngine, sample_rate),
824 YAML_FIELD_FLOAT (AudioEngine, frames_per_tick),
827 monitor_out,
828 stereo_ports_fields_schema),
831 midi_editor_manual_press,
832 port_fields_schema),
835 midi_in,
836 port_fields_schema),
839 transport,
840 transport_fields_schema),
843 pool,
844 audio_pool_fields_schema),
847 control_room,
848 control_room_fields_schema),
851 sample_processor,
852 sample_processor_fields_schema),
855 hw_in_processor,
856 hardware_processor_fields_schema),
859 hw_out_processor,
860 hardware_processor_fields_schema),
861
862 CYAML_FIELD_END
863};
864
865static const cyaml_schema_value_t engine_schema = {
866 YAML_VALUE_PTR (AudioEngine, engine_fields_schema),
867};
868
869void
870engine_realloc_port_buffers (
871 AudioEngine * self,
872 nframes_t buf_size);
873
874COLD NONNULL_ARGS (1) void engine_init_loaded (
875 AudioEngine * self,
876 Project * project);
877
884COLD WARN_UNUSED_RESULT AudioEngine *
885engine_new (Project * project);
886
887typedef struct EngineState
888{
896
902void
904 AudioEngine * self,
905 EngineState * state,
906 bool force_pause,
907 bool with_fadeout);
908
909void
910engine_resume (AudioEngine * self, EngineState * state);
911
917void
919
920void
921engine_append_ports (AudioEngine * self, GPtrArray * ports);
922
927void
929
934void
936
943COLD void
944engine_activate (AudioEngine * self, bool activate);
945
957void
959 AudioEngine * self,
960 const int beats_per_bar,
961 const bpm_t bpm,
962 const sample_rate_t sample_rate,
963 bool thread_check,
964 bool update_from_ticks,
965 bool bpm_change);
966
972int
974
983NONNULL HOT bool
985
992NONNULL HOT int
994 AudioEngine * self,
995 const nframes_t total_frames_to_process);
996
1005NONNULL HOT void
1007 AudioEngine * self,
1008 const nframes_t roll_nframes,
1009 const nframes_t nframes);
1010
1015NONNULL void
1017 AudioEngine * self,
1018 const nframes_t nframes);
1019
1024int
1026 AudioEngineBufferSize buffer_size);
1027
1032int
1034 AudioEngineSamplerate samplerate);
1035
1044void
1045engine_set_buffer_size (AudioEngine * self, uint32_t buf_size);
1046
1051#define engine_is_port_own(self, port) \
1052 (port == MONITOR_FADER->stereo_in->l \
1053 || port == MONITOR_FADER->stereo_in->r \
1054 || port == MONITOR_FADER->stereo_out->l \
1055 || port == MONITOR_FADER->stereo_out->r)
1056
1060const char *
1061engine_audio_backend_to_string (AudioBackend backend);
1062
1063AudioBackend
1064engine_audio_backend_from_string (const char * str);
1065
1069static inline const char *
1070engine_midi_backend_to_string (MidiBackend backend)
1071{
1072 return midi_backend_str[backend];
1073}
1074
1075MidiBackend
1076engine_midi_backend_from_string (const char * str);
1077
1082void
1084
1093void
1094engine_set_default_backends (bool reset_to_dummy);
1095
1101COLD NONNULL AudioEngine *
1103
1107COLD NONNULL void
1109
1114#endif
The control room backend.
External ports.
AudioEngineSamplerate
Samplerates to be used in comboboxes.
Definition engine.h:194
AudioEngineEventType
Audio engine event type.
Definition engine.h:142
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:166
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:269
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.
COLD NONNULL_ARGS(1) void automation_track_init_loaded(AutomationTrack *self
Inits a loaded AutomationTracklist.
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:271
@ BOUNCE_INHERIT
Bounce if parent is bouncing.
Definition engine.h:282
@ BOUNCE_ON
Bounce.
Definition engine.h:274
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:39
#define YAML_VALUE_PTR(cc, fields_schema)
Schema to be used as a pointer.
Definition yaml.h:221
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:151
int32_t beat
Current beat (within bar).
Definition engine.h:349
double tick_within_beat
Current tick-within-beat.
Definition engine.h:362
int32_t sixteenth_within_bar
Current sixteenth (within bar).
Definition engine.h:355
double tick_within_bar
Current tick (within bar).
Definition engine.h:365
int32_t ninetysixth_notes
Total 1/96th notes completed up to current pos.
Definition engine.h:368
int32_t sixteenth_within_song
Current sixteenth (within song, ie, total sixteenths).
Definition engine.h:359
bool is_rolling
Transport is rolling.
Definition engine.h:335
double playhead_ticks
Exact playhead position (in ticks).
Definition engine.h:341
int32_t bar
Current bar.
Definition engine.h:346
int32_t sixteenth
Current sixteenth (within beat).
Definition engine.h:352
The audio engine.
Definition engine.h:375
HardwareProcessor * hw_in_processor
Input device processor.
Definition engine.h:438
AudioEnginePositionInfo pos_nfo_at_end
Expected position info at the end of the current cycle.
Definition engine.h:813
double ticks_per_frame
Reciprocal of AudioEngine::frames_per_tick.
Definition engine.h:429
double frames_per_tick
Number of frames/samples per tick.
Definition engine.h:423
bool bounce_with_parents
Whether currently bouncing with parents (cache).
Definition engine.h:737
nframes_t remaining_latency_preroll
When first set, it is equal to the max playback latency of all initial trigger nodes.
Definition engine.h:679
nframes_t nframes
Number of frames/samples in the current cycle, per channel.
Definition engine.h:523
size_t midi_buf_size
Size of MIDI port buffers in bytes.
Definition engine.h:417
volatile gint cycle_running
Whether the cycle is currently running.
Definition engine.h:778
ControlRoom * control_room
The ControlRoom.
Definition engine.h:458
Port * midi_editor_manual_press
Manual note press events from the piano roll.
Definition engine.h:507
gint64 last_timestamp_start
Timestamp at start of previous cycle.
Definition engine.h:671
int capture_cc
To be set to 1 when the CC from the Midi in port should be captured.
Definition engine.h:685
bool setup
Whether the engine is already set up.
Definition engine.h:784
PanLaw pan_law
Pan law.
Definition engine.h:651
volatile gint run
Ok to process or not.
Definition engine.h:532
gint64 last_events_process_started
Time last event processing started.
Definition engine.h:770
gint64 zrythm_start_time
Time at start to keep track if trial limit is reached.
Definition engine.h:715
volatile gint filled_stereo_out_bufs
Flag used when processing in some backends.
Definition engine.h:579
gint handled_jack_buffer_size_change
Whether pending jack buffer change was handled (buffers reallocated).
Definition engine.h:399
gint64 timestamp_start
Timestamp at the start of the current cycle.
Definition engine.h:664
AudioEnginePositionInfo pos_nfo_before
Position info at the end of the previous cycle before moving the transport.
Definition engine.h:803
int processing_events
Whether currently processing events.
Definition engine.h:767
StereoPorts * dummy_input
Used during tests to pass input data for recording.
Definition engine.h:469
Port * midi_in
Port used for receiving MIDI in messages for binding CC and other non-recording purposes.
Definition engine.h:515
AudioBackend audio_backend
Current audio backend.
Definition engine.h:408
sample_rate_t sample_rate
Sample rate.
Definition engine.h:420
nframes_t block_length
Audio buffer size (block length), per channel.
Definition engine.h:414
AudioPool * pool
Audio file pool.
Definition engine.h:461
AudioEngineJackTransportType transport_type
Whether transport master/client or no connection with jack transport.
Definition engine.h:405
Metronome * metronome
The metronome.
Definition engine.h:740
int limit_reached
Flag to keep track of the first time the limit is reached.
Definition engine.h:719
MPMCQueue * ev_queue
Event queue.
Definition engine.h:755
bool updating_frames_per_tick
True while updating frames per tick.
Definition engine.h:797
gint exporting
1 if currently exporting.
Definition engine.h:538
MidiBackend midi_backend
Current MIDI backend.
Definition engine.h:411
bool preparing_to_export
To be set to true when preparing to export.
Definition engine.h:535
gint64 last_xrun_notification
Last time an XRUN notification was shown.
Definition engine.h:697
StereoPorts * monitor_out
Monitor - these should be the last ports in the signal chain.
Definition engine.h:477
Router * router
The processing graph router.
Definition engine.h:435
gint preparing_for_process
Flag used to check if we are inside engine_process_prepare().
Definition engine.h:583
gint64 last_events_processed
Time last event processing completed.
Definition engine.h:773
BounceMode bounce_mode
If this is on, only tracks/regions marked as "for bounce" will be allowed to make sound.
Definition engine.h:730
guint process_source_id
ID of the event processing source func.
Definition engine.h:764
BounceStep bounce_step
Bounce step cache.
Definition engine.h:733
ObjectPool * ev_pool
Object pool of event structs to avoid allocation.
Definition engine.h:761
ZixSem port_operation_lock
Semaphore for blocking DSP while a plugin and its ports are deleted.
Definition engine.h:529
AudioEnginePositionInfo pos_nfo_current
Position info at the start of the current cycle.
Definition engine.h:808
Project * project
Pointer to owner project, if any.
Definition engine.h:790
float * pa_out_buf
Port Audio output buffer.
Definition engine.h:598
gint64 max_time_taken
Max time taken to process in the last few cycles.
Definition engine.h:660
float * alsa_out_buf
ALSA audio buffer.
Definition engine.h:574
Transport * transport
Timeline metadata like BPM, time signature, etc.
Definition engine.h:647
gint64 last_timestamp_end
Timestamp at end of previous cycle.
Definition engine.h:674
bool denormal_prevention_val_positive
Whether the denormal prevention value (1e-12 ~ 1e-20) is positive.
Definition engine.h:708
Port * midi_clock_out
MIDI Clock output.
Definition engine.h:455
GThread * dummy_audio_thread
Dummy audio DSP processing thread.
Definition engine.h:639
uint_fast64_t cycle
Cycle count to know which cycle we are in.
Definition engine.h:383
gint64 last_time_taken
Time taken to process in the last cycle.
Definition engine.h:656
PanAlgorithm pan_algo
Pan algorithm.
Definition engine.h:653
bool pre_setup
Whether the engine is already pre-set up.
Definition engine.h:781
Port * midi_clock_in
MIDI Clock input TODO.
Definition engine.h:448
midi_byte_t last_cc[3]
Last MIDI CC captured.
Definition engine.h:688
volatile gint panic
Send note off MIDI everywhere.
Definition engine.h:541
gint64 timestamp_end
Expected timestamp at the end of the current cycle.
Definition engine.h:668
int stop_dummy_audio_thread
Set to 1 to stop the dummy audio thread.
Definition engine.h:642
HardwareProcessor * hw_out_processor
Output device processor.
Definition engine.h:441
int trigger_midi_activity
Flag to tell the UI that this channel had MIDI activity.
Definition engine.h:485
int buf_size_set
True iff buffer size callback fired.
Definition engine.h:432
bool activated
Whether the engine is currently activated.
Definition engine.h:787
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:63
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:894
int running
Engine running.
Definition engine.h:890
bool playing
Playback.
Definition engine.h:892
External port.
Definition ext_port.h:78
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:72
Must ONLY be created via port_new()
Definition port.h:150
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:572
The Tracklist contains all the tracks in the Project.
Definition tracklist.h:68
The transport.
Definition transport.h:195
Transport API.
Custom types.