77 for (uint8_t c = 0; c <
channels; c++) {
86 for (uint8_t c = 0; c <
channels; c++) {
93 for (uint8_t c = 0; c <
channels; c++) {
101 for (uint8_t c = 0; c <
channels; c++) {
119 for (uint8_t c = 0; c <
channels; c++) {
122 return std::sqrt(sum);
126 template <
typename T>
128 return T::load(&
voltages[firstChannel]);
131 template <
typename T>
136 template <
typename T>
141 template <
typename T>
146 template <
typename T>
148 voltage.store(&
voltages[firstChannel]);
158 if (this->channels == 0) {
#define DEPRECATED
Attribute for deprecated functions and symbols.
Definition common.hpp:26
static const int PORT_MAX_CHANNELS
This is inspired by the number of MIDI channels.
Definition Port.hpp:11
Root namespace for the Rack API.
Definition AudioDisplay.hpp:9
bool isConnected()
Returns whether a cable is connected to the Port.
Definition Port.hpp:182
float getVoltageRMS()
Returns the root-mean-square of all voltages.
Definition Port.hpp:110
Light plugLights[3]
For rendering plug lights on cables.
Definition Port.hpp:35
void setVoltage(float voltage, uint8_t channel=0)
Sets the voltage of the given channel.
Definition Port.hpp:43
float getNormalVoltage(float normalVoltage, uint8_t channel=0)
Returns the voltage if a cable is connected, otherwise returns the given normal voltage.
Definition Port.hpp:60
void clearVoltages()
Sets all voltages to 0.
Definition Port.hpp:92
void writeVoltages(const float *v)
Copies an array of size at least channels to the port's voltages.
Definition Port.hpp:85
T getPolyVoltageSimd(uint8_t firstChannel)
Definition Port.hpp:132
float getVoltage(uint8_t channel=0)
Returns the voltage of the given channel.
Definition Port.hpp:50
float voltages[PORT_MAX_CHANNELS]
Unstable API.
Definition Port.hpp:18
float * getVoltages(uint8_t firstChannel=0)
Returns a pointer to the array of voltages beginning with firstChannel.
Definition Port.hpp:71
float getVoltageSum()
Returns the sum of all voltages.
Definition Port.hpp:99
uint8_t channels
Number of polyphonic channels.
Definition Port.hpp:28
DEPRECATED float normalize(float normalVoltage)
Use getNormalVoltage() instead.
Definition Port.hpp:199
T getNormalVoltageSimd(T normalVoltage, uint8_t firstChannel)
Definition Port.hpp:137
bool isPolyphonic()
Returns whether the cable exists and has more than 1 channel.
Definition Port.hpp:192
int getChannels()
Returns the number of channels.
Definition Port.hpp:175
bool isMonophonic()
Returns whether the cable exists and has 1 channel.
Definition Port.hpp:187
Type
Definition Port.hpp:37
@ OUTPUT
Definition Port.hpp:39
@ INPUT
Definition Port.hpp:38
float getPolyVoltage(uint8_t channel)
Returns the given channel's voltage if the port is polyphonic, otherwise returns the first voltage (c...
Definition Port.hpp:55
uint8_t active
DEPRECATED.
Definition Port.hpp:30
float value
DEPRECATED.
Definition Port.hpp:20
float getNormalPolyVoltage(float normalVoltage, uint8_t channel)
Definition Port.hpp:64
void setChannels(uint8_t channels)
Sets the number of polyphony channels.
Definition Port.hpp:156
T getVoltageSimd(uint8_t firstChannel)
Definition Port.hpp:127
void readVoltages(float *v)
Copies the port's voltages to an array of size at least channels.
Definition Port.hpp:76
void setVoltageSimd(T voltage, uint8_t firstChannel)
Definition Port.hpp:147
T getNormalPolyVoltageSimd(T normalVoltage, uint8_t firstChannel)
Definition Port.hpp:142