Improved sequencer deadzone

This commit is contained in:
Christian Colglazier 2022-02-06 15:50:11 -05:00
parent d976d69d27
commit e46e0f0265
2 changed files with 11 additions and 6 deletions

View File

@ -23,13 +23,16 @@ void SequencerDroplet::Control() {
Reset(); Reset();
} }
for (size_t chn = GetChannelMin(); chn < GetChannelMax(); chn++) { if (control_rate_count == CONTROL_RATE_LIMIT) {
if (std::abs(control[chn].Process()-last_control_value[chn]) > CONTROL_DEADZONE) { for (size_t chn = GetChannelMin(); chn < GetChannelMax(); chn++) {
sequence[chn+selected*num_columns] = control[chn].Process(); 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, void SequencerDroplet::Process(AudioHandle::InputBuffer in,

View File

@ -10,7 +10,8 @@
#include "../util.h" #include "../util.h"
#define MAX_SEQUENCE_LENGTH 32 #define MAX_SEQUENCE_LENGTH 32
#define CONTROL_DEADZONE 0.005f #define CONTROL_DEADZONE 0.003f
#define CONTROL_RATE_LIMIT 20
#define NUM_ROWS 6 #define NUM_ROWS 6
class SequencerDroplet: public Droplet { class SequencerDroplet: public Droplet {
@ -19,6 +20,7 @@ private:
int selected = 0; int selected = 0;
int sequence_length = 16; int sequence_length = 16;
int num_columns = 4; int num_columns = 4;
int control_rate_count = 0;
float sequence[MAX_SEQUENCE_LENGTH] = { 0.0f }; float sequence[MAX_SEQUENCE_LENGTH] = { 0.0f };
Parameter control[4]; Parameter control[4];
float last_control_value[4] = { 0.0f }; float last_control_value[4] = { 0.0f };