mirror of
https://github.com/AquaMorph/Droplets.git
synced 2025-04-29 17:35:33 +00:00
Sequencer deadzone
This commit is contained in:
parent
c6b401dc8e
commit
d976d69d27
@ -12,6 +12,10 @@ SequencerDroplet::SequencerDroplet(DaisyPatch* m_patch,
|
|||||||
SequencerDroplet::~SequencerDroplet() {}
|
SequencerDroplet::~SequencerDroplet() {}
|
||||||
|
|
||||||
void SequencerDroplet::Control() {
|
void SequencerDroplet::Control() {
|
||||||
|
Patch()->ProcessAnalogControls();
|
||||||
|
Patch()->encoder.Debounce();
|
||||||
|
AdjustSelected(Patch()->encoder.Increment());
|
||||||
|
|
||||||
if(Patch()->gate_input[0].Trig()) {
|
if(Patch()->gate_input[0].Trig()) {
|
||||||
Step();
|
Step();
|
||||||
}
|
}
|
||||||
@ -20,7 +24,10 @@ void SequencerDroplet::Control() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (size_t chn = GetChannelMin(); chn < GetChannelMax(); chn++) {
|
for (size_t chn = GetChannelMin(); chn < GetChannelMax(); chn++) {
|
||||||
sequence[chn+selected] = 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -81,3 +88,8 @@ void SequencerDroplet::SetColumns() {
|
|||||||
num_columns = 4;
|
num_columns = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SequencerDroplet::AdjustSelected(int adj) {
|
||||||
|
int rows = std::ceil(sequence_length/num_columns);
|
||||||
|
selected = (rows+selected+adj) % rows;
|
||||||
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
|
|
||||||
#define MAX_SEQUENCE_LENGTH 32
|
#define MAX_SEQUENCE_LENGTH 32
|
||||||
#define CONTROL_DEADZONE 0.03f
|
#define CONTROL_DEADZONE 0.005f
|
||||||
#define NUM_ROWS 6
|
#define NUM_ROWS 6
|
||||||
|
|
||||||
class SequencerDroplet: public Droplet {
|
class SequencerDroplet: public Droplet {
|
||||||
@ -34,6 +34,8 @@ private:
|
|||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
void SetColumns();
|
void SetColumns();
|
||||||
|
|
||||||
|
void AdjustSelected(int adj);
|
||||||
public:
|
public:
|
||||||
/*
|
/*
|
||||||
* Constructor for a droplet.
|
* Constructor for a droplet.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user