commit ee8cfbf5db9f008152d0cf37a5fd45e3a95aea08
parent 382d6485e9c5d4afd0d8bf365da5b7c93131bc03
Author: Matt Demanett <matt@demanett.net>
Date: Tue, 1 Oct 2019 22:01:31 -0400
Fix modulation rate at every 10ms regardless of sample rate.
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/module.cpp b/src/module.cpp
@@ -9,6 +9,7 @@ void BGModule::onReset() {
}
void BGModule::onSampleRateChange() {
+ _modulationSteps = APP->engine->getSampleRate() / 100.0f;
_steps = _modulationSteps;
sampleRateChange();
}
diff --git a/src/module.hpp b/src/module.hpp
@@ -7,14 +7,15 @@ using namespace rack;
namespace bogaudio {
struct BGModule : Module {
- int _modulationSteps;
+ int _modulationSteps = 100;
int _steps = 0;
static constexpr int maxChannels = PORT_MAX_CHANNELS;
int _channels = 0;
- BGModule(int modulationSteps = 100) : _modulationSteps(modulationSteps) {
- _steps = _modulationSteps;
+ BGModule() {
+ reset();
+ onSampleRateChange();
}
virtual ~BGModule() {
while (_channels >= 1) {