commit 712565192f9a39c58aaf90696d2bcd5dd2dd01db
parent 02f5852cb808ddd4d4c0dfd4097b4c46912717d8
Author: Matt Demanett <matt@demanett.net>
Date: Sun, 14 Oct 2018 18:08:34 -0400
Clean up S&H. #18?
Diffstat:
2 files changed, 12 insertions(+), 31 deletions(-)
diff --git a/src/SampleHold.cpp b/src/SampleHold.cpp
@@ -3,9 +3,9 @@
void SampleHold::onReset() {
_trigger1.reset();
- _value1 = 0.0;
+ _value1 = 0.0f;
_trigger2.reset();
- _value1 = 0.0;
+ _value2 = 0.0f;
}
void SampleHold::step() {
@@ -30,25 +30,6 @@ void SampleHold::step() {
outputs[OUT2_OUTPUT].value = _value2;
}
-void SampleHold::step(
- Param& triggerParam,
- Input& triggerInput,
- Input& in,
- Output& out,
- SchmittTrigger& trigger,
- float& value
-) {
- if (trigger.process(triggerParam.value + triggerInput.value)) {
- if (in.active) {
- value = in.value;
- }
- else {
- value = abs(_noise.next()) * 10.0;
- }
- }
- out.value = value;
-}
-
struct SampleHoldWidget : ModuleWidget {
static constexpr int hp = 3;
diff --git a/src/SampleHold.hpp b/src/SampleHold.hpp
@@ -16,7 +16,7 @@ struct SampleHold : Module {
NUM_PARAMS
};
- enum InputIds {
+ enum InputsIds {
TRIGGER1_INPUT,
IN1_INPUT,
TRIGGER2_INPUT,
@@ -30,24 +30,24 @@ struct SampleHold : Module {
NUM_OUTPUTS
};
+ enum LightsIds {
+ NUM_LIGHTS
+ };
+
SchmittTrigger _trigger1, _trigger2;
float _value1, _value2;
WhiteNoiseGenerator _noise;
- SampleHold() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {
+ SampleHold()
+ : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS)
+ , _value1(0.0f)
+ , _value2(0.0f)
+ {
onReset();
}
void onReset() override;
void step() override;
- void step(
- Param& triggerParam,
- Input& triggerInput,
- Input& in,
- Output& out,
- SchmittTrigger& trigger,
- float& value
- );
};
} // namespace bogaudio