commit 16b44ee1aa5fe60d723f55f3e77c43774f2f6113
parent 25c530a9591d895245d03953af54cbdcbeed9d41
Author: Matt Demanett <matt@demanett.net>
Date: Wed, 14 Oct 2020 22:13:42 -0400
Fix bug where modules would not receive reset() on load when the sample rate is not hte default. #150
Diffstat:
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/Assign.hpp b/src/Assign.hpp
@@ -41,7 +41,6 @@ struct Assign : BGModule {
Assign() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS);
configParam(CHANNELS_PARAM, 1.0f, 16.0f, 0.0f, "Channels");
- reset();
}
void reset() override;
diff --git a/src/module.cpp b/src/module.cpp
@@ -40,7 +40,8 @@ void BGModule::dataFromJson(json_t* root) {
}
void BGModule::process(const ProcessArgs& args) {
- if (_steps < 0) {
+ if (!_initialized) {
+ _initialized = true;
onReset();
onSampleRateChange();
}
diff --git a/src/module.hpp b/src/module.hpp
@@ -16,6 +16,7 @@ struct SkinChangeListener {
struct BGModule : Module {
int _modulationSteps = 100;
int _steps = -1;
+ bool _initialized = false;
static constexpr int maxChannels = PORT_MAX_CHANNELS;
int _channels = 0;