2022-03-27 00:04:56 +00:00
|
|
|
|
|
|
|
|
2022-03-27 01:05:42 +00:00
|
|
|
TouchOSCControl {
|
2022-04-02 03:58:49 +00:00
|
|
|
var <touchOSC, <url, apply, <value;
|
2022-03-27 01:05:42 +00:00
|
|
|
|
2022-04-02 03:58:49 +00:00
|
|
|
*new { | touchOSC, url, apply, value |
|
|
|
|
^super.newCopyArgs(touchOSC, url, apply, value)
|
2022-03-27 01:05:42 +00:00
|
|
|
}
|
|
|
|
|
2022-04-02 03:58:49 +00:00
|
|
|
init {
|
2022-03-27 01:05:42 +00:00
|
|
|
OSCdef.new(
|
|
|
|
'osc' ++ url,
|
2022-04-24 06:38:10 +00:00
|
|
|
{ | msg, time |
|
2022-04-02 03:58:49 +00:00
|
|
|
value = msg[1];
|
2022-04-24 06:38:10 +00:00
|
|
|
apply.value(value, time)
|
2022-03-27 01:05:42 +00:00
|
|
|
},
|
|
|
|
url
|
|
|
|
);
|
2022-04-24 06:38:10 +00:00
|
|
|
apply.value(value, 0);
|
2022-04-02 03:58:49 +00:00
|
|
|
this.send();
|
2022-03-27 01:05:42 +00:00
|
|
|
}
|
2022-03-27 01:44:53 +00:00
|
|
|
|
2022-04-02 03:58:49 +00:00
|
|
|
value_ { |newval|
|
|
|
|
value = newval;
|
2022-04-24 06:38:10 +00:00
|
|
|
apply.value(value, 0);
|
2022-04-02 03:58:49 +00:00
|
|
|
this.send();
|
|
|
|
}
|
2022-03-27 01:44:53 +00:00
|
|
|
|
2022-04-02 03:58:49 +00:00
|
|
|
send {
|
|
|
|
touchOSC.send(url, value);
|
|
|
|
}
|
|
|
|
}
|
2022-03-27 01:44:53 +00:00
|
|
|
|
2022-04-02 03:58:49 +00:00
|
|
|
TouchOSCControlScale : TouchOSCControl {
|
|
|
|
var scale;
|
|
|
|
|
|
|
|
*new { | touchOSC, url, apply, value, scale |
|
|
|
|
^super.newCopyArgs(touchOSC, url, apply, value, scale)
|
2022-03-27 01:44:53 +00:00
|
|
|
}
|
|
|
|
|
2022-04-02 03:58:49 +00:00
|
|
|
init {
|
2022-03-27 01:44:53 +00:00
|
|
|
OSCdef.new(
|
|
|
|
'osc' ++ url,
|
2022-04-24 06:38:10 +00:00
|
|
|
{ | msg, time |
|
2022-04-02 03:58:49 +00:00
|
|
|
value = scale.tovalue(msg[1]);
|
2022-04-24 06:38:10 +00:00
|
|
|
apply.value(value, time);
|
2022-03-27 01:44:53 +00:00
|
|
|
},
|
|
|
|
url
|
|
|
|
);
|
2022-04-24 06:38:10 +00:00
|
|
|
apply.value(value, 0);
|
2022-04-02 03:58:49 +00:00
|
|
|
this.send();
|
2022-03-27 01:44:53 +00:00
|
|
|
}
|
2022-03-27 01:05:42 +00:00
|
|
|
|
2022-04-24 06:38:10 +00:00
|
|
|
send {
|
|
|
|
touchOSC.send(url, scale.toctrl(value));
|
|
|
|
}
|
|
|
|
|
2022-03-27 01:05:42 +00:00
|
|
|
}
|
|
|
|
|
2022-04-02 03:58:49 +00:00
|
|
|
TouchOSCControlXY : TouchOSCControl {
|
|
|
|
var scale1, scale2;
|
2022-03-27 01:05:42 +00:00
|
|
|
|
2022-04-02 03:58:49 +00:00
|
|
|
*new { | touchOSC, url, apply, value, scale1, scale2 |
|
|
|
|
^super.newCopyArgs(touchOSC, url, apply, value, scale1, scale2)
|
2022-03-27 02:00:45 +00:00
|
|
|
}
|
|
|
|
|
2022-04-02 03:58:49 +00:00
|
|
|
init {
|
2022-03-27 02:00:45 +00:00
|
|
|
OSCdef.new(
|
|
|
|
'osc' ++ url,
|
2022-04-24 06:38:10 +00:00
|
|
|
{ | msg, time |
|
2022-04-02 03:58:49 +00:00
|
|
|
value[0] = scale1.tovalue(msg[1]);
|
|
|
|
value[1] = scale2.tovalue(msg[2]);
|
2022-04-24 06:38:10 +00:00
|
|
|
apply.value(value, time);
|
2022-04-02 03:58:49 +00:00
|
|
|
},
|
2022-03-27 02:00:45 +00:00
|
|
|
url
|
|
|
|
);
|
2022-04-24 06:38:10 +00:00
|
|
|
apply.value(value, 0);
|
2022-04-02 03:58:49 +00:00
|
|
|
this.send();
|
|
|
|
}
|
|
|
|
|
|
|
|
send {
|
2022-04-24 06:38:10 +00:00
|
|
|
touchOSC.send(url, scale1.toctrl(value[0]), scale2.toctrl(value[1]));
|
2022-03-27 02:00:45 +00:00
|
|
|
}
|
2022-04-02 03:58:49 +00:00
|
|
|
|
2022-03-27 02:00:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-03-27 01:44:53 +00:00
|
|
|
|
2022-03-27 01:05:42 +00:00
|
|
|
TouchOSCScale {
|
2022-04-02 03:58:49 +00:00
|
|
|
var <min, <max;
|
2022-03-27 01:05:42 +00:00
|
|
|
|
2022-04-02 03:58:49 +00:00
|
|
|
*new { | min, max |
|
|
|
|
^super.newCopyArgs(min, max)
|
2022-03-27 01:05:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tovalue { | c | ^c.linlin(0, 1, min, max) }
|
|
|
|
|
|
|
|
toctrl { | v | ^v.linlin(min, max, 0, 1) }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// todo - better validation so that you can't set min as 0
|
|
|
|
|
|
|
|
TouchOSCScaleExp : TouchOSCScale {
|
|
|
|
|
|
|
|
tovalue { | c | ^c.linexp(0, 1, min, max) }
|
|
|
|
|
|
|
|
toctrl { | v | ^v.explin(min, max, 0, 1) }
|
|
|
|
|
|
|
|
}
|
|
|
|
|