From 45fc7ea9a5696230116f3507b8df691b8f8dbf51 Mon Sep 17 00:00:00 2001 From: Christian Colglazier Date: Mon, 7 Feb 2022 21:35:46 -0500 Subject: [PATCH] Sequencer documentation --- src/droplets/sequencer_droplet.cpp | 16 +++++++++------- src/droplets/sequencer_droplet.h | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/droplets/sequencer_droplet.cpp b/src/droplets/sequencer_droplet.cpp index 6ded1e9..5b9d527 100644 --- a/src/droplets/sequencer_droplet.cpp +++ b/src/droplets/sequencer_droplet.cpp @@ -5,7 +5,7 @@ SequencerDroplet::SequencerDroplet(DaisyPatch* m_patch, float sample_rate) : Droplet(m_patch, m_state) { - SetColumns(); + SetDimensions(); SetControls(); AdjustSelected(-1); } @@ -36,18 +36,20 @@ void SequencerDroplet::Process(AudioHandle::InputBuffer in, if (control_rate_count == CONTROL_RATE_LIMIT) { for (size_t chn = GetChannelMin(); chn < GetChannelMax(); chn++) { - if (std::abs(control[chn].Process()-last_control_value[chn]) > CONTROL_DEADZONE) { + if (std::abs(control[chn].Process() + -last_control_value[chn]) > CONTROL_DEADZONE) { if (!InMenu()) { sequence[chn+selected*num_columns] = control[chn].Process(); } else { if (chn == GetChannelMin()) { - sequence_length = std::max(1.0f,control[chn].Process()/4.9f*MAX_SEQUENCE_LENGTH); - SetColumns(); + sequence_length = std::max(1.0f,control[chn].Process() / + 4.9f*MAX_SEQUENCE_LENGTH); + SetDimensions(); selected = 0; AdjustSelected(-1); } } - } + } last_control_value[chn] = control[chn].Process(); } control_rate_count = 0; @@ -104,7 +106,7 @@ void SequencerDroplet::Draw() { } void SequencerDroplet::UpdateStateCallback() { - SetColumns(); + SetDimensions(); } void SequencerDroplet::SetControls() { @@ -126,7 +128,7 @@ void SequencerDroplet::Reset() { step = 0; } -void SequencerDroplet::SetColumns() { +void SequencerDroplet::SetDimensions() { if (GetState() != DropletState::kFull) { num_columns = 2; } else { diff --git a/src/droplets/sequencer_droplet.h b/src/droplets/sequencer_droplet.h index ae027d0..f451c7c 100644 --- a/src/droplets/sequencer_droplet.h +++ b/src/droplets/sequencer_droplet.h @@ -37,10 +37,23 @@ private: */ void Reset(); - void SetColumns(); + /* + * Set the screeen dimensions of the sequence. + */ + void SetDimensions(); + /* + * Change the selected menu input. + * + * @param adj amount to adjust menu + */ void AdjustSelected(int adj); + /* + * Returns if the sequencer menu is selected. + * + * @return menu state + */ bool InMenu(); public: /*