Skip to content

FAUST checkbox widget support - same as button, but toggled#88

Merged
pingdynasty merged 3 commits intoRebelTechnology:masterfrom
antisvin:feature/faust-checkbox
Mar 3, 2021
Merged

FAUST checkbox widget support - same as button, but toggled#88
pingdynasty merged 3 commits intoRebelTechnology:masterfrom
antisvin:feature/faust-checkbox

Conversation

@antisvin
Copy link
Copy Markdown
Collaborator

Example patch:

import("stdfaust.lib");

vco = os.osc(110.0);

gate1 = checkbox("Gate1>[OWL:PUSH]");
gate2 = checkbox("Gate2>[OWL:B2]");

process = vco * gate1, vco * gate2;

@antisvin antisvin changed the title Feature/faust checkbox FAUST checkbox widget support - same as gate, but toggled Feb 26, 2021
Comment thread FaustCode/owl.cpp Outdated
Comment on lines +361 to +369
if (isHigh && !wasHigh) {
// Rising edge detected
state = !state;
wasHigh = true;
}
else if (!isHigh && wasHigh) {
// Falling edge detected
wasHigh = false;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can get rid of one of the conditionals and just store the previous button state.
e.g.

 if(isHigh && !wasHigh){
  state = !state;
}
wasHigh = isHigh;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will double check, but I think it may not work if this code is not running in callback for button state change like your C++ code. If this runs for every audio block, it would reset button state while it's held high.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not get rid of both conditionals here instead ;-)

@antisvin antisvin force-pushed the feature/faust-checkbox branch from 5386f86 to 455982b Compare March 3, 2021 18:40
@antisvin antisvin changed the title FAUST checkbox widget support - same as gate, but toggled FAUST checkbox widget support - same as button, but toggled Mar 3, 2021
@antisvin antisvin requested a review from pingdynasty March 3, 2021 20:33
@pingdynasty pingdynasty merged commit 60689ec into RebelTechnology:master Mar 3, 2021
@pingdynasty
Copy link
Copy Markdown
Collaborator

Ouch, this should have been merged into develop not master!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants