|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
Control port specifics. More...
#include <src/gui/dsp/control_port.h>


Data Structures | |
| struct | ChangeEvent |
| Used for queueing changes to be applied during processing. More... | |
| struct | ScalePoint |
| Scale point. More... | |
Public Types | |
| using | AutomationValueGetter |
| Gets the current automation value if available (eg, from an automation track). | |
| Public Types inherited from Port | |
| using | PortIdentifier = dsp::PortIdentifier |
| using | PortType = dsp::PortType |
| using | PortFlow = dsp::PortFlow |
| using | PortConnection = dsp::PortConnection |
Public Member Functions | |
| ControlPort (utils::Utf8String label={}) | |
| float | normalized_val_to_real (float normalized_val) const |
| Converts normalized value (0.0 to 1.0) to real value (eg. | |
| float | real_val_to_normalized (float real_val) const |
| Converts real value (eg. | |
| bool | is_toggled () const |
| Returns if the control port is toggled. | |
| int | get_int () const |
| Gets the control value for an integer port. | |
| void | set_unit_from_str (const utils::Utf8String &str) |
| Set the identifier's port unit from the given string. | |
| float | get_snapped_val () const |
| Returns the snapped value (eg, if toggle, returns 0.f or 1.f). | |
| float | get_snapped_val_from_val (float val) const |
| Returns the snapped value (eg, if toggle, returns 0.f or 1.f). | |
| float | get_val () const |
| Get the current real value of the control. | |
| float | get_normalized_val () const |
| Get the current normalized value of the control. | |
| float | get_unsnapped_val () const |
| Get the current real unsnapped value of the control. | |
| float | get_default_val () const |
| Get the default real value of the control. | |
| void | set_real_val (float val) |
| Get the default real value of the control. | |
| void | set_real_val_w_events (float val) |
| Set the default real value of the control and sends UI events. | |
| void | set_toggled (bool toggled, bool forward_events) |
| Wrapper over port_set_control_value() for toggles. | |
| void | set_val_from_normalized (float val, bool automating) |
| Updates the actual value. | |
| void | set_control_value (float val, bool is_normalized, bool forward_event_to_plugin) |
| Sets the given control value to the corresponding underlying structure in the Port. | |
| void | set_automation_value_reader (AutomationValueGetter reader) |
| Sets the automation value reader. | |
| RtTimePoint | ms_since_last_change () const |
| float | get_control_value (bool normalize) const |
| Gets the given control value from the corresponding underlying structure in the Port. | |
| void | process_block (EngineProcessTimeInfo time_nfo) override |
| void | clear_buffer (std::size_t block_length) override |
| Clears the port buffer. | |
| Public Member Functions inherited from Port | |
| void | init_loaded (IPortOwner &owner) |
| This function finds the Ports corresponding to the PortIdentifiers for srcs and dests. | |
| void | set_owner (IPortOwner &owner) |
| utils::Utf8String | get_label () const |
| bool | is_control () const |
| bool | is_audio () const |
| bool | is_cv () const |
| bool | is_event () const |
| bool | is_midi () const |
| bool | is_input () const |
| bool | is_output () const |
| utils::Utf8String | get_node_name () const override |
| Returns a human friendly name of the node. | |
| nframes_t | get_single_playback_latency () const override |
| Ports have no latency. | |
| virtual bool | has_sound () const |
| If MIDI port, returns if there are any events, if audio port, returns if there is sound in the buffer. | |
| utils::Utf8String | get_full_designation () const |
| Gets a full designation of the port in the format "Track/Port" or "Track/Plugin/Port". | |
| void | change_track (IPortOwner::TrackUuid new_track_id) |
| Updates the owner track identifier. | |
| bool | has_label () const |
| PortType | get_type () const |
| PortFlow | get_flow () const |
| Public Member Functions inherited from zrythm::dsp::graph::IProcessable | |
| virtual void | prepare_for_processing (sample_rate_t sample_rate, nframes_t max_block_length) |
| Called to allocate resources required for processing. | |
| virtual void | release_resources () |
| Called to release resources allocated by prepare_for_processing(). | |
| Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< Port > | |
| UuidIdentifiableObject & | operator= (const UuidIdentifiableObject &other)=default |
| auto | get_uuid () const |
Static Public Member Functions | |
| static bool | is_val_toggled (float val) |
| Checks if the given value is toggled. | |
| static int | get_int_from_val (float val) |
| Gets the control value for an integer port. | |
Data Fields | |
| float | control_ = 0.f |
| To be called when a control's value changes so that a message can be sent to the plugin UI. | |
| float | base_value_ = 0.f |
| For control ports, when a modulator is attached to the port the previous value will be saved here. | |
| std::vector< ScalePoint > | scale_points_ |
| Scale points. | |
| midi_byte_t | midi_channel_ = 0 |
| MIDI channel, starting from 1. | |
| midi_byte_t | midi_cc_no_ = 0 |
| MIDI CC number, if not pitchbend/poly key/channel pressure. | |
| float | deff_ = 0.f |
| Default value. | |
| int | carla_param_id_ = 0 |
| Index of the control parameter (for Carla plugin ports). | |
| bool | automating_ = false |
| Whether this value was set via automation. | |
| float | unsnapped_control_ = 0.f |
| Unsnapped value, used by widgets. | |
| bool | value_changed_from_reading_ {} |
| Flag that the value of the port changed from reading automation. | |
| bool | received_ui_event_ {} |
| Whether the port received a UI event from the plugin UI in this cycle. | |
| Data Fields inherited from Port | |
| std::unique_ptr< PortIdentifier > | id_ |
| Owned pointer. | |
| IPortOwner * | owner_ {} |
| PortRange | range_ |
| Data Fields inherited from PortConnectionsCacheMixin< CVPort > | |
| std::vector< ElementType > | port_sources_ |
| Caches filled when recalculating the graph. | |
Friends | |
| void | init_from (ControlPort &obj, const ControlPort &other, utils::ObjectCloneType clone_type) |
| void | to_json (nlohmann::json &j, const ControlPort &p) |
| void | from_json (const nlohmann::json &j, ControlPort &p) |
Additional Inherited Members | |
| Protected Member Functions inherited from Port | |
| Port (utils::Utf8String label, PortType type={}, PortFlow flow={}, float minf=0.f, float maxf=1.f, float zerof=0.f) | |
Control port specifics.
Definition at line 15 of file control_port.h.
Gets the current automation value if available (eg, from an automation track).
If available, the ControlPort will be overridden to this value during processing.
| global_frame | Frame in global coordinates (timeline). |
Definition at line 34 of file control_port.h.
|
inlineoverridevirtual |
| float ControlPort::get_control_value | ( | bool | normalize | ) | const |
Gets the given control value from the corresponding underlying structure in the Port.
| normalize | Whether to get the value normalized or not. |
|
inline |
Get the default real value of the control.
Definition at line 176 of file control_port.h.
|
inline |
Gets the control value for an integer port.
Definition at line 120 of file control_port.h.
|
inlinestatic |
Gets the control value for an integer port.
Definition at line 130 of file control_port.h.
|
inline |
Get the current normalized value of the control.
Definition at line 162 of file control_port.h.
|
inline |
Returns the snapped value (eg, if toggle, returns 0.f or 1.f).
Definition at line 142 of file control_port.h.
|
inline |
Get the current real unsnapped value of the control.
Definition at line 171 of file control_port.h.
|
inline |
Get the current real value of the control.
TODO "normalize" parameter.
Definition at line 157 of file control_port.h.
|
inline |
Returns if the control port is toggled.
Definition at line 115 of file control_port.h.
|
inlinestatic |
Checks if the given value is toggled.
Definition at line 110 of file control_port.h.
|
inline |
Definition at line 239 of file control_port.h.
| float ControlPort::normalized_val_to_real | ( | float | normalized_val | ) | const |
Converts normalized value (0.0 to 1.0) to real value (eg.
-10.0 to 100.0).
|
overridevirtual |
Reimplemented from zrythm::dsp::graph::IProcessable.
| float ControlPort::real_val_to_normalized | ( | float | real_val | ) | const |
Converts real value (eg.
-10.0 to 100.0) to normalized value (0.0 to 1.0).
|
inline |
Sets the automation value reader.
This should be called any time before processing (the automation value reaer is only used during process_block()).
Definition at line 234 of file control_port.h.
| void ControlPort::set_control_value | ( | float | val, |
| bool | is_normalized, | ||
| bool | forward_event_to_plugin ) |
Sets the given control value to the corresponding underlying structure in the Port.
Note: this is only for setting the base values (eg when automating via an automation lane). For CV automations this should not be used.
| is_normalized | Whether the given value is normalized between 0 and 1. |
| forward_event_to_plugin | Whether to forward a port control change event to the plugin UI. Only applicable for plugin control ports. If the control is being changed manually or from within Zrythm, this should be true to notify the plugin of the change. |
|
inline |
Get the default real value of the control.
Definition at line 181 of file control_port.h.
|
inline |
Set the default real value of the control and sends UI events.
Definition at line 186 of file control_port.h.
|
inline |
Wrapper over port_set_control_value() for toggles.
Definition at line 194 of file control_port.h.
| void ControlPort::set_val_from_normalized | ( | float | val, |
| bool | automating ) |
Updates the actual value.
The given value is always a normalized 0.0-1.0 value and must be translated to the actual value before setting it.
| automating | Whether this is from an automation event. This will set Lv2Port's automating field to true, which will cause the plugin to receive a UI event for this change. |
|
friend |
Definition at line 276 of file control_port.h.
|
friend |
Definition at line 267 of file control_port.h.
| bool ControlPort::automating_ = false |
Whether this value was set via automation.
Definition at line 337 of file control_port.h.
| float ControlPort::base_value_ = 0.f |
For control ports, when a modulator is attached to the port the previous value will be saved here.
Automation in AutomationTrack's will overwrite this value.
Definition at line 309 of file control_port.h.
| int ControlPort::carla_param_id_ = 0 |
Index of the control parameter (for Carla plugin ports).
Definition at line 334 of file control_port.h.
| float ControlPort::control_ = 0.f |
To be called when a control's value changes so that a message can be sent to the plugin UI.
The control value.
FIXME for fader, this should be the fader_val (0.0 to 1.0) and not the amplitude.
This value will be snapped (eg, if integer or toggle).
Definition at line 301 of file control_port.h.
| float ControlPort::deff_ = 0.f |
Default value.
Definition at line 331 of file control_port.h.
| midi_byte_t ControlPort::midi_cc_no_ = 0 |
MIDI CC number, if not pitchbend/poly key/channel pressure.
Definition at line 326 of file control_port.h.
| midi_byte_t ControlPort::midi_channel_ = 0 |
MIDI channel, starting from 1.
Definition at line 323 of file control_port.h.
| bool ControlPort::received_ui_event_ {} |
Whether the port received a UI event from the plugin UI in this cycle.
This is used to avoid re-sending that event to the plugin.
Definition at line 350 of file control_port.h.
| std::vector<ScalePoint> ControlPort::scale_points_ |
Scale points.
Definition at line 312 of file control_port.h.
| float ControlPort::unsnapped_control_ = 0.f |
Unsnapped value, used by widgets.
Definition at line 340 of file control_port.h.
| bool ControlPort::value_changed_from_reading_ {} |
Flag that the value of the port changed from reading automation.
Definition at line 343 of file control_port.h.