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