Added a TouchOSCControlButton which will handle radio and single

button controls
main
Mike Lynch 2022-03-27 13:00:45 +11:00
parent 2350e9cf6b
commit 95a32d81c7
2 changed files with 25 additions and 1 deletions

View File

@ -22,7 +22,8 @@ TouchOSC {
controls.put(url, TouchOSCControl2d(url, scale1, scale2, apply));
}
addradio { | name, apply |
addbutton { | url, apply |
controls.put(url, TouchOSCControlButton(url, apply));
}
}

View File

@ -58,6 +58,29 @@ TouchOSCControl2d {
}
// For buttons and radio - a TouchOSCControl which just gets values
// and doesn't have a scale
TouchOSCControlButton {
var <url, <value, apply;
*new { | url, apply |
^super.new.init(url, apply)
}
init { | aurl, aapply |
url = aurl;
apply = aapply;
value = 0;
OSCdef.new(
'osc' ++ url,
{ | msg | apply.value(msg[1]) },
url
);
}
}
TouchOSCScale {
var <min, <max, <default;