log value given as well as value expected

This commit is contained in:
onyx-and-iris 2024-02-15 16:58:18 +00:00
parent 1e5e458105
commit 8b1b2c7f79
3 changed files with 58 additions and 28 deletions

View File

@ -117,7 +117,9 @@ 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:
self.logger.warning("expected value in range -18.0 to 18.0") self.logger.warning(
f"sourcetrim got {val}, 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
@ -143,7 +145,9 @@ 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:
self.logger.warning("expected value in range -40 to 0") self.logger.warning(
f"dimgain got {val}, 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

View File

@ -57,7 +57,9 @@ def geq_prop(param):
def fset(self, val): def fset(self, val):
if not -15 <= val <= 15: if not -15 <= val <= 15:
self.logger.warning("expected value in range -15.0 to 15.0") self.logger.warning(
f"slider_{param} got {val}, 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)

View File

@ -60,7 +60,9 @@ 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:
self.logger.warning("expected value in range -18.0 to 18.0") self.logger.warning(
f"usbtrim got {val}, 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
@ -94,7 +96,9 @@ 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:
self.logger.warning("expected value in range 20 to 400") self.logger.warning(
f"highpassfilter got {val}, 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))
@ -121,7 +125,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:
self.logger.warning(f"expected one of {opts}") self.logger.warning(f"mode got {val}, expected one of {opts}")
self.setter("mode", opts.index(val)) self.setter("mode", opts.index(val))
@property @property
@ -131,7 +135,9 @@ 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:
self.logger.warning("expected value in range -80.0 to 0.0") self.logger.warning(
f"threshold got {val}, 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
@ -141,7 +147,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:
self.logger.warning("expected value in range 3 to 60") self.logger.warning(f"range got {val}, 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
@ -151,7 +157,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:
self.logger.warning("expected value in range 0 to 120") self.logger.warning(f"attack got {val}, 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
@ -162,7 +168,9 @@ 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:
self.logger.warning("expected value in range 0.02 to 2000.0") self.logger.warning(
f"hold got {val}, 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
@ -172,7 +180,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:
self.logger.warning("expected value in range 5 to 4000") self.logger.warning(f"release got {val}, 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
@ -207,7 +215,9 @@ 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:
self.logger.warning("expected value in range 20 to 20000") self.logger.warning(
f"filterfreq got {val}, 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))
@ -234,7 +244,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:
self.logger.warning(f"expected one of {opts}") self.logger.warning(f"mode got {val}, expected one of {opts}")
self.setter("mode", opts.index(val)) self.setter("mode", opts.index(val))
@property @property
@ -246,7 +256,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:
self.logger.warning(f"expected one of {opts}") self.logger.warning(f"det got {val}, expected one of {opts}")
self.setter("det", opts.index(val)) self.setter("det", opts.index(val))
@property @property
@ -258,7 +268,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:
self.logger.warning(f"expected one of {opts}") self.logger.warning(f"env got {val}, expected one of {opts}")
self.setter("env", opts.index(val)) self.setter("env", opts.index(val))
@property @property
@ -268,7 +278,9 @@ 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:
self.logger.warning("expected value in range -60.0 to 0") self.logger.warning(
f"threshold got {val}, 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
@ -287,7 +299,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:
self.logger.warning("expected value in range 0 to 5") self.logger.warning(f"knee got {val}, 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
@ -297,7 +309,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:
self.logger.warning("expected value in range 0.0 to 24.0") self.logger.warning(f"mgain got {val}, 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
@ -307,7 +319,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:
self.logger.warning("expected value in range 0 to 120") self.logger.warning(f"attack got {val}, 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
@ -318,7 +330,9 @@ 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:
self.logger.warning("expected value in range 0.02 to 2000.0") self.logger.warning(
f"hold got {val}, 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
@ -328,7 +342,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:
self.logger.warning("expected value in range 5 to 4000") self.logger.warning(f"release got {val}, 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
@ -338,7 +352,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:
self.logger.warning("expected value in range 0 to 100") self.logger.warning(f"mix got {val}, 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
@ -381,7 +395,9 @@ 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:
self.logger.warning("expected value in range 20 to 20000") self.logger.warning(
f"filterfreq got {val}, 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))
@ -461,7 +477,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:
self.logger.warning(f"expected one of {opts}") self.logger.warning(f"mode got {val}, expected one of {opts}")
self.setter("mode", opts.index(val)) self.setter("mode", opts.index(val))
class EQBand: class EQBand:
@ -490,7 +506,9 @@ 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:
self.logger.warning("expected value in range 20.0 to 20000.0") self.logger.warning(
f"frequency got {val}, 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
@ -500,7 +518,9 @@ 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:
self.logger.warning("expected value in range -15.0 to 15.0") self.logger.warning(
f"gain got {val}, 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
@ -511,7 +531,9 @@ 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:
self.logger.warning("expected value in range 0.3 to 10.0") self.logger.warning(
f"quality got {val}, 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))
@ -619,7 +641,9 @@ 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:
self.logger.warning("expected value in range -12.0 to 12.0") self.logger.warning(
f"weight got {val}, 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))