Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
track_processor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2024 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_TRACK_PROCESSOR_H__
11#define __AUDIO_TRACK_PROCESSOR_H__
12
13#include "dsp/port.h"
14#include "utils/midi.h"
15#include "utils/types.h"
16#include "utils/yaml.h"
17
18typedef struct StereoPorts StereoPorts;
19typedef struct Port Port;
20typedef struct Track Track;
21typedef struct MidiMappings MidiMappings;
23TYPEDEF_STRUCT (MPMCQueue);
24
31#define TRACK_PROCESSOR_SCHEMA_VERSION 1
32
33#define TRACK_PROCESSOR_MAGIC 81213128
34#define IS_TRACK_PROCESSOR(tr) ((tr) && (tr)->magic == TRACK_PROCESSOR_MAGIC)
35
36#define track_processor_is_in_active_project(self) \
37 (self->track && track_is_in_active_project (self->track))
38
43typedef struct TrackProcessor
44{
49
52
55
63
68
78
83
92
103
104 /* --- MIDI controls --- */
105
108
110 Port * midi_cc[128 * 16];
111
114
125
133
134 /* --- end MIDI controls --- */
135
142 float r_port_db;
143
146
154
162
163 int magic;
165
169COLD NONNULL_ARGS (
170 1) void track_processor_init_loaded (TrackProcessor * self, Track * track);
171
172#if 0
173void
174track_processor_set_is_project (
175 TrackProcessor * self,
176 bool is_project);
177#endif
178
183COLD WARN_UNUSED_RESULT TrackProcessor *
185
189void
191
195void
197
202void
204
205static inline Track *
206track_processor_get_track (const TrackProcessor * self)
207{
208#if 0
209 g_return_val_if_fail (
210 IS_TRACK_PROCESSOR (self) && IS_TRACK (self->track), NULL);
211#endif
212 g_return_val_if_fail (self->track, NULL);
213
214 return self->track;
215}
216
234void
236 TrackProcessor * self,
237 const EngineProcessTimeInfo * const time_nfo);
238
245void
247
254void
256
261void
263
268void
270
271#if 0
272void
273track_processor_update_track_name_hash (
274 TrackProcessor * self);
275#endif
276
277void
278track_processor_append_ports (TrackProcessor * self, GPtrArray * ports);
279
283void
285
290#endif
Ports that transfer audio/midi/other signals to one another.
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
void track_processor_copy_values(TrackProcessor *dest, TrackProcessor *src)
Copy port values from src to dest.
void track_processor_connect_to_plugin(TrackProcessor *self, Plugin *pl)
Connect the TrackProcessor's out ports to the Plugin's input ports.
void track_processor_clear_buffers(TrackProcessor *self)
Clears all buffers.
void track_processor_free(TrackProcessor *self)
Frees the TrackProcessor.
COLD WARN_UNUSED_RESULT TrackProcessor * track_processor_new(Track *track)
Creates a new track processor for the given track.
void track_processor_connect_to_prefader(TrackProcessor *self)
Connects the TrackProcessor's stereo out ports to the Channel's prefader in ports.
void track_processor_disconnect_all(TrackProcessor *self)
Disconnects all ports connected to the TrackProcessor.
void track_processor_disconnect_from_prefader(TrackProcessor *self)
Disconnect the TrackProcessor's stereo out ports from the prefader.
void track_processor_process(TrackProcessor *self, const EngineProcessTimeInfo *const time_nfo)
Process the TrackProcessor.
void track_processor_disconnect_from_plugin(TrackProcessor *self, Plugin *pl)
Disconnect the TrackProcessor's out ports from the Plugin's input ports.
MIDI utils.
Common struct to pass around during processing to avoid repeating the data in function arguments.
Definition types.h:138
Multiple Producer Multiple Consumer lock-free queue.
Definition mpmc_queue.h:69
All MIDI mappings in Zrythm.
The base plugin Inheriting plugins must have this as a child.
Definition plugin.h:74
Must ONLY be created via port_new()
Definition port.h:139
L & R port, for convenience.
Definition port.h:505
A TrackProcessor is a processor that is used as the first entry point when processing a track.
Port * monitor_audio
Whether to monitor the audio output.
MPMCQueue * updated_midi_automatable_ports
A queue of MIDI CC ports whose values have been recently updated.
Port * output_gain
Output gain, if audio.
Port * midi_in
MIDI in Port.
Port * poly_key_pressure[16]
Polyphonic key pressure (aftertouch).
Port * channel_pressure[16]
Channel pressure (aftertouch).
StereoPorts * stereo_in
L & R audio input ports, if audio.
Port * midi_cc[128 *16]
MIDI CC control ports, 16 channels.
bool pending_midi_panic
To be set to true when a panic (all notes off) message should be sent during processing.
MidiMappings * cc_mappings
Mappings to each CC port.
Port * input_gain
Input gain, if audio.
StereoPorts * stereo_out
L & R audio output ports, if audio.
Port * pitch_bend[16]
Pitch bend.
Track * track
Pointer to owner track, if any.
Port * midi_out
MIDI out port, if MIDI.
float l_port_db
Current dBFS after processing each output port.
Port * piano_roll
MIDI input for receiving MIDI signals from the piano roll (i.e., MIDI notes inside regions) or other ...
Port * mono
Mono toggle, if audio.
Track to be inserted into the Project's Tracklist.
Definition track.h:177
Custom types.
YAML utils.