Switchboard SDK
|
Linear ramp with fixed duration that can be used for smoothing audio samples. More...
#include <Ramp.hpp>
Public Member Functions | |
Ramp () | |
Ramp constructor. | |
~Ramp () | |
Ramp destructor. | |
float | getValue () const |
Gets the current value of the ramp. | |
void | setValue (const float newValue) |
Sets the current value of the ramp. Restarts ramping. | |
float | getTargetValue () const |
Gets the current target value. | |
void | setTargetValue (const float newValue) |
Sets the target value. Restarts ramping. | |
uint | getRampDurationSamples () const |
Gets the duration of the ramp in samples. | |
void | setRampDurationSamples (const uint numberOfSamples) |
Sets the duration of the ramp in samples. Restarts ramping. | |
uint | getRampDurationMs () const |
Gets the duration of the ramp in milliseconds. | |
void | setRampDurationMs (const uint durationMs) |
Sets the duration of the ramp in milliseconds. Restarts ramping. | |
uint | getSampleRate () const |
Gets the sample rate. | |
void | setSampleRate (const uint sampleRate) |
Sets the sample rate. | |
uint | getRemainingSamplesToTargetValue () const |
Gets the remaining samples until the target value in the current ramp. | |
float | process (const uint numberOfSamples) |
Processes the ramp and jumps numberOfSamples steps forward. | |
Static Public Member Functions | |
static void | rampMultiply (float *input, float *output, float start, float end, uint numberOfValues) |
Applies a linear ramp multiplier to a buffer. | |
static void | rampMultiplyInterleaved (float *input, float *output, float start, float end, uint numberOfFrames, uint numberOfChannels) |
Applies a linear ramp multiplier to an interleaved buffer. | |
Linear ramp with fixed duration that can be used for smoothing audio samples.
The duration of the ramp can be set specified in number of samples or in milliseconds. If milliseconds is used, the sampleRate property needs to be set too.
uint switchboard::Ramp::getRampDurationMs | ( | ) | const |
Gets the duration of the ramp in milliseconds.
uint switchboard::Ramp::getRampDurationSamples | ( | ) | const |
Gets the duration of the ramp in samples.
uint switchboard::Ramp::getRemainingSamplesToTargetValue | ( | ) | const |
Gets the remaining samples until the target value in the current ramp.
The value changes after the process call.
uint switchboard::Ramp::getSampleRate | ( | ) | const |
Gets the sample rate.
float switchboard::Ramp::getTargetValue | ( | ) | const |
Gets the current target value.
float switchboard::Ramp::getValue | ( | ) | const |
Gets the current value of the ramp.
float switchboard::Ramp::process | ( | const uint | numberOfSamples | ) |
Processes the ramp and jumps numberOfSamples steps forward.
numberOfSamples | The number of steps to jump in the ramp. |
|
static |
Applies a linear ramp multiplier to a buffer.
input | The input buffer. |
output | The output buffer. |
start | The start value of the ramp. |
end | The end value of the ramp. |
numberOfValues | The number of values in the buffers. |
|
static |
Applies a linear ramp multiplier to an interleaved buffer.
input | The interleaved input buffer. |
output | The interleaved output buffer. |
start | The start value of the ramp. |
end | The end value of the ramp. |
numberOfFrames | The number of audio frames in the buffers. |
numberOfChannels | The number of audio channels in the buffers. |
void switchboard::Ramp::setRampDurationMs | ( | const uint | durationMs | ) |
Sets the duration of the ramp in milliseconds. Restarts ramping.
durationMs | The new ramp duration in milliseconds. |
void switchboard::Ramp::setRampDurationSamples | ( | const uint | numberOfSamples | ) |
Sets the duration of the ramp in samples. Restarts ramping.
numberOfSamples | The new ramp duration in samples. |
void switchboard::Ramp::setSampleRate | ( | const uint | sampleRate | ) |
Sets the sample rate.
sampleRate | The new sample rate. |
void switchboard::Ramp::setTargetValue | ( | const float | newValue | ) |
Sets the target value. Restarts ramping.
newValue | The new target value. |
void switchboard::Ramp::setValue | ( | const float | newValue | ) |
Sets the current value of the ramp. Restarts ramping.
newValue | The new value to jump to. |