mirror of
https://github.com/onyx-and-iris/xair-api-python.git
synced 2024-11-15 17:40:57 +00:00
remove type checks, prefer duck typing.
keep bounds checks for any vals passed to lin_set/log_set
This commit is contained in:
parent
fb8d3dee75
commit
87217f6f9c
@ -57,8 +57,6 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@amixenable.setter
|
@amixenable.setter
|
||||||
def amixenable(self, val: bool):
|
def amixenable(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("amixenable is a bool parameter")
|
|
||||||
self.setter("amixenable", 1 if val else 0)
|
self.setter("amixenable", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -67,8 +65,6 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@amixlock.setter
|
@amixlock.setter
|
||||||
def amixlock(self, val: bool):
|
def amixlock(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("amixlock is a bool parameter")
|
|
||||||
self.setter("amixlock", 1 if val else 0)
|
self.setter("amixlock", 1 if val else 0)
|
||||||
|
|
||||||
class MuteGroup:
|
class MuteGroup:
|
||||||
@ -87,8 +83,6 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@on.setter
|
@on.setter
|
||||||
def on(self, val: bool):
|
def on(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("on is a boolean parameter")
|
|
||||||
self.setter(f"{self.i}", 1 if val else 0)
|
self.setter(f"{self.i}", 1 if val else 0)
|
||||||
|
|
||||||
class Monitor:
|
class Monitor:
|
||||||
@ -112,8 +106,6 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@source.setter
|
@source.setter
|
||||||
def source(self, val: int):
|
def source(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("source is an int parameter")
|
|
||||||
self.setter(f"source", val)
|
self.setter(f"source", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -122,10 +114,8 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@sourcetrim.setter
|
@sourcetrim.setter
|
||||||
def sourcetrim(self, val: float):
|
def sourcetrim(self, val: float):
|
||||||
if not isinstance(val, float):
|
if not -18 <= val <= 18:
|
||||||
raise XAirRemoteError(
|
raise XAirRemoteError("expected value in range -18.0 to 18.0")
|
||||||
"sourcetrim is a float parameter, expected value in range -18 to 18"
|
|
||||||
)
|
|
||||||
self.setter("sourcetrim", lin_set(-18, 18, val))
|
self.setter("sourcetrim", lin_set(-18, 18, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -134,8 +124,6 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@chmode.setter
|
@chmode.setter
|
||||||
def chmode(self, val: bool):
|
def chmode(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("chmode is a bool parameter")
|
|
||||||
self.setter("chmode", 1 if val else 0)
|
self.setter("chmode", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -144,8 +132,6 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@busmode.setter
|
@busmode.setter
|
||||||
def busmode(self, val: bool):
|
def busmode(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("busmode is a bool parameter")
|
|
||||||
self.setter("busmode", 1 if val else 0)
|
self.setter("busmode", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -154,10 +140,8 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@dimgain.setter
|
@dimgain.setter
|
||||||
def dimgain(self, val: int):
|
def dimgain(self, val: int):
|
||||||
if not isinstance(val, int):
|
if not -40 <= val <= 0:
|
||||||
raise XAirRemoteError(
|
raise XAirRemoteError("expected value in range -40 to 0")
|
||||||
"dimgain is an int parameter, expected value in range -40 to 0"
|
|
||||||
)
|
|
||||||
self.setter("dimatt", lin_set(-40, 0, val))
|
self.setter("dimatt", lin_set(-40, 0, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -166,8 +150,6 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@dim.setter
|
@dim.setter
|
||||||
def dim(self, val: bool):
|
def dim(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("dim is a bool parameter")
|
|
||||||
self.setter("dim", 1 if val else 0)
|
self.setter("dim", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -176,8 +158,6 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@mono.setter
|
@mono.setter
|
||||||
def mono(self, val: bool):
|
def mono(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("mono is a bool parameter")
|
|
||||||
self.setter("mono", 1 if val else 0)
|
self.setter("mono", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -186,8 +166,6 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@mute.setter
|
@mute.setter
|
||||||
def mute(self, val: bool):
|
def mute(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("mute is a bool parameter")
|
|
||||||
self.setter("mute", 1 if val else 0)
|
self.setter("mute", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -196,8 +174,6 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@dimfpl.setter
|
@dimfpl.setter
|
||||||
def dimfpl(self, val: bool):
|
def dimfpl(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("dimfpl is a bool parameter")
|
|
||||||
self.setter("dimfpl", 1 if val else 0)
|
self.setter("dimfpl", 1 if val else 0)
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,8 +35,6 @@ class DCA(IDCA):
|
|||||||
|
|
||||||
@on.setter
|
@on.setter
|
||||||
def on(self, val: bool):
|
def on(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("on is a boolean parameter")
|
|
||||||
self.setter("on", 1 if val else 0)
|
self.setter("on", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -45,8 +43,6 @@ class DCA(IDCA):
|
|||||||
|
|
||||||
@name.setter
|
@name.setter
|
||||||
def name(self, val: str):
|
def name(self, val: str):
|
||||||
if not isinstance(val, str):
|
|
||||||
raise XAirRemoteError("name is a str parameter")
|
|
||||||
self.setter("config/name")[0]
|
self.setter("config/name")[0]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -55,6 +51,4 @@ class DCA(IDCA):
|
|||||||
|
|
||||||
@color.setter
|
@color.setter
|
||||||
def color(self, val: int):
|
def color(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("color is an int parameter")
|
|
||||||
self.setter("config/color", val)
|
self.setter("config/color", val)
|
||||||
|
@ -36,8 +36,6 @@ class FX(IFX):
|
|||||||
|
|
||||||
@type.setter
|
@type.setter
|
||||||
def type(self, val: int):
|
def type(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("type is an integer parameter")
|
|
||||||
self.setter("type", val)
|
self.setter("type", val)
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,8 +9,6 @@ def bool_prop(param):
|
|||||||
return self.getter(param)[0] == 1
|
return self.getter(param)[0] == 1
|
||||||
|
|
||||||
def fset(self, val):
|
def fset(self, val):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError(f"{param} is a boolean parameter")
|
|
||||||
self.setter(param, 1 if val else 0)
|
self.setter(param, 1 if val else 0)
|
||||||
|
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
@ -23,8 +21,6 @@ def string_prop(param):
|
|||||||
return self.getter(param)[0]
|
return self.getter(param)[0]
|
||||||
|
|
||||||
def fset(self, val):
|
def fset(self, val):
|
||||||
if not isinstance(val, str):
|
|
||||||
raise XAirRemoteError(f"{param} is a string parameter")
|
|
||||||
self.setter(param, val)
|
self.setter(param, val)
|
||||||
|
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
@ -37,8 +33,6 @@ def int_prop(param):
|
|||||||
return int(self.getter(param)[0])
|
return int(self.getter(param)[0])
|
||||||
|
|
||||||
def fset(self, val):
|
def fset(self, val):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError(f"{param} is an integer parameter")
|
|
||||||
self.setter(param, val)
|
self.setter(param, val)
|
||||||
|
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
@ -51,8 +45,6 @@ def float_prop(param):
|
|||||||
return round(self.getter(param)[0], 1)
|
return round(self.getter(param)[0], 1)
|
||||||
|
|
||||||
def fset(self, val):
|
def fset(self, val):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError(f"{param} is a float parameter")
|
|
||||||
self.setter(param, val)
|
self.setter(param, val)
|
||||||
|
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
|
@ -21,8 +21,6 @@ class Config:
|
|||||||
|
|
||||||
@name.setter
|
@name.setter
|
||||||
def name(self, val: str):
|
def name(self, val: str):
|
||||||
if not isinstance(val, str):
|
|
||||||
raise XAirRemoteError("name is a string parameter")
|
|
||||||
self.setter("name", val)
|
self.setter("name", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -31,8 +29,6 @@ class Config:
|
|||||||
|
|
||||||
@color.setter
|
@color.setter
|
||||||
def color(self, val: int):
|
def color(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("color is an int parameter")
|
|
||||||
self.setter("color", val)
|
self.setter("color", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -41,8 +37,6 @@ class Config:
|
|||||||
|
|
||||||
@inputsource.setter
|
@inputsource.setter
|
||||||
def inputsource(self, val: int):
|
def inputsource(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("inputsource is an int parameter")
|
|
||||||
self.setter("insrc", val)
|
self.setter("insrc", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -51,8 +45,6 @@ class Config:
|
|||||||
|
|
||||||
@usbreturn.setter
|
@usbreturn.setter
|
||||||
def usbreturn(self, val: int):
|
def usbreturn(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("usbreturn is an int parameter")
|
|
||||||
self.setter("rtnsrc", val)
|
self.setter("rtnsrc", val)
|
||||||
|
|
||||||
|
|
||||||
@ -68,10 +60,8 @@ class Preamp:
|
|||||||
|
|
||||||
@usbtrim.setter
|
@usbtrim.setter
|
||||||
def usbtrim(self, val: float):
|
def usbtrim(self, val: float):
|
||||||
if not isinstance(val, float):
|
if not -18 <= val <= 18:
|
||||||
raise XAirRemoteError(
|
raise XAirRemoteError("expected value in range -18.0 to 18.0")
|
||||||
"usbtrim is a float parameter, expected value in range -18 to 18"
|
|
||||||
)
|
|
||||||
self.setter("rtntrim", lin_set(-18, 18, val))
|
self.setter("rtntrim", lin_set(-18, 18, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -80,8 +70,6 @@ class Preamp:
|
|||||||
|
|
||||||
@usbinput.setter
|
@usbinput.setter
|
||||||
def usbinput(self, val: bool):
|
def usbinput(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("rtnsw is a bool parameter")
|
|
||||||
self.setter("rtnsw", 1 if val else 0)
|
self.setter("rtnsw", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -90,8 +78,6 @@ class Preamp:
|
|||||||
|
|
||||||
@invert.setter
|
@invert.setter
|
||||||
def invert(self, val: bool):
|
def invert(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("invert is a bool parameter")
|
|
||||||
self.setter("invert", 1 if val else 0)
|
self.setter("invert", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -100,8 +86,6 @@ class Preamp:
|
|||||||
|
|
||||||
@highpasson.setter
|
@highpasson.setter
|
||||||
def highpasson(self, val: bool):
|
def highpasson(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("hpon is a bool parameter")
|
|
||||||
self.setter("hpon", 1 if val else 0)
|
self.setter("hpon", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -110,8 +94,8 @@ class Preamp:
|
|||||||
|
|
||||||
@highpassfilter.setter
|
@highpassfilter.setter
|
||||||
def highpassfilter(self, val: int):
|
def highpassfilter(self, val: int):
|
||||||
if not isinstance(val, int):
|
if not 20 <= val <= 400:
|
||||||
raise XAirRemoteError("highpassfilter is an int parameter")
|
raise XAirRemoteError("expected value in range 20 to 400")
|
||||||
self.setter("hpf", log_set(20, 400, val))
|
self.setter("hpf", log_set(20, 400, val))
|
||||||
|
|
||||||
|
|
||||||
@ -127,8 +111,6 @@ class Gate:
|
|||||||
|
|
||||||
@on.setter
|
@on.setter
|
||||||
def on(self, val: bool):
|
def on(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("on is a boolean parameter")
|
|
||||||
self.setter("on", 1 if val else 0)
|
self.setter("on", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -139,8 +121,8 @@ class Gate:
|
|||||||
@mode.setter
|
@mode.setter
|
||||||
def mode(self, val: str):
|
def mode(self, val: str):
|
||||||
opts = ("gate", "exp2", "exp3", "exp4", "duck")
|
opts = ("gate", "exp2", "exp3", "exp4", "duck")
|
||||||
if not isinstance(val, str) and val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"mode is a string parameter, expected one of {opts}")
|
raise XAirRemoteError(f"expected one of {opts}")
|
||||||
self.setter("mode", opts.index(val))
|
self.setter("mode", opts.index(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -149,10 +131,8 @@ class Gate:
|
|||||||
|
|
||||||
@threshold.setter
|
@threshold.setter
|
||||||
def threshold(self, val: float):
|
def threshold(self, val: float):
|
||||||
if not isinstance(val, float):
|
if not -80 <= val <= 0:
|
||||||
raise XAirRemoteError(
|
raise XAirRemoteError("expected value in range -80.0 to 0.0")
|
||||||
"threshold is a float parameter, expected value in range -80 to 0"
|
|
||||||
)
|
|
||||||
self.setter("thr", lin_set(-80, 0, val))
|
self.setter("thr", lin_set(-80, 0, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -161,10 +141,8 @@ class Gate:
|
|||||||
|
|
||||||
@range.setter
|
@range.setter
|
||||||
def range(self, val: int):
|
def range(self, val: int):
|
||||||
if not isinstance(val, int):
|
if not 3 <= val <= 60:
|
||||||
raise XAirRemoteError(
|
raise XAirRemoteError("expected value in range 3 to 60")
|
||||||
"range is an int parameter, expected value in range 3 to 60"
|
|
||||||
)
|
|
||||||
self.setter("range", lin_set(3, 60, val))
|
self.setter("range", lin_set(3, 60, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -173,10 +151,8 @@ class Gate:
|
|||||||
|
|
||||||
@attack.setter
|
@attack.setter
|
||||||
def attack(self, val: int):
|
def attack(self, val: int):
|
||||||
if not isinstance(val, int):
|
if not 0 <= val <= 120:
|
||||||
raise XAirRemoteError(
|
raise XAirRemoteError("expected value in range 0 to 120")
|
||||||
"attack is an int parameter, expected value in range 0 to 120"
|
|
||||||
)
|
|
||||||
self.setter("attack", lin_set(0, 120, val))
|
self.setter("attack", lin_set(0, 120, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -186,6 +162,8 @@ class Gate:
|
|||||||
|
|
||||||
@hold.setter
|
@hold.setter
|
||||||
def hold(self, val: float):
|
def hold(self, val: float):
|
||||||
|
if not 0.02 <= val <= 2000:
|
||||||
|
raise XAirRemoteError("expected value in range 0.02 to 2000.0")
|
||||||
self.setter("hold", log_set(0.02, 2000, val))
|
self.setter("hold", log_set(0.02, 2000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -194,10 +172,8 @@ class Gate:
|
|||||||
|
|
||||||
@release.setter
|
@release.setter
|
||||||
def release(self, val: int):
|
def release(self, val: int):
|
||||||
if not isinstance(val, int):
|
if not 5 <= val <= 4000:
|
||||||
raise XAirRemoteError(
|
raise XAirRemoteError("expected value in range 5 to 4000")
|
||||||
"release is an int parameter, expected value in range 5 to 4000"
|
|
||||||
)
|
|
||||||
self.setter("release", log_set(5, 4000, val))
|
self.setter("release", log_set(5, 4000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -206,8 +182,6 @@ class Gate:
|
|||||||
|
|
||||||
@keysource.setter
|
@keysource.setter
|
||||||
def keysource(self, val):
|
def keysource(self, val):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("keysource is an int parameter")
|
|
||||||
self.setter("keysrc", val)
|
self.setter("keysrc", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -216,8 +190,6 @@ class Gate:
|
|||||||
|
|
||||||
@filteron.setter
|
@filteron.setter
|
||||||
def filteron(self, val: bool):
|
def filteron(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("filteron is a boolean parameter")
|
|
||||||
self.setter("filter/on", 1 if val else 0)
|
self.setter("filter/on", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -226,8 +198,6 @@ class Gate:
|
|||||||
|
|
||||||
@filtertype.setter
|
@filtertype.setter
|
||||||
def filtertype(self, val: int):
|
def filtertype(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("filtertype is an int parameter")
|
|
||||||
self.setter("filter/type", val)
|
self.setter("filter/type", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -237,6 +207,8 @@ class Gate:
|
|||||||
|
|
||||||
@filterfreq.setter
|
@filterfreq.setter
|
||||||
def filterfreq(self, val: Union[float, int]):
|
def filterfreq(self, val: Union[float, int]):
|
||||||
|
if not 20 <= val <= 20000:
|
||||||
|
raise XAirRemoteError("expected value in range 20 to 20000")
|
||||||
self.setter("filter/f", log_set(20, 20000, val))
|
self.setter("filter/f", log_set(20, 20000, val))
|
||||||
|
|
||||||
|
|
||||||
@ -252,8 +224,6 @@ class Dyn:
|
|||||||
|
|
||||||
@on.setter
|
@on.setter
|
||||||
def on(self, val: bool):
|
def on(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("on is a boolean parameter")
|
|
||||||
self.setter("on", 1 if val else 0)
|
self.setter("on", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -264,8 +234,8 @@ class Dyn:
|
|||||||
@mode.setter
|
@mode.setter
|
||||||
def mode(self, val: str):
|
def mode(self, val: str):
|
||||||
opts = ("comp", "exp")
|
opts = ("comp", "exp")
|
||||||
if not isinstance(val, str) and val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"mode is a string parameter, expected one of {opts}")
|
raise XAirRemoteError(f"expected one of {opts}")
|
||||||
self.setter("mode", opts.index(val))
|
self.setter("mode", opts.index(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -276,8 +246,8 @@ class Dyn:
|
|||||||
@det.setter
|
@det.setter
|
||||||
def det(self, val: str):
|
def det(self, val: str):
|
||||||
opts = ("peak", "rms")
|
opts = ("peak", "rms")
|
||||||
if not isinstance(val, str) and val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"det is a string parameter, expected one of {opts}")
|
raise XAirRemoteError(f"expected one of {opts}")
|
||||||
self.setter("det", opts.index(val))
|
self.setter("det", opts.index(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -288,8 +258,8 @@ class Dyn:
|
|||||||
@env.setter
|
@env.setter
|
||||||
def env(self, val: str):
|
def env(self, val: str):
|
||||||
opts = ("lin", "log")
|
opts = ("lin", "log")
|
||||||
if not isinstance(val, str) and val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"env is a string parameter, expected one of {opts}")
|
raise XAirRemoteError(f"expected one of {opts}")
|
||||||
self.setter("env", opts.index(val))
|
self.setter("env", opts.index(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -298,10 +268,8 @@ class Dyn:
|
|||||||
|
|
||||||
@threshold.setter
|
@threshold.setter
|
||||||
def threshold(self, val: float):
|
def threshold(self, val: float):
|
||||||
if not isinstance(val, float):
|
if not -60 <= val <= 0:
|
||||||
raise XAirRemoteError(
|
raise XAirRemoteError("expected value in range -60.0 to 0")
|
||||||
"threshold is a float parameter, expected value in range -80 to 0"
|
|
||||||
)
|
|
||||||
self.setter("thr", lin_set(-60, 0, val))
|
self.setter("thr", lin_set(-60, 0, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -311,8 +279,6 @@ class Dyn:
|
|||||||
|
|
||||||
@ratio.setter
|
@ratio.setter
|
||||||
def ratio(self, val: int):
|
def ratio(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("ratio is an int parameter")
|
|
||||||
self.setter("ratio", val)
|
self.setter("ratio", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -321,10 +287,8 @@ class Dyn:
|
|||||||
|
|
||||||
@knee.setter
|
@knee.setter
|
||||||
def knee(self, val: int):
|
def knee(self, val: int):
|
||||||
if not isinstance(val, int):
|
if not 0 <= val <= 5:
|
||||||
raise XAirRemoteError(
|
raise XAirRemoteError("expected value in range 0 to 5")
|
||||||
"knee is an int parameter, expected value in range 0 to 5"
|
|
||||||
)
|
|
||||||
self.setter("knee", lin_set(0, 5, val))
|
self.setter("knee", lin_set(0, 5, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -333,6 +297,8 @@ class Dyn:
|
|||||||
|
|
||||||
@mgain.setter
|
@mgain.setter
|
||||||
def mgain(self, val: float):
|
def mgain(self, val: float):
|
||||||
|
if not 0 <= val <= 24:
|
||||||
|
raise XAirRemoteError("expected value in range 0.0 to 24.0")
|
||||||
self.setter("mgain", lin_set(0, 24, val))
|
self.setter("mgain", lin_set(0, 24, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -341,6 +307,8 @@ class Dyn:
|
|||||||
|
|
||||||
@attack.setter
|
@attack.setter
|
||||||
def attack(self, val: int):
|
def attack(self, val: int):
|
||||||
|
if not 0 <= val <= 120:
|
||||||
|
raise XAirRemoteError("expected value in range 0 to 120")
|
||||||
self.setter("attack", lin_set(0, 120, val))
|
self.setter("attack", lin_set(0, 120, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -350,6 +318,8 @@ class Dyn:
|
|||||||
|
|
||||||
@hold.setter
|
@hold.setter
|
||||||
def hold(self, val: float):
|
def hold(self, val: float):
|
||||||
|
if not 0.02 <= val <= 2000:
|
||||||
|
raise XAirRemoteError("expected value in range 0.02 to 2000.0")
|
||||||
self.setter("hold", log_set(0.02, 2000, val))
|
self.setter("hold", log_set(0.02, 2000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -358,10 +328,8 @@ class Dyn:
|
|||||||
|
|
||||||
@release.setter
|
@release.setter
|
||||||
def release(self, val: int):
|
def release(self, val: int):
|
||||||
if not isinstance(val, int):
|
if not 5 <= val <= 4000:
|
||||||
raise XAirRemoteError(
|
raise XAirRemoteError("expected value in range 5 to 4000")
|
||||||
"release is an int parameter, expected value in range 5 to 4000"
|
|
||||||
)
|
|
||||||
self.setter("release", log_set(5, 4000, val))
|
self.setter("release", log_set(5, 4000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -370,10 +338,8 @@ class Dyn:
|
|||||||
|
|
||||||
@mix.setter
|
@mix.setter
|
||||||
def mix(self, val: int):
|
def mix(self, val: int):
|
||||||
if not isinstance(val, int):
|
if not 0 <= val <= 100:
|
||||||
raise XAirRemoteError(
|
raise XAirRemoteError("expected value in range 0 to 100")
|
||||||
"mix is an int parameter, expected value in range 0 to 5"
|
|
||||||
)
|
|
||||||
self.setter("mix", lin_set(0, 100, val))
|
self.setter("mix", lin_set(0, 100, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -382,8 +348,6 @@ class Dyn:
|
|||||||
|
|
||||||
@keysource.setter
|
@keysource.setter
|
||||||
def keysource(self, val):
|
def keysource(self, val):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("keysource is an int parameter")
|
|
||||||
self.setter("keysrc", val)
|
self.setter("keysrc", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -392,8 +356,6 @@ class Dyn:
|
|||||||
|
|
||||||
@auto.setter
|
@auto.setter
|
||||||
def auto(self, val: bool):
|
def auto(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("auto is a boolean parameter")
|
|
||||||
self.setter("auto", 1 if val else 0)
|
self.setter("auto", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -402,8 +364,6 @@ class Dyn:
|
|||||||
|
|
||||||
@filteron.setter
|
@filteron.setter
|
||||||
def filteron(self, val: bool):
|
def filteron(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("filteron is a boolean parameter")
|
|
||||||
self.setter("filter/on", 1 if val else 0)
|
self.setter("filter/on", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -412,8 +372,6 @@ class Dyn:
|
|||||||
|
|
||||||
@filtertype.setter
|
@filtertype.setter
|
||||||
def filtertype(self, val: int):
|
def filtertype(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("filtertype is an int parameter")
|
|
||||||
self.setter("filter/type", val)
|
self.setter("filter/type", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -423,6 +381,8 @@ class Dyn:
|
|||||||
|
|
||||||
@filterfreq.setter
|
@filterfreq.setter
|
||||||
def filterfreq(self, val: Union[float, int]):
|
def filterfreq(self, val: Union[float, int]):
|
||||||
|
if not 20 <= val <= 20000:
|
||||||
|
raise XAirRemoteError("expected value in range 20 to 20000")
|
||||||
self.setter("filter/f", log_set(20, 20000, val))
|
self.setter("filter/f", log_set(20, 20000, val))
|
||||||
|
|
||||||
|
|
||||||
@ -438,8 +398,6 @@ class Insert:
|
|||||||
|
|
||||||
@on.setter
|
@on.setter
|
||||||
def on(self, val: bool):
|
def on(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("on is a boolean parameter")
|
|
||||||
self.setter("on", 1 if val else 0)
|
self.setter("on", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -448,8 +406,6 @@ class Insert:
|
|||||||
|
|
||||||
@sel.setter
|
@sel.setter
|
||||||
def sel(self, val: int):
|
def sel(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("sel is an int parameter")
|
|
||||||
self.setter("sel", val)
|
self.setter("sel", val)
|
||||||
|
|
||||||
|
|
||||||
@ -495,8 +451,6 @@ class EQ:
|
|||||||
|
|
||||||
@on.setter
|
@on.setter
|
||||||
def on(self, val: bool):
|
def on(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("on is a boolean parameter")
|
|
||||||
self.setter("on", 1 if val else 0)
|
self.setter("on", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -507,8 +461,8 @@ class EQ:
|
|||||||
@mode.setter
|
@mode.setter
|
||||||
def mode(self, val: str):
|
def mode(self, val: str):
|
||||||
opts = ("peq", "geq", "teq")
|
opts = ("peq", "geq", "teq")
|
||||||
if not isinstance(val, str) and val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"mode is a string parameter, expected one of {opts}")
|
raise XAirRemoteError(f"expected one of {opts}")
|
||||||
self.setter("mode", opts.index(val))
|
self.setter("mode", opts.index(val))
|
||||||
|
|
||||||
class EQBand:
|
class EQBand:
|
||||||
@ -530,8 +484,6 @@ class EQ:
|
|||||||
|
|
||||||
@type.setter
|
@type.setter
|
||||||
def type(self, val: int):
|
def type(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("type is an int parameter")
|
|
||||||
self.setter(f"type", val)
|
self.setter(f"type", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -541,6 +493,8 @@ class EQ:
|
|||||||
|
|
||||||
@frequency.setter
|
@frequency.setter
|
||||||
def frequency(self, val: float):
|
def frequency(self, val: float):
|
||||||
|
if not 20 <= val <= 20000:
|
||||||
|
raise XAirRemoteError("expected value in range 20.0 to 20000.0")
|
||||||
self.setter("f", log_set(20, 20000, val))
|
self.setter("f", log_set(20, 20000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -549,6 +503,8 @@ class EQ:
|
|||||||
|
|
||||||
@gain.setter
|
@gain.setter
|
||||||
def gain(self, val: float):
|
def gain(self, val: float):
|
||||||
|
if not -15 <= val <= 15:
|
||||||
|
raise XAirRemoteError("expected value in range -15.0 to 15.0")
|
||||||
self.setter("g", lin_set(-15, 15, val))
|
self.setter("g", lin_set(-15, 15, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -558,6 +514,8 @@ class EQ:
|
|||||||
|
|
||||||
@quality.setter
|
@quality.setter
|
||||||
def quality(self, val: float):
|
def quality(self, val: float):
|
||||||
|
if not 0.3 <= val <= 10:
|
||||||
|
raise XAirRemoteError("expected value in range 0.3 to 10.0")
|
||||||
self.setter("q", log_set(0.3, 10, val))
|
self.setter("q", log_set(0.3, 10, val))
|
||||||
|
|
||||||
|
|
||||||
@ -600,8 +558,6 @@ class Mix:
|
|||||||
|
|
||||||
@on.setter
|
@on.setter
|
||||||
def on(self, val: bool):
|
def on(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("on is a boolean parameter")
|
|
||||||
self.setter("on", 1 if val else 0)
|
self.setter("on", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -619,8 +575,6 @@ class Mix:
|
|||||||
|
|
||||||
@lr.setter
|
@lr.setter
|
||||||
def lr(self, val: bool):
|
def lr(self, val: bool):
|
||||||
if not isinstance(val, bool):
|
|
||||||
raise XAirRemoteError("lr is a boolean parameter")
|
|
||||||
self.setter("lr", 1 if val else 0)
|
self.setter("lr", 1 if val else 0)
|
||||||
|
|
||||||
|
|
||||||
@ -636,8 +590,6 @@ class Group:
|
|||||||
|
|
||||||
@dca.setter
|
@dca.setter
|
||||||
def dca(self, val: int):
|
def dca(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("dca is an int parameter")
|
|
||||||
self.setter("dca", val)
|
self.setter("dca", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -646,8 +598,6 @@ class Group:
|
|||||||
|
|
||||||
@mute.setter
|
@mute.setter
|
||||||
def mute(self, val: int):
|
def mute(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("mute is an int parameter")
|
|
||||||
self.setter("mute", val)
|
self.setter("mute", val)
|
||||||
|
|
||||||
|
|
||||||
@ -663,8 +613,6 @@ class Automix:
|
|||||||
|
|
||||||
@group.setter
|
@group.setter
|
||||||
def group(self, val: int):
|
def group(self, val: int):
|
||||||
if not isinstance(val, int):
|
|
||||||
raise XAirRemoteError("group is an int parameter")
|
|
||||||
self.setter("group", val)
|
self.setter("group", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -673,8 +621,6 @@ class Automix:
|
|||||||
|
|
||||||
@weight.setter
|
@weight.setter
|
||||||
def weight(self, val: float):
|
def weight(self, val: float):
|
||||||
if not isinstance(val, float):
|
if not -12 <= val <= 12:
|
||||||
raise XAirRemoteError(
|
raise XAirRemoteError("expected value in range -12.0 to 12.0")
|
||||||
"weight is a float parameter, expected value in range -12 to 12"
|
|
||||||
)
|
|
||||||
self.setter("weight", lin_set(-12, 12, val))
|
self.setter("weight", lin_set(-12, 12, val))
|
||||||
|
Loading…
Reference in New Issue
Block a user