mirror of
https://github.com/onyx-and-iris/xair-api-python.git
synced 2024-11-15 17:40:57 +00:00
parent
e05460e998
commit
1e5e458105
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "xair-api"
|
name = "xair-api"
|
||||||
version = "2.3.0"
|
version = "2.3.1"
|
||||||
description = "Remote control Behringer X-Air | Midas MR mixers through OSC"
|
description = "Remote control Behringer X-Air | Midas MR mixers through OSC"
|
||||||
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
import abc
|
import abc
|
||||||
|
import logging
|
||||||
|
|
||||||
from . import kinds, util
|
from . import kinds, util
|
||||||
from .errors import XAirRemoteError
|
|
||||||
from .meta import bool_prop
|
from .meta import bool_prop
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class IConfig(abc.ABC):
|
class IConfig(abc.ABC):
|
||||||
"""Abstract Base Class for config"""
|
"""Abstract Base Class for config"""
|
||||||
|
|
||||||
def __init__(self, remote):
|
def __init__(self, remote):
|
||||||
self._remote = remote
|
self._remote = remote
|
||||||
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
|
|
||||||
def getter(self, param: str):
|
def getter(self, param: str):
|
||||||
return self._remote.query(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
@ -114,7 +117,7 @@ class Config(IConfig):
|
|||||||
@sourcetrim.setter
|
@sourcetrim.setter
|
||||||
def sourcetrim(self, val: float):
|
def sourcetrim(self, val: float):
|
||||||
if not -18 <= val <= 18:
|
if not -18 <= val <= 18:
|
||||||
raise XAirRemoteError("expected value in range -18.0 to 18.0")
|
self.logger.warning("expected value in range -18.0 to 18.0")
|
||||||
self.setter("sourcetrim", util.lin_set(-18, 18, val))
|
self.setter("sourcetrim", util.lin_set(-18, 18, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -140,7 +143,7 @@ class Config(IConfig):
|
|||||||
@dimgain.setter
|
@dimgain.setter
|
||||||
def dimgain(self, val: int):
|
def dimgain(self, val: int):
|
||||||
if not -40 <= val <= 0:
|
if not -40 <= val <= 0:
|
||||||
raise XAirRemoteError("expected value in range -40 to 0")
|
self.logger.warning("expected value in range -40 to 0")
|
||||||
self.setter("dimatt", util.lin_set(-40, 0, val))
|
self.setter("dimatt", util.lin_set(-40, 0, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
from .errors import XAirRemoteError
|
|
||||||
from .util import lin_get, lin_set
|
from .util import lin_get, lin_set
|
||||||
|
|
||||||
|
|
||||||
@ -58,7 +57,7 @@ def geq_prop(param):
|
|||||||
|
|
||||||
def fset(self, val):
|
def fset(self, val):
|
||||||
if not -15 <= val <= 15:
|
if not -15 <= val <= 15:
|
||||||
raise XAirRemoteError("expected value in range -15.0 to 15.0")
|
self.logger.warning("expected value in range -15.0 to 15.0")
|
||||||
self.setter(param, lin_set(-15, 15, val))
|
self.setter(param, lin_set(-15, 15, val))
|
||||||
|
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
from . import util
|
from . import util
|
||||||
from .errors import XAirRemoteError
|
|
||||||
from .meta import geq_prop
|
from .meta import geq_prop
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -61,7 +60,7 @@ class Preamp:
|
|||||||
@usbtrim.setter
|
@usbtrim.setter
|
||||||
def usbtrim(self, val: float):
|
def usbtrim(self, val: float):
|
||||||
if not -18 <= val <= 18:
|
if not -18 <= val <= 18:
|
||||||
raise XAirRemoteError("expected value in range -18.0 to 18.0")
|
self.logger.warning("expected value in range -18.0 to 18.0")
|
||||||
self.setter("rtntrim", util.lin_set(-18, 18, val))
|
self.setter("rtntrim", util.lin_set(-18, 18, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -95,7 +94,7 @@ class Preamp:
|
|||||||
@highpassfilter.setter
|
@highpassfilter.setter
|
||||||
def highpassfilter(self, val: int):
|
def highpassfilter(self, val: int):
|
||||||
if not 20 <= val <= 400:
|
if not 20 <= val <= 400:
|
||||||
raise XAirRemoteError("expected value in range 20 to 400")
|
self.logger.warning("expected value in range 20 to 400")
|
||||||
self.setter("hpf", util.log_set(20, 400, val))
|
self.setter("hpf", util.log_set(20, 400, val))
|
||||||
|
|
||||||
|
|
||||||
@ -122,7 +121,7 @@ class Gate:
|
|||||||
def mode(self, val: str):
|
def mode(self, val: str):
|
||||||
opts = ("gate", "exp2", "exp3", "exp4", "duck")
|
opts = ("gate", "exp2", "exp3", "exp4", "duck")
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"expected one of {opts}")
|
self.logger.warning(f"expected one of {opts}")
|
||||||
self.setter("mode", opts.index(val))
|
self.setter("mode", opts.index(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -132,7 +131,7 @@ class Gate:
|
|||||||
@threshold.setter
|
@threshold.setter
|
||||||
def threshold(self, val: float):
|
def threshold(self, val: float):
|
||||||
if not -80 <= val <= 0:
|
if not -80 <= val <= 0:
|
||||||
raise XAirRemoteError("expected value in range -80.0 to 0.0")
|
self.logger.warning("expected value in range -80.0 to 0.0")
|
||||||
self.setter("thr", util.lin_set(-80, 0, val))
|
self.setter("thr", util.lin_set(-80, 0, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -142,7 +141,7 @@ class Gate:
|
|||||||
@range.setter
|
@range.setter
|
||||||
def range(self, val: int):
|
def range(self, val: int):
|
||||||
if not 3 <= val <= 60:
|
if not 3 <= val <= 60:
|
||||||
raise XAirRemoteError("expected value in range 3 to 60")
|
self.logger.warning("expected value in range 3 to 60")
|
||||||
self.setter("range", util.lin_set(3, 60, val))
|
self.setter("range", util.lin_set(3, 60, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -152,7 +151,7 @@ class Gate:
|
|||||||
@attack.setter
|
@attack.setter
|
||||||
def attack(self, val: int):
|
def attack(self, val: int):
|
||||||
if not 0 <= val <= 120:
|
if not 0 <= val <= 120:
|
||||||
raise XAirRemoteError("expected value in range 0 to 120")
|
self.logger.warning("expected value in range 0 to 120")
|
||||||
self.setter("attack", util.lin_set(0, 120, val))
|
self.setter("attack", util.lin_set(0, 120, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -163,7 +162,7 @@ class Gate:
|
|||||||
@hold.setter
|
@hold.setter
|
||||||
def hold(self, val: float):
|
def hold(self, val: float):
|
||||||
if not 0.02 <= val <= 2000:
|
if not 0.02 <= val <= 2000:
|
||||||
raise XAirRemoteError("expected value in range 0.02 to 2000.0")
|
self.logger.warning("expected value in range 0.02 to 2000.0")
|
||||||
self.setter("hold", util.log_set(0.02, 2000, val))
|
self.setter("hold", util.log_set(0.02, 2000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -173,7 +172,7 @@ class Gate:
|
|||||||
@release.setter
|
@release.setter
|
||||||
def release(self, val: int):
|
def release(self, val: int):
|
||||||
if not 5 <= val <= 4000:
|
if not 5 <= val <= 4000:
|
||||||
raise XAirRemoteError("expected value in range 5 to 4000")
|
self.logger.warning("expected value in range 5 to 4000")
|
||||||
self.setter("release", util.log_set(5, 4000, val))
|
self.setter("release", util.log_set(5, 4000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -208,7 +207,7 @@ 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:
|
if not 20 <= val <= 20000:
|
||||||
raise XAirRemoteError("expected value in range 20 to 20000")
|
self.logger.warning("expected value in range 20 to 20000")
|
||||||
self.setter("filter/f", util.log_set(20, 20000, val))
|
self.setter("filter/f", util.log_set(20, 20000, val))
|
||||||
|
|
||||||
|
|
||||||
@ -235,7 +234,7 @@ class Dyn:
|
|||||||
def mode(self, val: str):
|
def mode(self, val: str):
|
||||||
opts = ("comp", "exp")
|
opts = ("comp", "exp")
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"expected one of {opts}")
|
self.logger.warning(f"expected one of {opts}")
|
||||||
self.setter("mode", opts.index(val))
|
self.setter("mode", opts.index(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -247,7 +246,7 @@ class Dyn:
|
|||||||
def det(self, val: str):
|
def det(self, val: str):
|
||||||
opts = ("peak", "rms")
|
opts = ("peak", "rms")
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"expected one of {opts}")
|
self.logger.warning(f"expected one of {opts}")
|
||||||
self.setter("det", opts.index(val))
|
self.setter("det", opts.index(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -259,7 +258,7 @@ class Dyn:
|
|||||||
def env(self, val: str):
|
def env(self, val: str):
|
||||||
opts = ("lin", "log")
|
opts = ("lin", "log")
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"expected one of {opts}")
|
self.logger.warning(f"expected one of {opts}")
|
||||||
self.setter("env", opts.index(val))
|
self.setter("env", opts.index(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -269,7 +268,7 @@ class Dyn:
|
|||||||
@threshold.setter
|
@threshold.setter
|
||||||
def threshold(self, val: float):
|
def threshold(self, val: float):
|
||||||
if not -60 <= val <= 0:
|
if not -60 <= val <= 0:
|
||||||
raise XAirRemoteError("expected value in range -60.0 to 0")
|
self.logger.warning("expected value in range -60.0 to 0")
|
||||||
self.setter("thr", util.lin_set(-60, 0, val))
|
self.setter("thr", util.lin_set(-60, 0, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -288,7 +287,7 @@ class Dyn:
|
|||||||
@knee.setter
|
@knee.setter
|
||||||
def knee(self, val: int):
|
def knee(self, val: int):
|
||||||
if not 0 <= val <= 5:
|
if not 0 <= val <= 5:
|
||||||
raise XAirRemoteError("expected value in range 0 to 5")
|
self.logger.warning("expected value in range 0 to 5")
|
||||||
self.setter("knee", util.lin_set(0, 5, val))
|
self.setter("knee", util.lin_set(0, 5, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -298,7 +297,7 @@ class Dyn:
|
|||||||
@mgain.setter
|
@mgain.setter
|
||||||
def mgain(self, val: float):
|
def mgain(self, val: float):
|
||||||
if not 0 <= val <= 24:
|
if not 0 <= val <= 24:
|
||||||
raise XAirRemoteError("expected value in range 0.0 to 24.0")
|
self.logger.warning("expected value in range 0.0 to 24.0")
|
||||||
self.setter("mgain", util.lin_set(0, 24, val))
|
self.setter("mgain", util.lin_set(0, 24, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -308,7 +307,7 @@ class Dyn:
|
|||||||
@attack.setter
|
@attack.setter
|
||||||
def attack(self, val: int):
|
def attack(self, val: int):
|
||||||
if not 0 <= val <= 120:
|
if not 0 <= val <= 120:
|
||||||
raise XAirRemoteError("expected value in range 0 to 120")
|
self.logger.warning("expected value in range 0 to 120")
|
||||||
self.setter("attack", util.lin_set(0, 120, val))
|
self.setter("attack", util.lin_set(0, 120, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -319,7 +318,7 @@ class Dyn:
|
|||||||
@hold.setter
|
@hold.setter
|
||||||
def hold(self, val: float):
|
def hold(self, val: float):
|
||||||
if not 0.02 <= val <= 2000:
|
if not 0.02 <= val <= 2000:
|
||||||
raise XAirRemoteError("expected value in range 0.02 to 2000.0")
|
self.logger.warning("expected value in range 0.02 to 2000.0")
|
||||||
self.setter("hold", util.log_set(0.02, 2000, val))
|
self.setter("hold", util.log_set(0.02, 2000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -329,7 +328,7 @@ class Dyn:
|
|||||||
@release.setter
|
@release.setter
|
||||||
def release(self, val: int):
|
def release(self, val: int):
|
||||||
if not 5 <= val <= 4000:
|
if not 5 <= val <= 4000:
|
||||||
raise XAirRemoteError("expected value in range 5 to 4000")
|
self.logger.warning("expected value in range 5 to 4000")
|
||||||
self.setter("release", util.log_set(5, 4000, val))
|
self.setter("release", util.log_set(5, 4000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -339,7 +338,7 @@ class Dyn:
|
|||||||
@mix.setter
|
@mix.setter
|
||||||
def mix(self, val: int):
|
def mix(self, val: int):
|
||||||
if not 0 <= val <= 100:
|
if not 0 <= val <= 100:
|
||||||
raise XAirRemoteError("expected value in range 0 to 100")
|
self.logger.warning("expected value in range 0 to 100")
|
||||||
self.setter("mix", util.lin_set(0, 100, val))
|
self.setter("mix", util.lin_set(0, 100, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -382,7 +381,7 @@ 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:
|
if not 20 <= val <= 20000:
|
||||||
raise XAirRemoteError("expected value in range 20 to 20000")
|
self.logger.warning("expected value in range 20 to 20000")
|
||||||
self.setter("filter/f", util.log_set(20, 20000, val))
|
self.setter("filter/f", util.log_set(20, 20000, val))
|
||||||
|
|
||||||
|
|
||||||
@ -462,7 +461,7 @@ class EQ:
|
|||||||
def mode(self, val: str):
|
def mode(self, val: str):
|
||||||
opts = ("peq", "geq", "teq")
|
opts = ("peq", "geq", "teq")
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"expected one of {opts}")
|
self.logger.warning(f"expected one of {opts}")
|
||||||
self.setter("mode", opts.index(val))
|
self.setter("mode", opts.index(val))
|
||||||
|
|
||||||
class EQBand:
|
class EQBand:
|
||||||
@ -491,7 +490,7 @@ class EQ:
|
|||||||
@frequency.setter
|
@frequency.setter
|
||||||
def frequency(self, val: float):
|
def frequency(self, val: float):
|
||||||
if not 20 <= val <= 20000:
|
if not 20 <= val <= 20000:
|
||||||
raise XAirRemoteError("expected value in range 20.0 to 20000.0")
|
self.logger.warning("expected value in range 20.0 to 20000.0")
|
||||||
self.setter("f", util.log_set(20, 20000, val))
|
self.setter("f", util.log_set(20, 20000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -501,7 +500,7 @@ class EQ:
|
|||||||
@gain.setter
|
@gain.setter
|
||||||
def gain(self, val: float):
|
def gain(self, val: float):
|
||||||
if not -15 <= val <= 15:
|
if not -15 <= val <= 15:
|
||||||
raise XAirRemoteError("expected value in range -15.0 to 15.0")
|
self.logger.warning("expected value in range -15.0 to 15.0")
|
||||||
self.setter("g", util.lin_set(-15, 15, val))
|
self.setter("g", util.lin_set(-15, 15, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -512,7 +511,7 @@ class EQ:
|
|||||||
@quality.setter
|
@quality.setter
|
||||||
def quality(self, val: float):
|
def quality(self, val: float):
|
||||||
if not 0.3 <= val <= 10:
|
if not 0.3 <= val <= 10:
|
||||||
raise XAirRemoteError("expected value in range 0.3 to 10.0")
|
self.logger.warning("expected value in range 0.3 to 10.0")
|
||||||
self.setter("q", util.log_set(0.3, 10, val))
|
self.setter("q", util.log_set(0.3, 10, val))
|
||||||
|
|
||||||
|
|
||||||
@ -620,7 +619,7 @@ class Automix:
|
|||||||
@weight.setter
|
@weight.setter
|
||||||
def weight(self, val: float):
|
def weight(self, val: float):
|
||||||
if not -12 <= val <= 12:
|
if not -12 <= val <= 12:
|
||||||
raise XAirRemoteError("expected value in range -12.0 to 12.0")
|
self.logger.warning("expected value in range -12.0 to 12.0")
|
||||||
self.setter("weight", util.lin_set(-12, 12, val))
|
self.setter("weight", util.lin_set(-12, 12, val))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user