feat(touchosc): typed partial helpers
Add consti/constf/vali/valf to schema.py so numeric OSC args carry the right wire type. Partial already supported scale_min/ scale_max; helpers expose them cleanly. Existing API unchanged.
This commit is contained in:
+21
-1
@@ -87,11 +87,31 @@ def const(s):
|
||||
return Partial("CONSTANT", "STRING", s)
|
||||
|
||||
|
||||
def consti(n):
|
||||
"""A CONSTANT/INTEGER partial — a fixed integer arg."""
|
||||
return Partial("CONSTANT", "INTEGER", str(n))
|
||||
|
||||
|
||||
def constf(x):
|
||||
"""A CONSTANT/FLOAT partial — a fixed float arg."""
|
||||
return Partial("CONSTANT", "FLOAT", str(x))
|
||||
|
||||
|
||||
def val():
|
||||
"""A VALUE/FLOAT partial bound to the control's ``x`` value."""
|
||||
"""A VALUE/FLOAT partial bound to the control's ``x`` value (scale 0..1)."""
|
||||
return Partial("VALUE", "FLOAT", "x")
|
||||
|
||||
|
||||
def vali():
|
||||
"""A VALUE/INTEGER partial — control value as int (button 0/1)."""
|
||||
return Partial("VALUE", "INTEGER", "x")
|
||||
|
||||
|
||||
def valf(scale_min=0, scale_max=1):
|
||||
"""A VALUE/FLOAT partial with a custom scale range (e.g. tempo 60..200)."""
|
||||
return Partial("VALUE", "FLOAT", "x", scale_min, scale_max)
|
||||
|
||||
|
||||
def _trigger(var="x", condition="ANY"):
|
||||
t = ET.Element("trigger")
|
||||
_set_text(t, "var", var)
|
||||
|
||||
Reference in New Issue
Block a user