MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / getVoltageRMS

Method getVoltageRMS

include/engine/Port.hpp:148–162  ·  view source on GitHub ↗

Returns the root-mean-square of all voltages. Uses sqrt() which is slow, so use a custom approximation if calling frequently. */

Source from the content-addressed store, hash-verified

146 Uses sqrt() which is slow, so use a custom approximation if calling frequently.
147 */
148 float getVoltageRMS() const {
149 if (channels == 0) {
150 return 0.f;
151 }
152 else if (channels == 1) {
153 return std::fabs(voltages[0]);
154 }
155 else {
156 float sum = 0.f;
157 for (int c = 0; c < channels; c++) {
158 sum += std::pow(voltages[c], 2);
159 }
160 return std::sqrt(sum);
161 }
162 }
163
164 template <typename T>
165 T getVoltageSimd(int firstChannel) const noexcept {

Callers 1

Port_stepFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected