Skip to content

Commit 455982b

Browse files
committed
Conditionals, begone
1 parent 359c215 commit 455982b

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

FaustCode/owl.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,8 @@ class OwlCheckbox : public OwlParameterBase {
358358
, fButton(button) {}
359359
void update() {
360360
bool isHigh = fPatch->isButtonPressed(fButton);
361-
if (isHigh && !wasHigh) {
362-
// Rising edge detected
363-
state = !state;
364-
wasHigh = true;
365-
}
366-
else if (!isHigh && wasHigh) {
367-
// Falling edge detected
368-
wasHigh = false;
369-
}
361+
state ^= isHigh && !wasHigh;
362+
wasHigh = isHigh;
370363
fPatch->setButton(fButton, state, 0);
371364
*fZone = state;
372365
}

0 commit comments

Comments
 (0)