Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
hardware_processor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2020-2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_HARDWARE_PROCESSOR_H__
11#define __AUDIO_HARDWARE_PROCESSOR_H__
12
13#include <stdbool.h>
14
15#include "dsp/ext_port.h"
16#include "dsp/port.h"
17
18#include <gtk/gtk.h>
19
20typedef struct AudioEngine AudioEngine;
21
28#define HW_PROCESSOR_SCHEMA_VERSION 1
29
30#define HW_IN_PROCESSOR (AUDIO_ENGINE->hw_in_processor)
31#define HW_OUT_PROCESSOR (AUDIO_ENGINE->hw_out_processor)
32
33#define hw_processor_is_in_active_project(self) \
34 (self->engine && engine_is_in_active_project ((self)->engine))
35
39typedef struct HardwareProcessor
40{
41 int schema_version;
42
48
59 int num_selected_midi_ports;
60 char ** selected_audio_ports;
61 int num_selected_audio_ports;
62
67 int num_ext_audio_ports;
68 size_t ext_audio_ports_size;
69 ExtPort ** ext_midi_ports;
70 int num_ext_midi_ports;
71 size_t ext_midi_ports_size;
72
78 int num_audio_ports;
79 Port ** midi_ports;
80 int num_midi_ports;
81
83 bool setup;
84
87
88 guint rescan_timeout_id;
89
92
94
95COLD NONNULL_ARGS (1) void hardware_processor_init_loaded (
96 HardwareProcessor * self,
97 AudioEngine * engine);
98
102COLD WARN_UNUSED_RESULT HardwareProcessor *
103hardware_processor_new (bool input, AudioEngine * engine);
104
111bool
113
119ExtPort *
121
127Port *
129
135int
137
144void
146
150REALTIME
151void
153
159
160void
161hardware_processor_free (HardwareProcessor * self);
162
167#endif
Ports that transfer audio/midi/other signals to one another.
External ports.
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
void hardware_processor_activate(HardwareProcessor *self, bool activate)
Starts or stops the ports.
ExtPort * hardware_processor_find_ext_port(HardwareProcessor *self, const char *id)
Finds an ext port from its ID (type + full name).
int hardware_processor_setup(HardwareProcessor *self)
Sets up the ports but does not start them.
COLD WARN_UNUSED_RESULT HardwareProcessor * hardware_processor_new(bool input, AudioEngine *engine)
Returns a new empty instance.
Port * hardware_processor_find_port(HardwareProcessor *self, const char *id)
Finds a port from its ID (type + full name).
REALTIME void hardware_processor_process(HardwareProcessor *self, nframes_t nframes)
Processes the data.
bool hardware_processor_rescan_ext_ports(HardwareProcessor *self)
Rescans the hardware ports and appends any missing ones.
HardwareProcessor * hardware_processor_clone(const HardwareProcessor *src)
To be used during serialization.
uint32_t nframes_t
Frame count.
Definition types.h:35
The audio engine.
Definition engine.h:364
External port.
Definition ext_port.h:77
Hardware processor.
Port ** audio_ports
Ports to be used by Zrythm, corresponding to the external ports.
bool activated
Whether currently active.
bool setup
Whether set up already.
bool is_input
Whether this is the processor at the start of the graph (input) or at the end (output).
char ** selected_midi_ports
Ports selected by the user in the preferences to enable.
ExtPort ** ext_audio_ports
All known external ports.
AudioEngine * engine
Pointer to owner engine, if any.
Must ONLY be created via port_new()
Definition port.h:138