![]() |
VCV Rack API v2
|
#include <Port.hpp>
Public Types | |
| enum | Type { INPUT , OUTPUT } |
Public Member Functions | |
| void | setVoltage (float voltage, uint8_t channel=0) |
| Sets the voltage of the given channel. | |
| float | getVoltage (uint8_t channel=0) |
| Returns the voltage of the given channel. | |
| float | getPolyVoltage (uint8_t channel) |
| Returns the given channel's voltage if the port is polyphonic, otherwise returns the first voltage (channel 0). | |
| float | getNormalVoltage (float normalVoltage, uint8_t channel=0) |
| Returns the voltage if a cable is connected, otherwise returns the given normal voltage. | |
| float | getNormalPolyVoltage (float normalVoltage, uint8_t channel) |
| float * | getVoltages (uint8_t firstChannel=0) |
| Returns a pointer to the array of voltages beginning with firstChannel. | |
| void | readVoltages (float *v) |
| Copies the port's voltages to an array of size at least channels. | |
| void | writeVoltages (const float *v) |
| Copies an array of size at least channels to the port's voltages. | |
| void | clearVoltages () |
| Sets all voltages to 0. | |
| float | getVoltageSum () |
| Returns the sum of all voltages. | |
| float | getVoltageRMS () |
| Returns the root-mean-square of all voltages. | |
| template<typename T> | |
| T | getVoltageSimd (uint8_t firstChannel) |
| template<typename T> | |
| T | getPolyVoltageSimd (uint8_t firstChannel) |
| template<typename T> | |
| T | getNormalVoltageSimd (T normalVoltage, uint8_t firstChannel) |
| template<typename T> | |
| T | getNormalPolyVoltageSimd (T normalVoltage, uint8_t firstChannel) |
| template<typename T> | |
| void | setVoltageSimd (T voltage, uint8_t firstChannel) |
| void | setChannels (uint8_t channels) |
| Sets the number of polyphony channels. | |
| int | getChannels () |
| Returns the number of channels. | |
| bool | isConnected () |
| Returns whether a cable is connected to the Port. | |
| bool | isMonophonic () |
| Returns whether the cable exists and has 1 channel. | |
| bool | isPolyphonic () |
| Returns whether the cable exists and has more than 1 channel. | |
| DEPRECATED float | normalize (float normalVoltage) |
| Use getNormalVoltage() instead. | |
Public Attributes | |
| union { | |
| float voltages [PORT_MAX_CHANNELS] = {} | |
| Unstable API. More... | |
| float value | |
| DEPRECATED. More... | |
| }; | |
| Voltage of the port. | |
| union { | |
| uint8_t channels = 0 | |
| Number of polyphonic channels. More... | |
| uint8_t active | |
| DEPRECATED. More... | |
| }; | |
| Light | plugLights [3] |
| For rendering plug lights on cables. | |
|
inline |
Sets the voltage of the given channel.
|
inline |
Returns the voltage of the given channel.
Because of proper bookkeeping, all channels higher than the input port's number of channels should be 0V.
|
inline |
Returns the given channel's voltage if the port is polyphonic, otherwise returns the first voltage (channel 0).
|
inline |
Returns the voltage if a cable is connected, otherwise returns the given normal voltage.
|
inline |
|
inline |
Returns a pointer to the array of voltages beginning with firstChannel.
The pointer can be used for reading and writing.
|
inline |
Copies the port's voltages to an array of size at least channels.
|
inline |
Copies an array of size at least channels to the port's voltages.
Remember to set the number of channels before calling this method.
|
inline |
Sets all voltages to 0.
|
inline |
Returns the sum of all voltages.
|
inline |
Returns the root-mean-square of all voltages.
Uses sqrt() which is slow, so use a custom approximation if calling frequently.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the number of channels.
If the port is disconnected, it has 0 channels.
|
inline |
Returns whether a cable is connected to the Port.
You can use this for skipping code that generates output voltages.
|
inline |
Returns whether the cable exists and has 1 channel.
|
inline |
Returns whether the cable exists and has more than 1 channel.
|
inline |
Use getNormalVoltage() instead.
"Normal" voltage is the correct term, not "normalized" voltage.
| float rack::engine::Port::voltages[PORT_MAX_CHANNELS] = {} |
Unstable API.
Use getVoltage() and setVoltage() instead.
| float rack::engine::Port::value |
DEPRECATED.
Unstable API. Use getVoltage() and setVoltage() instead.
| union { ... } rack::engine::Port |
Voltage of the port.
| uint8_t rack::engine::Port::channels = 0 |
Number of polyphonic channels.
DEPRECATED. Unstable API. Use set/getChannels() instead. May be 0 to PORT_MAX_CHANNELS. 0 channels means disconnected.
| uint8_t rack::engine::Port::active |
DEPRECATED.
Unstable API. Use isConnected() instead.
| union { ... } rack::engine::Port |
| Light rack::engine::Port::plugLights[3] |
For rendering plug lights on cables.
Green for positive, red for negative, and blue for polyphonic.