2021-07-27 09:47:15 +02:00
|
|
|
//
|
|
|
|
// Created by mart on 7/26/21.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "TubeSimulator.h"
|
|
|
|
|
|
|
|
TubeSimulator::TubeSimulator() {
|
|
|
|
this->acc[0] = 0.f;
|
|
|
|
this->acc[1] = 0.f;
|
|
|
|
this->enabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TubeSimulator::Reset() {
|
|
|
|
this->acc[0] = 0.f;
|
|
|
|
this->acc[1] = 0.f;
|
|
|
|
this->enabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TubeSimulator::TubeProcess(float *buffer, uint32_t size) {
|
|
|
|
if (this->enabled && size > 0) {
|
|
|
|
for (int x = 0; x < size; x++) {
|
2022-08-23 00:26:44 +02:00
|
|
|
this->acc[0] = (this->acc[0] + buffer[2 * x]) / 2.f;
|
|
|
|
this->acc[1] = (this->acc[1] + buffer[2 * x + 1]) / 2.f;
|
|
|
|
buffer[2 * x] = this->acc[0];
|
|
|
|
buffer[2 * x + 1] = this->acc[1];
|
2021-07-27 09:47:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|