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 "dsp/port_identifier.h"
14#include "dsp/tempo_track.h"
15
16typedef struct Port Port;
17
51
67NONNULL float
69 const Port * const self,
70 float normalized_val);
71
81NONNULL float
82control_port_real_val_to_normalized (const Port * const self, float real_val);
83
87#define control_port_is_val_toggled(val) (val > 0.001f)
88
92#define control_port_is_toggled(self) \
93 (control_port_is_val_toggled (self->control))
94
98int
100
104int
106
111float
113
118float
120
126float
128
132float
134
139float
141
145float
147
151void
152control_port_set_real_val (Port * self, float val);
153
158void
160
164void
165control_port_set_toggled (Port * self, bool toggled, bool forward_events);
166
179HOT NONNULL void
180control_port_set_val_from_normalized (Port * self, float val, bool automating);
181
186#endif
int control_port_get_int(Port *self)
Gets the control value for an integer port.
ZBeatUnit
Beat unit.
Definition tempo_track.h:42
NONNULL float control_port_real_val_to_normalized(const Port *const self, float real_val)
Converts real value (eg.
int control_port_get_int_from_val(float val)
Gets the control value for an integer port.
void control_port_set_real_val(Port *self, float val)
Get the default real value of the control.
NONNULL 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.
float control_port_get_default_val(Port *self)
Get the default real value of the control.
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).
float control_port_get_val(Port *self)
Get the current real value of the control.
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).
float control_port_get_unsnapped_val(Port *self)
Get the current real unsnapped value of the control.
float control_port_get_normalized_val(Port *self)
Get the current normalized value of the control.
Port identifier.
Used for queueing changes to be applied during processing.
PortIdentifier::Flags2 flag2
Flag to identify the port the change is for.
int ival
Integer val.
float real_val
Real (not normalized) value to set.
PortIdentifier::Flags flag1
Flag to identify the port the change is for.
Must ONLY be created via port_new()
Definition port.h:136
Object to hold information for the Tempo track.