mirror of
https://github.com/AquaMorph/Droplets.git
synced 2025-04-29 17:35:33 +00:00
Droplet state checks
This commit is contained in:
parent
774aaa900b
commit
8b989b071b
@ -17,6 +17,19 @@ DropletState Droplet::GetState() {
|
|||||||
return state;
|
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() {
|
int Droplet::GetTitleHeight() {
|
||||||
return kTitleHeight;
|
return kTitleHeight;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,27 @@ public:
|
|||||||
*/
|
*/
|
||||||
DropletState GetState();
|
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.
|
* Returns the height of the title bar of the droplet.
|
||||||
*
|
*
|
||||||
|
@ -21,13 +21,14 @@ void SequencerDroplet::Control() {
|
|||||||
void SequencerDroplet::Process(AudioHandle::InputBuffer in,
|
void SequencerDroplet::Process(AudioHandle::InputBuffer in,
|
||||||
AudioHandle::OutputBuffer out,
|
AudioHandle::OutputBuffer out,
|
||||||
size_t size) {
|
size_t size) {
|
||||||
if(GetState() != DropletState::kRight &&
|
// Step input for full and left droplets
|
||||||
Patch()->gate_input[0].Trig()) {
|
if(!IsRight() && Patch()->gate_input[0].Trig()) {
|
||||||
Step();
|
Step();
|
||||||
}
|
}
|
||||||
if(GetState() != DropletState::kLeft &&
|
|
||||||
Patch()->gate_input[1].Trig()) {
|
// Step for right droplet and reset for full
|
||||||
if (GetState() == DropletState::kFull) {
|
if(!IsLeft() && Patch()->gate_input[1].Trig()) {
|
||||||
|
if (IsFull()) {
|
||||||
Reset();
|
Reset();
|
||||||
} else {
|
} else {
|
||||||
Step();
|
Step();
|
||||||
@ -55,13 +56,13 @@ void SequencerDroplet::Process(AudioHandle::InputBuffer in,
|
|||||||
}
|
}
|
||||||
control_rate_count++;
|
control_rate_count++;
|
||||||
|
|
||||||
|
// VC output of sequencer
|
||||||
for(size_t i = 0; i < size; i++) {
|
for(size_t i = 0; i < size; i++) {
|
||||||
if (GetState() != DropletState::kRight) {
|
if (!IsRight()) {
|
||||||
Patch()->seed.dac.WriteValue(DacHandle::Channel::ONE,
|
Patch()->seed.dac.WriteValue(DacHandle::Channel::ONE,
|
||||||
sequence[step] * 819.2f);
|
sequence[step] * 819.2f);
|
||||||
}
|
}
|
||||||
if (GetState() != DropletState::kLeft) {
|
if (!IsRight()) {
|
||||||
Patch()->seed.dac.WriteValue(DacHandle::Channel::TWO,
|
Patch()->seed.dac.WriteValue(DacHandle::Channel::TWO,
|
||||||
sequence[step] * 819.2f);
|
sequence[step] * 819.2f);
|
||||||
}
|
}
|
||||||
@ -72,7 +73,6 @@ void SequencerDroplet::Draw() {
|
|||||||
int left_padding = 4+GetScreenMin();
|
int left_padding = 4+GetScreenMin();
|
||||||
int offset = step / (num_columns*NUM_ROWS);
|
int offset = step / (num_columns*NUM_ROWS);
|
||||||
|
|
||||||
|
|
||||||
// Active Input
|
// Active Input
|
||||||
if (!InMenu()) {
|
if (!InMenu()) {
|
||||||
offset = selected / NUM_ROWS;
|
offset = selected / NUM_ROWS;
|
||||||
@ -133,7 +133,7 @@ void SequencerDroplet::Reset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SequencerDroplet::SetDimensions() {
|
void SequencerDroplet::SetDimensions() {
|
||||||
if (GetState() != DropletState::kFull) {
|
if (!IsFull()) {
|
||||||
num_columns = 2;
|
num_columns = 2;
|
||||||
} else {
|
} else {
|
||||||
num_columns = 4;
|
num_columns = 4;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user