From 9739c0227708fab7a28b4efef7b27a9a1bc098d1 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 3 May 2020 09:14:24 -0400 Subject: [PATCH] Stages: Make kSampleAndHoldDelay local because it depends on the sample rate, which was made a class variable. --- stages/segment_generator.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stages/segment_generator.cc b/stages/segment_generator.cc index 0134210d..66674f38 100644 --- a/stages/segment_generator.cc +++ b/stages/segment_generator.cc @@ -48,10 +48,6 @@ using namespace segment; // output is high. const int kRetrigDelaySamples = 32; -// S&H delay (for all those sequencers whose CV and GATE outputs are out of -// sync). -const size_t kSampleAndHoldDelay = kSampleRate * 2 / 1000; // 2 milliseconds - void SegmentGenerator::Init() { process_fn_ = &SegmentGenerator::ProcessMultiSegment; @@ -258,10 +254,14 @@ void SegmentGenerator::ProcessSampleAndHold( parameters_[0].secondary); ParameterInterpolator primary(&primary_, parameters_[0].primary, size); + // S&H delay (for all those sequencers whose CV and GATE outputs are out of + // sync). + const size_t sampleAndHoldDelay = sample_rate_ * 2 / 1000; // 2 milliseconds + while (size--) { const float p = primary.Next(); gate_delay_.Write(*gate_flags); - if (gate_delay_.Read(kSampleAndHoldDelay) & GATE_FLAG_RISING) { + if (gate_delay_.Read(sampleAndHoldDelay) & GATE_FLAG_RISING) { value_ = p; } active_segment_ = *gate_flags & GATE_FLAG_HIGH ? 0 : 1;