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) :
|
float sample_rate) :
|
||||||
Droplet(m_patch,
|
Droplet(m_patch,
|
||||||
m_state) {
|
m_state) {
|
||||||
|
SetControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
SequencerDroplet::~SequencerDroplet() {}
|
SequencerDroplet::~SequencerDroplet() {}
|
||||||
@ -16,11 +17,20 @@ void SequencerDroplet::Control() {
|
|||||||
if(Patch()->gate_input[1].Trig()) {
|
if(Patch()->gate_input[1].Trig()) {
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (size_t chn = GetChannelMin(); chn < GetChannelMax(); chn++) {
|
||||||
|
sequence[chn+selected] = control[chn].Process();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequencerDroplet::Process(AudioHandle::InputBuffer in,
|
void SequencerDroplet::Process(AudioHandle::InputBuffer in,
|
||||||
AudioHandle::OutputBuffer out,
|
AudioHandle::OutputBuffer out,
|
||||||
size_t size) {
|
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() {
|
void SequencerDroplet::Draw() {
|
||||||
@ -30,7 +40,16 @@ void SequencerDroplet::Draw() {
|
|||||||
|
|
||||||
void SequencerDroplet::UpdateStateCallback() {}
|
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() {
|
void SequencerDroplet::Step() {
|
||||||
step = (step + 1) % MAX_SEQUENCE_LENGTH;
|
step = (step + 1) % MAX_SEQUENCE_LENGTH;
|
||||||
|
@ -10,11 +10,15 @@
|
|||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
|
|
||||||
#define MAX_SEQUENCE_LENGTH 32
|
#define MAX_SEQUENCE_LENGTH 32
|
||||||
|
#define CONTROL_DEADZONE = 0.01f
|
||||||
|
|
||||||
class SequencerDroplet: public Droplet {
|
class SequencerDroplet: public Droplet {
|
||||||
private:
|
private:
|
||||||
int step = 0;
|
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.
|
* Set the sequencer to the next step.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user