Sequencer step and reset

This commit is contained in:
2022-02-03 19:25:19 -05:00
parent d5f2a5521b
commit 6c335ccabb
4 changed files with 51 additions and 3 deletions

View File

@ -9,7 +9,14 @@ SequencerDroplet::SequencerDroplet(DaisyPatch* m_patch,
SequencerDroplet::~SequencerDroplet() {}
void SequencerDroplet::Control() {}
void SequencerDroplet::Control() {
if(Patch()->gate_input[0].Trig()) {
Step();
}
if(Patch()->gate_input[1].Trig()) {
Reset();
}
}
void SequencerDroplet::Process(AudioHandle::InputBuffer in,
AudioHandle::OutputBuffer out,
@ -17,9 +24,18 @@ void SequencerDroplet::Process(AudioHandle::InputBuffer in,
}
void SequencerDroplet::Draw() {
WriteString(Patch(), 0, 10, std::to_string(step));
DrawName("Sequencer");
}
void SequencerDroplet::UpdateStateCallback() {}
void SequencerDroplet::SetControls() {}
void SequencerDroplet::Step() {
step = (step + 1) % MAX_SEQUENCE_LENGTH;
}
void SequencerDroplet::Reset() {
step = 0;
}

View File

@ -9,11 +9,22 @@
#include "droplet.h"
#include "../util.h"
#define MAX_SEQUENCE_LENGTH 32
class SequencerDroplet: public Droplet {
private:
int sequence_length = 32;
int step = 0;
float swquence[32] = { 0.0f };
float swquence[MAX_SEQUENCE_LENGTH] = { 0.0f };
/*
* Set the sequencer to the next step.
*/
void Step();
/*
* Reset the sequencers to the first step of the sequence.
*/
void Reset();
public:
/*
* Constructor for a droplet.