From e46e0f0265014ac811b5f29240909262f3c49189 Mon Sep 17 00:00:00 2001 From: Christian Colglazier Date: Sun, 6 Feb 2022 15:50:11 -0500 Subject: [PATCH] Improved sequencer deadzone --- src/droplets/sequencer_droplet.cpp | 13 ++++++++----- src/droplets/sequencer_droplet.h | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/droplets/sequencer_droplet.cpp b/src/droplets/sequencer_droplet.cpp index d6e07ec..699f50b 100644 --- a/src/droplets/sequencer_droplet.cpp +++ b/src/droplets/sequencer_droplet.cpp @@ -23,13 +23,16 @@ void SequencerDroplet::Control() { Reset(); } - for (size_t chn = GetChannelMin(); chn < GetChannelMax(); chn++) { - if (std::abs(control[chn].Process()-last_control_value[chn]) > CONTROL_DEADZONE) { - sequence[chn+selected*num_columns] = control[chn].Process(); + if (control_rate_count == CONTROL_RATE_LIMIT) { + for (size_t chn = GetChannelMin(); chn < GetChannelMax(); chn++) { + if (std::abs(control[chn].Process()-last_control_value[chn]) > CONTROL_DEADZONE) { + sequence[chn+selected*num_columns] = control[chn].Process(); } - last_control_value[chn] = control[chn].Process(); + last_control_value[chn] = control[chn].Process(); + } + control_rate_count = 0; } - + control_rate_count++; } void SequencerDroplet::Process(AudioHandle::InputBuffer in, diff --git a/src/droplets/sequencer_droplet.h b/src/droplets/sequencer_droplet.h index 7964869..6573b80 100644 --- a/src/droplets/sequencer_droplet.h +++ b/src/droplets/sequencer_droplet.h @@ -10,7 +10,8 @@ #include "../util.h" #define MAX_SEQUENCE_LENGTH 32 -#define CONTROL_DEADZONE 0.005f +#define CONTROL_DEADZONE 0.003f +#define CONTROL_RATE_LIMIT 20 #define NUM_ROWS 6 class SequencerDroplet: public Droplet { @@ -19,6 +20,7 @@ private: int selected = 0; int sequence_length = 16; int num_columns = 4; + int control_rate_count = 0; float sequence[MAX_SEQUENCE_LENGTH] = { 0.0f }; Parameter control[4]; float last_control_value[4] = { 0.0f };