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 "dsp/ext_port.h"
14#include "dsp/port.h"
15
16#include "gtk_wrapper.h"
17
18typedef struct AudioEngine AudioEngine;
19
26#define HW_PROCESSOR_SCHEMA_VERSION 1
27
28#define HW_IN_PROCESSOR (AUDIO_ENGINE->hw_in_processor)
29#define HW_OUT_PROCESSOR (AUDIO_ENGINE->hw_out_processor)
30
31#define hw_processor_is_in_active_project(self) \
32 (self->engine && engine_is_in_active_project ((self)->engine))
33
37typedef struct HardwareProcessor
38{
39 int schema_version;
40
46
57 int num_selected_midi_ports;
58 char ** selected_audio_ports;
59 int num_selected_audio_ports;
60
65 int num_ext_audio_ports;
66 size_t ext_audio_ports_size;
67 ExtPort ** ext_midi_ports;
68 int num_ext_midi_ports;
69 size_t ext_midi_ports_size;
70
76 int num_audio_ports;
77 Port ** midi_ports;
78 int num_midi_ports;
79
81 bool setup;
82
85
86 guint rescan_timeout_id;
87
90
92
93COLD NONNULL_ARGS (1) void hardware_processor_init_loaded (
94 HardwareProcessor * self,
95 AudioEngine * engine);
96
100COLD WARN_UNUSED_RESULT HardwareProcessor *
101hardware_processor_new (bool input, AudioEngine * engine);
102
109bool
111
117ExtPort *
119
125Port *
127
133int
135
142void
144
148REALTIME
149void
151
157
158void
159hardware_processor_free (HardwareProcessor * self);
160
165#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:39
The audio engine.
Definition engine.h:353
External port.
Definition ext_port.h:69
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:136