mirror of
https://github.com/AquaMorph/Droplets.git
synced 2025-04-29 17:35:33 +00:00
Basic sequencer controls
This commit is contained in:
parent
6c335ccabb
commit
ffcea81e57
@ -5,6 +5,7 @@ SequencerDroplet::SequencerDroplet(DaisyPatch* m_patch,
|
||||
float sample_rate) :
|
||||
Droplet(m_patch,
|
||||
m_state) {
|
||||
SetControls();
|
||||
}
|
||||
|
||||
SequencerDroplet::~SequencerDroplet() {}
|
||||
@ -16,11 +17,20 @@ void SequencerDroplet::Control() {
|
||||
if(Patch()->gate_input[1].Trig()) {
|
||||
Reset();
|
||||
}
|
||||
|
||||
for (size_t chn = GetChannelMin(); chn < GetChannelMax(); chn++) {
|
||||
sequence[chn+selected] = control[chn].Process();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SequencerDroplet::Process(AudioHandle::InputBuffer in,
|
||||
AudioHandle::OutputBuffer out,
|
||||
size_t size) {
|
||||
for(size_t i = 0; i < size; i++) {
|
||||
Patch()->seed.dac.WriteValue(DacHandle::Channel::ONE,
|
||||
sequence[step] * 819.2f);
|
||||
}
|
||||
}
|
||||
|
||||
void SequencerDroplet::Draw() {
|
||||
@ -30,7 +40,16 @@ void SequencerDroplet::Draw() {
|
||||
|
||||
void SequencerDroplet::UpdateStateCallback() {}
|
||||
|
||||
void SequencerDroplet::SetControls() {}
|
||||
void SequencerDroplet::SetControls() {
|
||||
control[0].Init(Patch()->controls[Patch()->CTRL_1],
|
||||
0.0, 5.0f, Parameter::LINEAR);
|
||||
control[1].Init(Patch()->controls[Patch()->CTRL_2],
|
||||
0.0, 5.0f, Parameter::LINEAR);
|
||||
control[2].Init(Patch()->controls[Patch()->CTRL_3],
|
||||
0.0, 5.0f, Parameter::LINEAR);
|
||||
control[3].Init(Patch()->controls[Patch()->CTRL_4],
|
||||
0.0, 5.0f, Parameter::LINEAR);
|
||||
}
|
||||
|
||||
void SequencerDroplet::Step() {
|
||||
step = (step + 1) % MAX_SEQUENCE_LENGTH;
|
||||
|
@ -10,11 +10,15 @@
|
||||
#include "../util.h"
|
||||
|
||||
#define MAX_SEQUENCE_LENGTH 32
|
||||
#define CONTROL_DEADZONE = 0.01f
|
||||
|
||||
class SequencerDroplet: public Droplet {
|
||||
private:
|
||||
int step = 0;
|
||||
float swquence[MAX_SEQUENCE_LENGTH] = { 0.0f };
|
||||
int selected = 0;
|
||||
float sequence[MAX_SEQUENCE_LENGTH] = { 0.0f };
|
||||
Parameter control[4];
|
||||
float last_control_value[4] = { 0.0f };
|
||||
|
||||
/*
|
||||
* Set the sequencer to the next step.
|
||||
|
Loading…
x
Reference in New Issue
Block a user