Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
control_port.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_CONTROL_PORT_H__
11#define __AUDIO_CONTROL_PORT_H__
12
13#include <stdbool.h>
14
15#include "dsp/port_identifier.h"
16#include "dsp/tempo_track.h"
17
18typedef struct Port Port;
19
27typedef struct ControlPortChange
28{
35
43
45 float real_val;
46
48 int ival;
49
50 BeatUnit beat_unit;
51
53
69NONNULL PURE float
71 const Port * const self,
72 float normalized_val);
73
83NONNULL PURE float
84control_port_real_val_to_normalized (const Port * const self, float real_val);
85
89#define control_port_is_val_toggled(val) (val > 0.001f)
90
94#define control_port_is_toggled(self) \
95 (control_port_is_val_toggled (self->control))
96
100int
102
106PURE int
108
113float
115
120float
122
128PURE float
130
134PURE float
136
141PURE float
143
147PURE float
149
153void
154control_port_set_real_val (Port * self, float val);
155
160void
162
166void
167control_port_set_toggled (Port * self, bool toggled, bool forward_events);
168
181HOT NONNULL void
182control_port_set_val_from_normalized (Port * self, float val, bool automating);
183
188#endif
NONNULL PURE float control_port_normalized_val_to_real(const Port *const self, float normalized_val)
Converts normalized value (0.0 to 1.0) to real value (eg.
PURE float control_port_get_normalized_val(Port *self)
Get the current normalized value of the control.
BeatUnit
Beat unit.
Definition tempo_track.h:40
PURE float control_port_get_unsnapped_val(Port *self)
Get the current real unsnapped value of the control.
PURE float control_port_get_val(Port *self)
Get the current real value of the control.
int control_port_get_int(Port *self)
Gets the control value for an integer port.
PortFlags2
void control_port_set_real_val(Port *self, float val)
Get the default real value of the control.
PURE float control_port_get_default_val(Port *self)
Get the default real value of the control.
PortFlags
Port flags.
void control_port_set_toggled(Port *self, bool toggled, bool forward_events)
Wrapper over port_set_control_value() for toggles.
float control_port_get_snapped_val(Port *self)
Returns the snapped value (eg, if toggle, returns 0.f or 1.f).
HOT NONNULL void control_port_set_val_from_normalized(Port *self, float val, bool automating)
Updates the actual value.
void control_port_set_real_val_w_events(Port *self, float val)
Get the default real value of the control and sends UI events.
float control_port_get_snapped_val_from_val(Port *self, float val)
Returns the snapped value (eg, if toggle, returns 0.f or 1.f).
NONNULL PURE float control_port_real_val_to_normalized(const Port *const self, float real_val)
Converts real value (eg.
PURE int control_port_get_int_from_val(float val)
Gets the control value for an integer port.
Port identifier.
Used for queueing changes to be applied during processing.
int ival
Integer val.
float real_val
Real (not normalized) value to set.
PortFlags flag1
Flag to identify the port the change is for.
PortFlags2 flag2
Flag to identify the port the change is for.
Must ONLY be created via port_new()
Definition port.h:138
Object to hold information for the Tempo track.