mirror of
https://github.com/AquaMorph/Droplets.git
synced 2025-04-29 17:35:33 +00:00
Sequencer clock divider
This commit is contained in:
parent
eebafd5890
commit
744cdd3713
@ -52,10 +52,15 @@ void SequencerDroplet::Process(AudioHandle::InputBuffer in,
|
||||
// Set sequence length
|
||||
if (chn == GetChannelMin()) {
|
||||
sequence_length = std::max(1.0f,control[chn].Process() /
|
||||
4.9f*MAX_SEQUENCE_LENGTH);
|
||||
4.85f*MAX_SEQUENCE_LENGTH);
|
||||
SetDimensions();
|
||||
SetInMenu();
|
||||
}
|
||||
// Set clock divider
|
||||
if (chn == GetChannelMin()+1) {
|
||||
divider = std::max(1.0f,control[chn].Process() /
|
||||
4.85f*MAX_CLOCK_DIVIDE);
|
||||
}
|
||||
}
|
||||
}
|
||||
last_control_value[chn] = control[chn].Process();
|
||||
@ -113,6 +118,11 @@ void SequencerDroplet::Draw() {
|
||||
56,
|
||||
length_text,
|
||||
!InMenu());
|
||||
WriteString(Patch(),
|
||||
36+GetScreenMin(),
|
||||
56,
|
||||
std::to_string(divider),
|
||||
!InMenu());
|
||||
|
||||
if(NeedUpdate()) {
|
||||
title_graph->Update();
|
||||
@ -141,7 +151,10 @@ void SequencerDroplet::SetControls() {
|
||||
}
|
||||
|
||||
void SequencerDroplet::Step() {
|
||||
divider_count = (divider_count + 1) % divider;
|
||||
if (divider_count == 0) {
|
||||
step = (step + 1) % sequence_length;
|
||||
}
|
||||
}
|
||||
|
||||
void SequencerDroplet::Reset() {
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "../graphics/graph.h"
|
||||
|
||||
#define MAX_SEQUENCE_LENGTH 32
|
||||
#define MAX_CLOCK_DIVIDE 16
|
||||
#define CONTROL_DEADZONE 0.00499f
|
||||
#define CONTROL_RATE_LIMIT 25
|
||||
#define NUM_ROWS 6
|
||||
@ -23,6 +24,8 @@ private:
|
||||
int num_columns = 4;
|
||||
int num_rows = NUM_ROWS;
|
||||
int control_rate_count = 0;
|
||||
int divider = 0;
|
||||
int divider_count = 1;
|
||||
float sequence[MAX_SEQUENCE_LENGTH] = { 0.0f };
|
||||
Parameter control[4];
|
||||
float last_control_value[4] = { 0.0f };
|
||||
|
Loading…
x
Reference in New Issue
Block a user