diff --git a/src/droplets/droplet.cpp b/src/droplets/droplet.cpp index e965e69..699decd 100644 --- a/src/droplets/droplet.cpp +++ b/src/droplets/droplet.cpp @@ -17,6 +17,19 @@ DropletState Droplet::GetState() { return state; } +bool Droplet::IsLeft() { + return GetState() == DropletState::kLeft; +} + +bool Droplet::IsRight() { + return GetState() == DropletState::kRight; +} + +bool Droplet::IsFull() { + return GetState() == DropletState::kFull; +} + + int Droplet::GetTitleHeight() { return kTitleHeight; } diff --git a/src/droplets/droplet.h b/src/droplets/droplet.h index eb848d0..7fa88ee 100644 --- a/src/droplets/droplet.h +++ b/src/droplets/droplet.h @@ -92,6 +92,27 @@ public: */ DropletState GetState(); + /* + * Returns if the droplet is in the left state. + * + * @ return droplet in left state + */ + bool IsLeft(); + + /* + * Returns if the droplet is in the right state. + * + * @ return droplet in right state + */ + bool IsRight(); + + /* + * Returns if the droplet is in the full state. + * + * @ return droplet in full state + */ + bool IsFull(); + /* * Returns the height of the title bar of the droplet. * diff --git a/src/droplets/sequencer_droplet.cpp b/src/droplets/sequencer_droplet.cpp index 23b11bf..02ff4bc 100644 --- a/src/droplets/sequencer_droplet.cpp +++ b/src/droplets/sequencer_droplet.cpp @@ -21,13 +21,14 @@ void SequencerDroplet::Control() { void SequencerDroplet::Process(AudioHandle::InputBuffer in, AudioHandle::OutputBuffer out, size_t size) { - if(GetState() != DropletState::kRight && - Patch()->gate_input[0].Trig()) { + // Step input for full and left droplets + if(!IsRight() && Patch()->gate_input[0].Trig()) { Step(); } - if(GetState() != DropletState::kLeft && - Patch()->gate_input[1].Trig()) { - if (GetState() == DropletState::kFull) { + + // Step for right droplet and reset for full + if(!IsLeft() && Patch()->gate_input[1].Trig()) { + if (IsFull()) { Reset(); } else { Step(); @@ -55,13 +56,13 @@ void SequencerDroplet::Process(AudioHandle::InputBuffer in, } control_rate_count++; - + // VC output of sequencer for(size_t i = 0; i < size; i++) { - if (GetState() != DropletState::kRight) { + if (!IsRight()) { Patch()->seed.dac.WriteValue(DacHandle::Channel::ONE, sequence[step] * 819.2f); } - if (GetState() != DropletState::kLeft) { + if (!IsRight()) { Patch()->seed.dac.WriteValue(DacHandle::Channel::TWO, sequence[step] * 819.2f); } @@ -72,7 +73,6 @@ void SequencerDroplet::Draw() { int left_padding = 4+GetScreenMin(); int offset = step / (num_columns*NUM_ROWS); - // Active Input if (!InMenu()) { offset = selected / NUM_ROWS; @@ -133,7 +133,7 @@ void SequencerDroplet::Reset() { } void SequencerDroplet::SetDimensions() { - if (GetState() != DropletState::kFull) { + if (!IsFull()) { num_columns = 2; } else { num_columns = 4;