mirror of
https://github.com/onyx-and-iris/xair-api-python.git
synced 2025-01-18 04:40:47 +00:00
re-run through ruff formatter
This commit is contained in:
parent
5a988e8d37
commit
53ad8fdff5
@ -8,13 +8,13 @@ logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
|
||||
def main():
|
||||
with xair_api.connect("XR18", ip="mixer.local") as mixer:
|
||||
with xair_api.connect('XR18', ip='mixer.local') as mixer:
|
||||
mixer.headamp[8].phantom = True
|
||||
for i in range(-12, -6):
|
||||
mixer.headamp[8].gain = i
|
||||
print(mixer.headamp[8].gain)
|
||||
input("Press Enter to continue...")
|
||||
input('Press Enter to continue...')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -6,7 +6,7 @@ logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
|
||||
def main():
|
||||
with xair_api.connect("XR18", ip="mixer.local") as mixer:
|
||||
with xair_api.connect('XR18', ip='mixer.local') as mixer:
|
||||
for send in mixer.strip[0].send:
|
||||
send.level = -22.8
|
||||
|
||||
@ -20,5 +20,5 @@ def main():
|
||||
print(mixer.fxreturn[0].send[0].level)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -17,28 +17,28 @@ class Observer:
|
||||
|
||||
def on_current_program_scene_changed(self, data):
|
||||
scene = data.scene_name
|
||||
print(f"Switched to scene {scene}")
|
||||
print(f'Switched to scene {scene}')
|
||||
match scene:
|
||||
case "START":
|
||||
print("Toggling strip 01 on")
|
||||
case 'START':
|
||||
print('Toggling strip 01 on')
|
||||
self._mixer.strip[0].mix.on = not self._mixer.strip[0].mix.on
|
||||
case "BRB":
|
||||
print("Setting strip 08 fader")
|
||||
case 'BRB':
|
||||
print('Setting strip 08 fader')
|
||||
self._mixer.strip[7].mix.fader = -12.8
|
||||
case "END":
|
||||
print("Settings strip 02 color")
|
||||
case 'END':
|
||||
print('Settings strip 02 color')
|
||||
self._mixer.strip[1].config.color = 8
|
||||
case "LIVE":
|
||||
case 'LIVE':
|
||||
self._mixer.config.mute_group[0].on = True
|
||||
print(f"Mute Group 1 is {self._mixer.config.mute_group[0].on}")
|
||||
print(f'Mute Group 1 is {self._mixer.config.mute_group[0].on}')
|
||||
|
||||
|
||||
def main():
|
||||
with xair_api.connect("MR18", ip="mixer.local") as mixer:
|
||||
with xair_api.connect('MR18', ip='mixer.local') as mixer:
|
||||
with Observer(mixer):
|
||||
while _ := input("Press <Enter> to exit\n"):
|
||||
while _ := input('Press <Enter> to exit\n'):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -5,8 +5,8 @@ from dataclasses import dataclass
|
||||
import xair_api
|
||||
from xair_api import kinds
|
||||
|
||||
kind_id = "X32"
|
||||
ip = "x32.local"
|
||||
kind_id = 'X32'
|
||||
ip = 'x32.local'
|
||||
|
||||
tests = xair_api.connect(kind_id, ip=ip)
|
||||
|
||||
@ -30,7 +30,7 @@ data = Data()
|
||||
|
||||
|
||||
def setup_module():
|
||||
print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout)
|
||||
print(f'\nRunning tests for kind [{data.name}]\n', file=sys.stdout)
|
||||
tests.worker = threading.Thread(target=tests.run_server)
|
||||
tests.worker.daemon = True
|
||||
tests.worker.start()
|
||||
|
@ -11,11 +11,11 @@ class TestSetAndGetStripMuteHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "strip")[data.strip]
|
||||
self.target = getattr(tests, 'strip')[data.strip]
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("mute", True), ("mute", False)],
|
||||
'param,value',
|
||||
[('mute', True), ('mute', False)],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_mute_bool_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -28,12 +28,12 @@ class TestSetAndGetStripMixHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "strip")
|
||||
self.target = getattr(self.target[data.strip], "mix")
|
||||
self.target = getattr(tests, 'strip')
|
||||
self.target = getattr(self.target[data.strip], 'mix')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("on", True), ("on", False)],
|
||||
'param,value',
|
||||
[('on', True), ('on', False)],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_bool_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -49,12 +49,12 @@ class TestSetAndGetBusConfigHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "bus")
|
||||
self.target = getattr(self.target[data.bus], "config")
|
||||
self.target = getattr(tests, 'bus')
|
||||
self.target = getattr(self.target[data.bus], 'config')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("color", 0), ("color", 15)],
|
||||
'param,value',
|
||||
[('color', 0), ('color', 15)],
|
||||
)
|
||||
def test_it_sets_and_gets_bus_int_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -70,12 +70,12 @@ class TestSetAndGetAuxInPreampHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "auxin")
|
||||
self.target = getattr(self.target[data.auxrtn], "preamp")
|
||||
self.target = getattr(tests, 'auxin')
|
||||
self.target = getattr(self.target[data.auxrtn], 'preamp')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("invert", True), ("invert", False)],
|
||||
'param,value',
|
||||
[('invert', True), ('invert', False)],
|
||||
)
|
||||
def test_it_sets_and_gets_auxrtn_bool_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -91,12 +91,12 @@ class TestSetAndGetFXReturnEQHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "fxreturn")
|
||||
self.target = getattr(self.target[data.fx], "eq")
|
||||
self.target = getattr(tests, 'fxreturn')
|
||||
self.target = getattr(self.target[data.fx], 'eq')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("on", True), ("on", False)],
|
||||
'param,value',
|
||||
[('on', True), ('on', False)],
|
||||
)
|
||||
def test_it_sets_and_gets_fxrtn_bool_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -112,12 +112,12 @@ class TestSetAndGetMatrixDynHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "matrix")
|
||||
self.target = getattr(self.target[data.matrix], "dyn")
|
||||
self.target = getattr(tests, 'matrix')
|
||||
self.target = getattr(self.target[data.matrix], 'dyn')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("mode", "comp"), ("mode", "exp")],
|
||||
'param,value',
|
||||
[('mode', 'comp'), ('mode', 'exp')],
|
||||
)
|
||||
def test_it_sets_and_gets_matrix_string_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -133,11 +133,11 @@ class TestSetAndGetMainStereoInsertHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "mainst")
|
||||
self.target = getattr(tests, 'mainst')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("mode", "comp"), ("mode", "exp")],
|
||||
'param,value',
|
||||
[('mode', 'comp'), ('mode', 'exp')],
|
||||
)
|
||||
def test_it_sets_and_gets_mainst_string_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
|
@ -5,8 +5,8 @@ from dataclasses import dataclass
|
||||
import xair_api
|
||||
from xair_api import kinds
|
||||
|
||||
kind_id = "MR18"
|
||||
ip = "mixer.local"
|
||||
kind_id = 'MR18'
|
||||
ip = 'mixer.local'
|
||||
|
||||
tests = xair_api.connect(kind_id, ip=ip)
|
||||
|
||||
@ -28,7 +28,7 @@ data = Data()
|
||||
|
||||
|
||||
def setup_module():
|
||||
print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout)
|
||||
print(f'\nRunning tests for kind [{data.name}]\n', file=sys.stdout)
|
||||
tests.worker = threading.Thread(target=tests.run_server)
|
||||
tests.worker.daemon = True
|
||||
tests.worker.start()
|
||||
|
@ -19,20 +19,20 @@ class TestSetAndGetLRMixHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "lr")
|
||||
self.target = getattr(self.target, "mix")
|
||||
self.target = getattr(tests, 'lr')
|
||||
self.target = getattr(self.target, 'mix')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("on", True), ("on", False)],
|
||||
'param,value',
|
||||
[('on', True), ('on', False)],
|
||||
)
|
||||
def test_it_sets_and_gets_lr_bool_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("fader", -80.6), ("fader", -67.0)],
|
||||
'param,value',
|
||||
[('fader', -80.6), ('fader', -67.0)],
|
||||
)
|
||||
def test_it_sets_and_gets_lr_float_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -45,10 +45,10 @@ class TestSetAndGetLRConfigHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "lr")
|
||||
self.target = getattr(self.target, "config")
|
||||
self.target = getattr(tests, 'lr')
|
||||
self.target = getattr(self.target, 'config')
|
||||
|
||||
@pytest.mark.parametrize("param,value", [("name", "test0"), ("name", "test1")])
|
||||
@pytest.mark.parametrize('param,value', [('name', 'test0'), ('name', 'test1')])
|
||||
def test_it_sets_and_gets_lr_string_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
||||
@ -60,20 +60,20 @@ class TestSetAndGetLRInsertHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "lr")
|
||||
self.target = getattr(self.target, "insert")
|
||||
self.target = getattr(tests, 'lr')
|
||||
self.target = getattr(self.target, 'insert')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("on", True), ("on", False)],
|
||||
'param,value',
|
||||
[('on', True), ('on', False)],
|
||||
)
|
||||
def test_it_sets_and_gets_lr_bool_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("sel", 0), ("sel", 4)],
|
||||
'param,value',
|
||||
[('sel', 0), ('sel', 4)],
|
||||
)
|
||||
def test_it_sets_and_gets_lr_int_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -86,16 +86,16 @@ class TestSetAndGetLRGEQHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "lr")
|
||||
self.target = getattr(self.target, "geq")
|
||||
self.target = getattr(tests, 'lr')
|
||||
self.target = getattr(self.target, 'geq')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
'param,value',
|
||||
[
|
||||
("slider_20", -13.5),
|
||||
("slider_20", 5.5),
|
||||
("slider_6k3", -8.5),
|
||||
("slider_6k3", 8.5),
|
||||
('slider_20', -13.5),
|
||||
('slider_20', 5.5),
|
||||
('slider_6k3', -8.5),
|
||||
('slider_6k3', 8.5),
|
||||
],
|
||||
)
|
||||
def test_it_sets_and_gets_lr_int_params(self, param, value):
|
||||
@ -112,11 +112,11 @@ class TestSetAndGetStripMuteHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "strip")[data.strip]
|
||||
self.target = getattr(tests, 'strip')[data.strip]
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("mute", True), ("mute", False)],
|
||||
'param,value',
|
||||
[('mute', True), ('mute', False)],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_mute_bool_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -129,12 +129,12 @@ class TestSetAndGetStripMixHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "strip")
|
||||
self.target = getattr(self.target[data.strip], "mix")
|
||||
self.target = getattr(tests, 'strip')
|
||||
self.target = getattr(self.target[data.strip], 'mix')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("on", True), ("on", False), ("lr", True), ("lr", False)],
|
||||
'param,value',
|
||||
[('on', True), ('on', False), ('lr', True), ('lr', False)],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_bool_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -147,16 +147,16 @@ class TestSetAndGetStripPreampHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "strip")
|
||||
self.target = getattr(self.target[data.strip], "preamp")
|
||||
self.target = getattr(tests, 'strip')
|
||||
self.target = getattr(self.target[data.strip], 'preamp')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
'param,value',
|
||||
[
|
||||
("highpasson", True),
|
||||
("highpasson", False),
|
||||
("usbinput", True),
|
||||
("usbinput", False),
|
||||
('highpasson', True),
|
||||
('highpasson', False),
|
||||
('usbinput', True),
|
||||
('usbinput', False),
|
||||
],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_bool_params(self, param, value):
|
||||
@ -164,16 +164,16 @@ class TestSetAndGetStripPreampHigher:
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("highpassfilter", 20), ("highpassfilter", 399)],
|
||||
'param,value',
|
||||
[('highpassfilter', 20), ('highpassfilter', 399)],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_int_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("usbtrim", -16.5), ("usbtrim", 5.5)],
|
||||
'param,value',
|
||||
[('usbtrim', -16.5), ('usbtrim', 5.5)],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_float_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -186,12 +186,12 @@ class TestSetAndGetStripConfigHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "strip")
|
||||
self.target = getattr(self.target[data.strip], "config")
|
||||
self.target = getattr(tests, 'strip')
|
||||
self.target = getattr(self.target[data.strip], 'config')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("inputsource", 0), ("inputsource", 18), ("usbreturn", 3), ("usbreturn", 12)],
|
||||
'param,value',
|
||||
[('inputsource', 0), ('inputsource', 18), ('usbreturn', 3), ('usbreturn', 12)],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_int_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -204,18 +204,18 @@ class TestSetAndGetStripGateHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "strip")
|
||||
self.target = getattr(self.target[data.strip], "gate")
|
||||
self.target = getattr(tests, 'strip')
|
||||
self.target = getattr(self.target[data.strip], 'gate')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
'param,value',
|
||||
[
|
||||
("on", True),
|
||||
("on", False),
|
||||
("invert", True),
|
||||
("invert", False),
|
||||
("filteron", True),
|
||||
("filteron", False),
|
||||
('on', True),
|
||||
('on', False),
|
||||
('invert', True),
|
||||
('invert', False),
|
||||
('filteron', True),
|
||||
('filteron', False),
|
||||
],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_bool_params(self, param, value):
|
||||
@ -223,16 +223,16 @@ class TestSetAndGetStripGateHigher:
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
'param,value',
|
||||
[
|
||||
("range", 11),
|
||||
("range", 48),
|
||||
("attack", 5),
|
||||
("attack", 110),
|
||||
("release", 360),
|
||||
("release", 2505),
|
||||
("filtertype", 0),
|
||||
("filtertype", 8),
|
||||
('range', 11),
|
||||
('range', 48),
|
||||
('attack', 5),
|
||||
('attack', 110),
|
||||
('release', 360),
|
||||
('release', 2505),
|
||||
('filtertype', 0),
|
||||
('filtertype', 8),
|
||||
],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_int_params(self, param, value):
|
||||
@ -240,22 +240,22 @@ class TestSetAndGetStripGateHigher:
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("mode", "exp2"), ("mode", "duck")],
|
||||
'param,value',
|
||||
[('mode', 'exp2'), ('mode', 'duck')],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_string_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
'param,value',
|
||||
[
|
||||
("threshold", -80.0),
|
||||
("threshold", 0.0),
|
||||
("hold", 355),
|
||||
("hold", 63.2),
|
||||
("filterfreq", 37.2),
|
||||
("filterfreq", 12765),
|
||||
('threshold', -80.0),
|
||||
('threshold', 0.0),
|
||||
('hold', 355),
|
||||
('hold', 63.2),
|
||||
('filterfreq', 37.2),
|
||||
('filterfreq', 12765),
|
||||
],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_float_params(self, param, value):
|
||||
@ -269,20 +269,20 @@ class TestSetAndGetStripAutomixHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "strip")
|
||||
self.target = getattr(self.target[data.strip], "automix")
|
||||
self.target = getattr(tests, 'strip')
|
||||
self.target = getattr(self.target[data.strip], 'automix')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("group", 0), ("group", 2)],
|
||||
'param,value',
|
||||
[('group', 0), ('group', 2)],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_int_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("weight", -10.5), ("weight", 3.5)],
|
||||
'param,value',
|
||||
[('weight', -10.5), ('weight', 3.5)],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_float_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -298,12 +298,12 @@ class TestSetAndGetBusConfigHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "bus")
|
||||
self.target = getattr(self.target[data.bus], "config")
|
||||
self.target = getattr(tests, 'bus')
|
||||
self.target = getattr(self.target[data.bus], 'config')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("color", 0), ("color", 15)],
|
||||
'param,value',
|
||||
[('color', 0), ('color', 15)],
|
||||
)
|
||||
def test_it_sets_and_gets_bus_bool_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -316,26 +316,26 @@ class TestSetAndGetBusDynHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "bus")
|
||||
self.target = getattr(self.target[data.bus], "dyn")
|
||||
self.target = getattr(tests, 'bus')
|
||||
self.target = getattr(self.target[data.bus], 'dyn')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("on", True), ("on", False)],
|
||||
'param,value',
|
||||
[('on', True), ('on', False)],
|
||||
)
|
||||
def test_it_sets_and_gets_bus_bool_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
'param,value',
|
||||
[
|
||||
("mode", "comp"),
|
||||
("mode", "exp"),
|
||||
("env", "lin"),
|
||||
("env", "log"),
|
||||
("det", "peak"),
|
||||
("det", "rms"),
|
||||
('mode', 'comp'),
|
||||
('mode', 'exp'),
|
||||
('env', 'lin'),
|
||||
('env', 'log'),
|
||||
('det', 'peak'),
|
||||
('det', 'rms'),
|
||||
],
|
||||
)
|
||||
def test_it_sets_and_gets_bus_string_params(self, param, value):
|
||||
@ -349,20 +349,20 @@ class TestSetAndGetBusEQHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "bus")
|
||||
self.target = getattr(self.target[data.bus], "eq")
|
||||
self.target = getattr(tests, 'bus')
|
||||
self.target = getattr(self.target[data.bus], 'eq')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("on", True), ("on", False)],
|
||||
'param,value',
|
||||
[('on', True), ('on', False)],
|
||||
)
|
||||
def test_it_sets_and_gets_bus_bool_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("mode", "peq"), ("mode", "geq"), ("mode", "teq")],
|
||||
'param,value',
|
||||
[('mode', 'peq'), ('mode', 'geq'), ('mode', 'teq')],
|
||||
)
|
||||
def test_it_sets_and_gets_bus_string_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
@ -378,12 +378,12 @@ class TestSetAndGetFXSendGroupHigher:
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "fxsend")
|
||||
self.target = getattr(self.target[data.fx], "group")
|
||||
self.target = getattr(tests, 'fxsend')
|
||||
self.target = getattr(self.target[data.fx], 'group')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("dca", 0), ("dca", 12), ("mute", 3), ("mute", 8)],
|
||||
'param,value',
|
||||
[('dca', 0), ('dca', 12), ('mute', 3), ('mute', 8)],
|
||||
)
|
||||
def test_it_sets_and_gets_fxsend_int_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
|
@ -1,3 +1,3 @@
|
||||
from .xair import request_remote_obj as connect
|
||||
|
||||
_ALL__ = ["connect"]
|
||||
_ALL__ = ['connect']
|
||||
|
@ -8,40 +8,40 @@ from .rtn import FxRtn as IFxRtn
|
||||
class Bus(IBus):
|
||||
@property
|
||||
def address(self):
|
||||
return f"/bus/{str(self.index).zfill(2)}"
|
||||
return f'/bus/{str(self.index).zfill(2)}'
|
||||
|
||||
|
||||
class AuxRtn(IAuxRtn):
|
||||
@property
|
||||
def address(self):
|
||||
return f"/auxin/{str(self.index).zfill(2)}"
|
||||
return f'/auxin/{str(self.index).zfill(2)}'
|
||||
|
||||
|
||||
class FxRtn(IFxRtn):
|
||||
@property
|
||||
def address(self):
|
||||
return f"/fxrtn/{str(self.index).zfill(2)}"
|
||||
return f'/fxrtn/{str(self.index).zfill(2)}'
|
||||
|
||||
|
||||
class MainStereo(ILR):
|
||||
@property
|
||||
def address(self) -> str:
|
||||
return "/main/st"
|
||||
return '/main/st'
|
||||
|
||||
|
||||
class MainMono(ILR):
|
||||
@property
|
||||
def address(self) -> str:
|
||||
return "/main/m"
|
||||
return '/main/m'
|
||||
|
||||
|
||||
class Matrix(ILR):
|
||||
@property
|
||||
def address(self) -> str:
|
||||
return f"/mtx/{str(self.index).zfill(2)}"
|
||||
return f'/mtx/{str(self.index).zfill(2)}'
|
||||
|
||||
|
||||
class HeadAmp(IHeadAmp):
|
||||
@property
|
||||
def address(self):
|
||||
return f"/headamp/{str(self.index).zfill(3)}"
|
||||
return f'/headamp/{str(self.index).zfill(3)}'
|
||||
|
@ -16,10 +16,10 @@ class IBus(abc.ABC):
|
||||
self.logger = logger.getChild(self.__class__.__name__)
|
||||
|
||||
def getter(self, param: str):
|
||||
return self._remote.query(f"{self.address}/{param}")
|
||||
return self._remote.query(f'{self.address}/{param}')
|
||||
|
||||
def setter(self, param: str, val: int):
|
||||
self._remote.send(f"{self.address}/{param}", val)
|
||||
self._remote.send(f'{self.address}/{param}', val)
|
||||
|
||||
@abc.abstractmethod
|
||||
def address(self):
|
||||
@ -39,12 +39,12 @@ class Bus(IBus):
|
||||
Returns a Bus class of a kind.
|
||||
"""
|
||||
BUS_cls = type(
|
||||
f"Bus{remote.kind}",
|
||||
f'Bus{remote.kind}',
|
||||
(cls,),
|
||||
{
|
||||
**{
|
||||
_cls.__name__.lower(): type(
|
||||
f"{_cls.__name__}{remote.kind}", (_cls, cls), {}
|
||||
f'{_cls.__name__}{remote.kind}', (_cls, cls), {}
|
||||
)(remote, index)
|
||||
for _cls in (
|
||||
Config,
|
||||
@ -56,11 +56,11 @@ class Bus(IBus):
|
||||
Group,
|
||||
)
|
||||
},
|
||||
"mute": mute_prop(),
|
||||
'mute': mute_prop(),
|
||||
},
|
||||
)
|
||||
return BUS_cls(remote, index)
|
||||
|
||||
@property
|
||||
def address(self) -> str:
|
||||
return f"/bus/{self.index}"
|
||||
return f'/bus/{self.index}'
|
||||
|
@ -15,10 +15,10 @@ class IConfig(abc.ABC):
|
||||
self.logger = logger.getChild(self.__class__.__name__)
|
||||
|
||||
def getter(self, param: str):
|
||||
return self._remote.query(f"{self.address}/{param}")
|
||||
return self._remote.query(f'{self.address}/{param}')
|
||||
|
||||
def setter(self, param: str, val: int):
|
||||
self._remote.send(f"{self.address}/{param}", val)
|
||||
self._remote.send(f'{self.address}/{param}', val)
|
||||
|
||||
@abc.abstractmethod
|
||||
def address(self):
|
||||
@ -36,37 +36,37 @@ class Config(IConfig):
|
||||
Returns a Config class of a kind.
|
||||
"""
|
||||
LINKS_cls = _make_links_mixins[remote.kind.id_]
|
||||
MUTEGROUP_cls = type("MuteGroup", (Config.MuteGroup, cls), {})
|
||||
MONITOR_cls = type("ConfigMonitor", (Config.Monitor, cls), {})
|
||||
MUTEGROUP_cls = type('MuteGroup', (Config.MuteGroup, cls), {})
|
||||
MONITOR_cls = type('ConfigMonitor', (Config.Monitor, cls), {})
|
||||
CONFIG_cls = type(
|
||||
f"Config{remote.kind}",
|
||||
f'Config{remote.kind}',
|
||||
(cls, LINKS_cls),
|
||||
{
|
||||
"mute_group": tuple(MUTEGROUP_cls(remote, i) for i in range(4)),
|
||||
"monitor": MONITOR_cls(remote),
|
||||
'mute_group': tuple(MUTEGROUP_cls(remote, i) for i in range(4)),
|
||||
'monitor': MONITOR_cls(remote),
|
||||
},
|
||||
)
|
||||
return CONFIG_cls(remote)
|
||||
|
||||
@property
|
||||
def address(self) -> str:
|
||||
return "/config"
|
||||
return '/config'
|
||||
|
||||
@property
|
||||
def amixenable(self) -> bool:
|
||||
return self.getter("mute")[0] == 1
|
||||
return self.getter('mute')[0] == 1
|
||||
|
||||
@amixenable.setter
|
||||
def amixenable(self, val: bool):
|
||||
self.setter("amixenable", 1 if val else 0)
|
||||
self.setter('amixenable', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def amixlock(self) -> bool:
|
||||
return self.getter("amixlock")[0] == 1
|
||||
return self.getter('amixlock')[0] == 1
|
||||
|
||||
@amixlock.setter
|
||||
def amixlock(self, val: bool):
|
||||
self.setter("amixlock", 1 if val else 0)
|
||||
self.setter('amixlock', 1 if val else 0)
|
||||
|
||||
class MuteGroup:
|
||||
def __init__(self, remote, i):
|
||||
@ -76,128 +76,128 @@ class Config(IConfig):
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(Config.MuteGroup, self).address
|
||||
return f"{root}/mute"
|
||||
return f'{root}/mute'
|
||||
|
||||
@property
|
||||
def on(self) -> bool:
|
||||
return self.getter(f"{self.i}")[0] == 1
|
||||
return self.getter(f'{self.i}')[0] == 1
|
||||
|
||||
@on.setter
|
||||
def on(self, val: bool):
|
||||
self.setter(f"{self.i}", 1 if val else 0)
|
||||
self.setter(f'{self.i}', 1 if val else 0)
|
||||
|
||||
class Monitor:
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(Config.Monitor, self).address
|
||||
return f"{root}/solo"
|
||||
return f'{root}/solo'
|
||||
|
||||
@property
|
||||
@util.db_from
|
||||
def level(self) -> float:
|
||||
return self.getter("level")[0]
|
||||
return self.getter('level')[0]
|
||||
|
||||
@level.setter
|
||||
@util.db_to
|
||||
def level(self, val: float):
|
||||
self.setter("level", val)
|
||||
self.setter('level', val)
|
||||
|
||||
@property
|
||||
def source(self) -> int:
|
||||
return int(self.getter("source")[0])
|
||||
return int(self.getter('source')[0])
|
||||
|
||||
@source.setter
|
||||
def source(self, val: int):
|
||||
self.setter("source", val)
|
||||
self.setter('source', val)
|
||||
|
||||
@property
|
||||
def sourcetrim(self) -> float:
|
||||
return round(util.lin_get(-18, 18, self.getter("sourcetrim")[0]), 1)
|
||||
return round(util.lin_get(-18, 18, self.getter('sourcetrim')[0]), 1)
|
||||
|
||||
@sourcetrim.setter
|
||||
def sourcetrim(self, val: float):
|
||||
if not -18 <= val <= 18:
|
||||
self.logger.warning(
|
||||
f"sourcetrim got {val}, expected value in range -18.0 to 18.0"
|
||||
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
|
||||
def chmode(self) -> bool:
|
||||
return self.getter("chmode")[0] == 1
|
||||
return self.getter('chmode')[0] == 1
|
||||
|
||||
@chmode.setter
|
||||
def chmode(self, val: bool):
|
||||
self.setter("chmode", 1 if val else 0)
|
||||
self.setter('chmode', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def busmode(self) -> bool:
|
||||
return self.getter("busmode")[0] == 1
|
||||
return self.getter('busmode')[0] == 1
|
||||
|
||||
@busmode.setter
|
||||
def busmode(self, val: bool):
|
||||
self.setter("busmode", 1 if val else 0)
|
||||
self.setter('busmode', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def dimgain(self) -> int:
|
||||
return int(util.lin_get(-40, 0, self.getter("dimatt")[0]))
|
||||
return int(util.lin_get(-40, 0, self.getter('dimatt')[0]))
|
||||
|
||||
@dimgain.setter
|
||||
def dimgain(self, val: int):
|
||||
if not -40 <= val <= 0:
|
||||
self.logger.warning(
|
||||
f"dimgain got {val}, expected value in range -40 to 0"
|
||||
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
|
||||
def dim(self) -> bool:
|
||||
return self.getter("dim")[0] == 1
|
||||
return self.getter('dim')[0] == 1
|
||||
|
||||
@dim.setter
|
||||
def dim(self, val: bool):
|
||||
self.setter("dim", 1 if val else 0)
|
||||
self.setter('dim', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def mono(self) -> bool:
|
||||
return self.getter("mono")[0] == 1
|
||||
return self.getter('mono')[0] == 1
|
||||
|
||||
@mono.setter
|
||||
def mono(self, val: bool):
|
||||
self.setter("mono", 1 if val else 0)
|
||||
self.setter('mono', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def mute(self) -> bool:
|
||||
return self.getter("mute")[0] == 1
|
||||
return self.getter('mute')[0] == 1
|
||||
|
||||
@mute.setter
|
||||
def mute(self, val: bool):
|
||||
self.setter("mute", 1 if val else 0)
|
||||
self.setter('mute', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def dimfpl(self) -> bool:
|
||||
return self.getter("dimfpl")[0] == 1
|
||||
return self.getter('dimfpl')[0] == 1
|
||||
|
||||
@dimfpl.setter
|
||||
def dimfpl(self, val: bool):
|
||||
self.setter("dimfpl", 1 if val else 0)
|
||||
self.setter('dimfpl', 1 if val else 0)
|
||||
|
||||
|
||||
def _make_links_mixin(kind):
|
||||
"""Creates a links mixin"""
|
||||
return type(
|
||||
f"Links{kind}",
|
||||
f'Links{kind}',
|
||||
(),
|
||||
{
|
||||
"link_eq": bool_prop("linkcfg/eq"),
|
||||
"link_dyn": bool_prop("linkcfg/dyn"),
|
||||
"link_fader_mute": bool_prop("linkcfg/fdrmute"),
|
||||
'link_eq': bool_prop('linkcfg/eq'),
|
||||
'link_dyn': bool_prop('linkcfg/dyn'),
|
||||
'link_fader_mute': bool_prop('linkcfg/fdrmute'),
|
||||
**{
|
||||
f"chlink{i}_{i+1}": bool_prop(f"chlink/{i}-{i+1}")
|
||||
f'chlink{i}_{i+1}': bool_prop(f'chlink/{i}-{i+1}')
|
||||
for i in range(1, kind.num_strip, 2)
|
||||
},
|
||||
**{
|
||||
f"buslink{i}_{i+1}": bool_prop(f"buslink/{i}-{i+1}")
|
||||
f'buslink{i}_{i+1}': bool_prop(f'buslink/{i}-{i+1}')
|
||||
for i in range(1, kind.num_bus, 2)
|
||||
},
|
||||
},
|
||||
|
@ -13,10 +13,10 @@ class IDCA(abc.ABC):
|
||||
self.logger = logger.getChild(self.__class__.__name__)
|
||||
|
||||
def getter(self, param: str) -> tuple:
|
||||
return self._remote.query(f"{self.address}/{param}")
|
||||
return self._remote.query(f'{self.address}/{param}')
|
||||
|
||||
def setter(self, param: str, val: int):
|
||||
self._remote.send(f"{self.address}/{param}", val)
|
||||
self._remote.send(f'{self.address}/{param}', val)
|
||||
|
||||
@abc.abstractmethod
|
||||
def address(self):
|
||||
@ -28,15 +28,15 @@ class DCA(IDCA):
|
||||
|
||||
@property
|
||||
def address(self) -> str:
|
||||
return f"/dca/{self.index}"
|
||||
return f'/dca/{self.index}'
|
||||
|
||||
@property
|
||||
def on(self) -> bool:
|
||||
return self.getter("on")[0] == 1
|
||||
return self.getter('on')[0] == 1
|
||||
|
||||
@on.setter
|
||||
def on(self, val: bool):
|
||||
self.setter("on", 1 if val else 0)
|
||||
self.setter('on', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def mute(self) -> bool:
|
||||
@ -48,16 +48,16 @@ class DCA(IDCA):
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self.getter("config/name")[0]
|
||||
return self.getter('config/name')[0]
|
||||
|
||||
@name.setter
|
||||
def name(self, val: str):
|
||||
self.setter("config/name", val)
|
||||
self.setter('config/name', val)
|
||||
|
||||
@property
|
||||
def color(self) -> int:
|
||||
return self.getter("config/color")[0]
|
||||
return self.getter('config/color')[0]
|
||||
|
||||
@color.setter
|
||||
def color(self, val: int):
|
||||
self.setter("config/color", val)
|
||||
self.setter('config/color', val)
|
||||
|
@ -10,5 +10,5 @@ class XAirRemoteConnectionTimeoutError(XAirRemoteError):
|
||||
self.port = port
|
||||
|
||||
super().__init__(
|
||||
f"Timeout attempting to connect to mixer at {self.ip}:{self.port}"
|
||||
f'Timeout attempting to connect to mixer at {self.ip}:{self.port}'
|
||||
)
|
||||
|
@ -16,10 +16,10 @@ class IFX(abc.ABC):
|
||||
self.logger = logger.getChild(self.__class__.__name__)
|
||||
|
||||
def getter(self, param: str):
|
||||
return self._remote.query(f"{self.address}/{param}")
|
||||
return self._remote.query(f'{self.address}/{param}')
|
||||
|
||||
def setter(self, param: str, val: int):
|
||||
self._remote.send(f"{self.address}/{param}", val)
|
||||
self._remote.send(f'{self.address}/{param}', val)
|
||||
|
||||
@abc.abstractmethod
|
||||
def address(self):
|
||||
@ -31,15 +31,15 @@ class FX(IFX):
|
||||
|
||||
@property
|
||||
def address(self) -> str:
|
||||
return f"/fx/{self.index}"
|
||||
return f'/fx/{self.index}'
|
||||
|
||||
@property
|
||||
def type(self) -> int:
|
||||
return self.getter("type")[0]
|
||||
return self.getter('type')[0]
|
||||
|
||||
@type.setter
|
||||
def type(self, val: int):
|
||||
self.setter("type", val)
|
||||
self.setter('type', val)
|
||||
|
||||
|
||||
class FXSend(IFX):
|
||||
@ -55,20 +55,20 @@ class FXSend(IFX):
|
||||
Returns an FXSend class of a kind.
|
||||
"""
|
||||
FXSEND_cls = type(
|
||||
f"FXSend{remote.kind}",
|
||||
f'FXSend{remote.kind}',
|
||||
(cls,),
|
||||
{
|
||||
**{
|
||||
_cls.__name__.lower(): type(
|
||||
f"{_cls.__name__}{remote.kind}", (_cls, cls), {}
|
||||
f'{_cls.__name__}{remote.kind}', (_cls, cls), {}
|
||||
)(remote, index)
|
||||
for _cls in (Config, Mix, Group)
|
||||
},
|
||||
"mute": mute_prop(),
|
||||
'mute': mute_prop(),
|
||||
},
|
||||
)
|
||||
return FXSEND_cls(remote, index)
|
||||
|
||||
@property
|
||||
def address(self) -> str:
|
||||
return f"/fxsend/{self.index}"
|
||||
return f'/fxsend/{self.index}'
|
||||
|
@ -15,10 +15,10 @@ class IHeadAmp(abc.ABC):
|
||||
self.logger = logger.getChild(self.__class__.__name__)
|
||||
|
||||
def getter(self, param: str):
|
||||
return self._remote.query(f"{self.address}/{param}")
|
||||
return self._remote.query(f'{self.address}/{param}')
|
||||
|
||||
def setter(self, param: str, val: int):
|
||||
self._remote.send(f"{self.address}/{param}", val)
|
||||
self._remote.send(f'{self.address}/{param}', val)
|
||||
|
||||
@abc.abstractmethod
|
||||
def address(self):
|
||||
@ -30,20 +30,20 @@ class HeadAmp(IHeadAmp):
|
||||
|
||||
@property
|
||||
def address(self):
|
||||
return f"/headamp/{str(self.index).zfill(2)}"
|
||||
return f'/headamp/{str(self.index).zfill(2)}'
|
||||
|
||||
@property
|
||||
def gain(self):
|
||||
return round(util.lin_get(-12, 60, self.getter("gain")[0]), 1)
|
||||
return round(util.lin_get(-12, 60, self.getter('gain')[0]), 1)
|
||||
|
||||
@gain.setter
|
||||
def gain(self, val):
|
||||
self.setter("gain", util.lin_set(-12, 60, val))
|
||||
self.setter('gain', util.lin_set(-12, 60, val))
|
||||
|
||||
@property
|
||||
def phantom(self):
|
||||
return self.getter("phantom")[0] == 1
|
||||
return self.getter('phantom')[0] == 1
|
||||
|
||||
@phantom.setter
|
||||
def phantom(self, val):
|
||||
self.setter("phantom", 1 if val else 0)
|
||||
self.setter('phantom', 1 if val else 0)
|
||||
|
@ -46,11 +46,11 @@ class XR12KindMap(KindMap):
|
||||
|
||||
|
||||
_kinds = {
|
||||
"X32": X32KindMap(id_="X32"),
|
||||
"MR18": XR18KindMap(id_="MR18"),
|
||||
"XR18": XR18KindMap(id_="XR18"),
|
||||
"XR16": XR16KindMap(id_="XR16"),
|
||||
"XR12": XR12KindMap(id_="XR12"),
|
||||
'X32': X32KindMap(id_='X32'),
|
||||
'MR18': XR18KindMap(id_='MR18'),
|
||||
'XR18': XR18KindMap(id_='XR18'),
|
||||
'XR16': XR16KindMap(id_='XR16'),
|
||||
'XR12': XR12KindMap(id_='XR12'),
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,10 +18,10 @@ class ILR(abc.ABC):
|
||||
self.logger = logger.getChild(self.__class__.__name__)
|
||||
|
||||
def getter(self, param: str):
|
||||
return self._remote.query(f"{self.address}/{param}")
|
||||
return self._remote.query(f'{self.address}/{param}')
|
||||
|
||||
def setter(self, param: str, val: int):
|
||||
self._remote.send(f"{self.address}/{param}", val)
|
||||
self._remote.send(f'{self.address}/{param}', val)
|
||||
|
||||
@abc.abstractmethod
|
||||
def address(self):
|
||||
@ -41,12 +41,12 @@ class LR(ILR):
|
||||
Returns an LR class of a kind.
|
||||
"""
|
||||
LR_cls = type(
|
||||
f"LR{remote.kind}",
|
||||
f'LR{remote.kind}',
|
||||
(cls,),
|
||||
{
|
||||
**{
|
||||
_cls.__name__.lower(): type(
|
||||
f"{_cls.__name__}{remote.kind}", (_cls, cls), {}
|
||||
f'{_cls.__name__}{remote.kind}', (_cls, cls), {}
|
||||
)(remote, index)
|
||||
for _cls in (
|
||||
Config,
|
||||
@ -57,11 +57,11 @@ class LR(ILR):
|
||||
Mix,
|
||||
)
|
||||
},
|
||||
"mute": mute_prop(),
|
||||
'mute': mute_prop(),
|
||||
},
|
||||
)
|
||||
return LR_cls(remote, index)
|
||||
|
||||
@property
|
||||
def address(self) -> str:
|
||||
return "/lr"
|
||||
return '/lr'
|
||||
|
@ -50,7 +50,7 @@ def float_prop(param):
|
||||
|
||||
|
||||
def geq_prop(param):
|
||||
param = param.replace("_", ".")
|
||||
param = param.replace('_', '.')
|
||||
|
||||
def fget(self) -> float:
|
||||
return round(lin_get(-15, 15, self.getter(param)[0]), 1)
|
||||
@ -58,7 +58,7 @@ def geq_prop(param):
|
||||
def fset(self, val):
|
||||
if not -15 <= val <= 15:
|
||||
self.logger.warning(
|
||||
f"slider_{param} got {val}, expected value in range -15.0 to 15.0"
|
||||
f'slider_{param} got {val}, expected value in range -15.0 to 15.0'
|
||||
)
|
||||
self.setter(param, lin_set(-15, 15, val))
|
||||
|
||||
|
@ -18,10 +18,10 @@ class IRtn(abc.ABC):
|
||||
self.logger = logger.getChild(self.__class__.__name__)
|
||||
|
||||
def getter(self, param: str):
|
||||
return self._remote.query(f"{self.address}/{param}")
|
||||
return self._remote.query(f'{self.address}/{param}')
|
||||
|
||||
def setter(self, param: str, val: int):
|
||||
self._remote.send(f"{self.address}/{param}", val)
|
||||
self._remote.send(f'{self.address}/{param}', val)
|
||||
|
||||
@abc.abstractmethod
|
||||
def address(self):
|
||||
@ -41,12 +41,12 @@ class AuxRtn(IRtn):
|
||||
Returns an AuxRtn class of a kind.
|
||||
"""
|
||||
AUXRTN_cls = type(
|
||||
f"AuxRtn{remote.kind}",
|
||||
f'AuxRtn{remote.kind}',
|
||||
(cls,),
|
||||
{
|
||||
**{
|
||||
_cls.__name__.lower(): type(
|
||||
f"{_cls.__name__}{remote.kind}", (_cls, cls), {}
|
||||
f'{_cls.__name__}{remote.kind}', (_cls, cls), {}
|
||||
)(remote, index)
|
||||
for _cls in (
|
||||
Config,
|
||||
@ -56,18 +56,18 @@ class AuxRtn(IRtn):
|
||||
Group,
|
||||
)
|
||||
},
|
||||
"send": tuple(
|
||||
'send': tuple(
|
||||
Send.make(cls, i, remote)
|
||||
for i in range(remote.kind.num_bus + remote.kind.num_fx)
|
||||
),
|
||||
"mute": mute_prop(),
|
||||
'mute': mute_prop(),
|
||||
},
|
||||
)
|
||||
return AUXRTN_cls(remote, index)
|
||||
|
||||
@property
|
||||
def address(self):
|
||||
return "/rtn/aux"
|
||||
return '/rtn/aux'
|
||||
|
||||
|
||||
class FxRtn(IRtn):
|
||||
@ -83,12 +83,12 @@ class FxRtn(IRtn):
|
||||
Returns an FxRtn class of a kind.
|
||||
"""
|
||||
FXRTN_cls = type(
|
||||
f"FxRtn{remote.kind}",
|
||||
f'FxRtn{remote.kind}',
|
||||
(cls,),
|
||||
{
|
||||
**{
|
||||
_cls.__name__.lower(): type(
|
||||
f"{_cls.__name__}{remote.kind}", (_cls, cls), {}
|
||||
f'{_cls.__name__}{remote.kind}', (_cls, cls), {}
|
||||
)(remote, index)
|
||||
for _cls in (
|
||||
Config,
|
||||
@ -98,15 +98,15 @@ class FxRtn(IRtn):
|
||||
Group,
|
||||
)
|
||||
},
|
||||
"send": tuple(
|
||||
'send': tuple(
|
||||
Send.make(cls, i, remote, index)
|
||||
for i in range(remote.kind.num_bus + remote.kind.num_fx)
|
||||
),
|
||||
"mute": mute_prop(),
|
||||
'mute': mute_prop(),
|
||||
},
|
||||
)
|
||||
return FXRTN_cls(remote, index)
|
||||
|
||||
@property
|
||||
def address(self):
|
||||
return f"/rtn/{self.index}"
|
||||
return f'/rtn/{self.index}'
|
||||
|
@ -12,473 +12,473 @@ class Config:
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(Config, self).address
|
||||
return f"{root}/config"
|
||||
return f'{root}/config'
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self.getter("name")[0]
|
||||
return self.getter('name')[0]
|
||||
|
||||
@name.setter
|
||||
def name(self, val: str):
|
||||
self.setter("name", val)
|
||||
self.setter('name', val)
|
||||
|
||||
@property
|
||||
def color(self) -> int:
|
||||
return self.getter("color")[0]
|
||||
return self.getter('color')[0]
|
||||
|
||||
@color.setter
|
||||
def color(self, val: int):
|
||||
self.setter("color", val)
|
||||
self.setter('color', val)
|
||||
|
||||
@property
|
||||
def inputsource(self) -> int:
|
||||
return self.getter("insrc")[0]
|
||||
return self.getter('insrc')[0]
|
||||
|
||||
@inputsource.setter
|
||||
def inputsource(self, val: int):
|
||||
self.setter("insrc", val)
|
||||
self.setter('insrc', val)
|
||||
|
||||
@property
|
||||
def usbreturn(self) -> int:
|
||||
return self.getter("rtnsrc")[0]
|
||||
return self.getter('rtnsrc')[0]
|
||||
|
||||
@usbreturn.setter
|
||||
def usbreturn(self, val: int):
|
||||
self.setter("rtnsrc", val)
|
||||
self.setter('rtnsrc', val)
|
||||
|
||||
|
||||
class Preamp:
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(Preamp, self).address
|
||||
return f"{root}/preamp"
|
||||
return f'{root}/preamp'
|
||||
|
||||
@property
|
||||
def usbtrim(self) -> float:
|
||||
return round(util.lin_get(-18, 18, self.getter("rtntrim")[0]), 1)
|
||||
return round(util.lin_get(-18, 18, self.getter('rtntrim')[0]), 1)
|
||||
|
||||
@usbtrim.setter
|
||||
def usbtrim(self, val: float):
|
||||
if not -18 <= val <= 18:
|
||||
self.logger.warning(
|
||||
f"usbtrim got {val}, expected value in range -18.0 to 18.0"
|
||||
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
|
||||
def usbinput(self) -> bool:
|
||||
return self.getter("rtnsw")[0] == 1
|
||||
return self.getter('rtnsw')[0] == 1
|
||||
|
||||
@usbinput.setter
|
||||
def usbinput(self, val: bool):
|
||||
self.setter("rtnsw", 1 if val else 0)
|
||||
self.setter('rtnsw', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def invert(self) -> bool:
|
||||
return self.getter("invert")[0] == 1
|
||||
return self.getter('invert')[0] == 1
|
||||
|
||||
@invert.setter
|
||||
def invert(self, val: bool):
|
||||
self.setter("invert", 1 if val else 0)
|
||||
self.setter('invert', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def highpasson(self) -> bool:
|
||||
return self.getter("hpon")[0] == 1
|
||||
return self.getter('hpon')[0] == 1
|
||||
|
||||
@highpasson.setter
|
||||
def highpasson(self, val: bool):
|
||||
self.setter("hpon", 1 if val else 0)
|
||||
self.setter('hpon', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def highpassfilter(self) -> int:
|
||||
return int(util.log_get(20, 400, self.getter("hpf")[0]))
|
||||
return int(util.log_get(20, 400, self.getter('hpf')[0]))
|
||||
|
||||
@highpassfilter.setter
|
||||
def highpassfilter(self, val: int):
|
||||
if not 20 <= val <= 400:
|
||||
self.logger.warning(
|
||||
f"highpassfilter got {val}, expected value in range 20 to 400"
|
||||
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))
|
||||
|
||||
|
||||
class Gate:
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(Gate, self).address
|
||||
return f"{root}/gate"
|
||||
return f'{root}/gate'
|
||||
|
||||
@property
|
||||
def on(self) -> bool:
|
||||
return self.getter("on")[0] == 1
|
||||
return self.getter('on')[0] == 1
|
||||
|
||||
@on.setter
|
||||
def on(self, val: bool):
|
||||
self.setter("on", 1 if val else 0)
|
||||
self.setter('on', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def mode(self) -> str:
|
||||
opts = ("gate", "exp2", "exp3", "exp4", "duck")
|
||||
return opts[self.getter("mode")[0]]
|
||||
opts = ('gate', 'exp2', 'exp3', 'exp4', 'duck')
|
||||
return opts[self.getter('mode')[0]]
|
||||
|
||||
@mode.setter
|
||||
def mode(self, val: str):
|
||||
opts = ("gate", "exp2", "exp3", "exp4", "duck")
|
||||
opts = ('gate', 'exp2', 'exp3', 'exp4', 'duck')
|
||||
if val not in opts:
|
||||
self.logger.warning(f"mode got {val}, expected one of {opts}")
|
||||
self.setter("mode", opts.index(val))
|
||||
self.logger.warning(f'mode got {val}, expected one of {opts}')
|
||||
self.setter('mode', opts.index(val))
|
||||
|
||||
@property
|
||||
def threshold(self) -> float:
|
||||
return round(util.lin_get(-80, 0, self.getter("thr")[0]), 1)
|
||||
return round(util.lin_get(-80, 0, self.getter('thr')[0]), 1)
|
||||
|
||||
@threshold.setter
|
||||
def threshold(self, val: float):
|
||||
if not -80 <= val <= 0:
|
||||
self.logger.warning(
|
||||
f"threshold got {val}, expected value in range -80.0 to 0.0"
|
||||
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
|
||||
def range(self) -> int:
|
||||
return int(util.lin_get(3, 60, self.getter("range")[0]))
|
||||
return int(util.lin_get(3, 60, self.getter('range')[0]))
|
||||
|
||||
@range.setter
|
||||
def range(self, val: int):
|
||||
if not 3 <= val <= 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.logger.warning(f'range got {val}, expected value in range 3 to 60')
|
||||
self.setter('range', util.lin_set(3, 60, val))
|
||||
|
||||
@property
|
||||
def attack(self) -> int:
|
||||
return int(util.lin_get(0, 120, self.getter("attack")[0]))
|
||||
return int(util.lin_get(0, 120, self.getter('attack')[0]))
|
||||
|
||||
@attack.setter
|
||||
def attack(self, val: int):
|
||||
if not 0 <= val <= 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.logger.warning(f'attack got {val}, expected value in range 0 to 120')
|
||||
self.setter('attack', util.lin_set(0, 120, val))
|
||||
|
||||
@property
|
||||
def hold(self) -> Union[float, int]:
|
||||
val = util.log_get(0.02, 2000, self.getter("hold")[0])
|
||||
val = util.log_get(0.02, 2000, self.getter('hold')[0])
|
||||
return round(val, 1) if val < 100 else int(val)
|
||||
|
||||
@hold.setter
|
||||
def hold(self, val: float):
|
||||
if not 0.02 <= val <= 2000:
|
||||
self.logger.warning(
|
||||
f"hold got {val}, expected value in range 0.02 to 2000.0"
|
||||
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
|
||||
def release(self) -> int:
|
||||
return int(util.log_get(5, 4000, self.getter("release")[0]))
|
||||
return int(util.log_get(5, 4000, self.getter('release')[0]))
|
||||
|
||||
@release.setter
|
||||
def release(self, val: int):
|
||||
if not 5 <= val <= 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.logger.warning(f'release got {val}, expected value in range 5 to 4000')
|
||||
self.setter('release', util.log_set(5, 4000, val))
|
||||
|
||||
@property
|
||||
def keysource(self):
|
||||
return self.getter("keysrc")[0]
|
||||
return self.getter('keysrc')[0]
|
||||
|
||||
@keysource.setter
|
||||
def keysource(self, val):
|
||||
self.setter("keysrc", val)
|
||||
self.setter('keysrc', val)
|
||||
|
||||
@property
|
||||
def filteron(self):
|
||||
return self.getter("filter/on")[0] == 1
|
||||
return self.getter('filter/on')[0] == 1
|
||||
|
||||
@filteron.setter
|
||||
def filteron(self, val: bool):
|
||||
self.setter("filter/on", 1 if val else 0)
|
||||
self.setter('filter/on', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def filtertype(self) -> int:
|
||||
return int(self.getter("filter/type")[0])
|
||||
return int(self.getter('filter/type')[0])
|
||||
|
||||
@filtertype.setter
|
||||
def filtertype(self, val: int):
|
||||
self.setter("filter/type", val)
|
||||
self.setter('filter/type', val)
|
||||
|
||||
@property
|
||||
def filterfreq(self) -> Union[float, int]:
|
||||
retval = util.log_get(20, 20000, self.getter("filter/f")[0])
|
||||
retval = util.log_get(20, 20000, self.getter('filter/f')[0])
|
||||
return int(retval) if retval > 1000 else round(retval, 1)
|
||||
|
||||
@filterfreq.setter
|
||||
def filterfreq(self, val: Union[float, int]):
|
||||
if not 20 <= val <= 20000:
|
||||
self.logger.warning(
|
||||
f"filterfreq got {val}, expected value in range 20 to 20000"
|
||||
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))
|
||||
|
||||
|
||||
class Dyn:
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(Dyn, self).address
|
||||
return f"{root}/dyn"
|
||||
return f'{root}/dyn'
|
||||
|
||||
@property
|
||||
def on(self) -> bool:
|
||||
return self.getter("on")[0] == 1
|
||||
return self.getter('on')[0] == 1
|
||||
|
||||
@on.setter
|
||||
def on(self, val: bool):
|
||||
self.setter("on", 1 if val else 0)
|
||||
self.setter('on', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def mode(self) -> str:
|
||||
opts = ("comp", "exp")
|
||||
return opts[self.getter("mode")[0]]
|
||||
opts = ('comp', 'exp')
|
||||
return opts[self.getter('mode')[0]]
|
||||
|
||||
@mode.setter
|
||||
def mode(self, val: str):
|
||||
opts = ("comp", "exp")
|
||||
opts = ('comp', 'exp')
|
||||
if val not in opts:
|
||||
self.logger.warning(f"mode got {val}, expected one of {opts}")
|
||||
self.setter("mode", opts.index(val))
|
||||
self.logger.warning(f'mode got {val}, expected one of {opts}')
|
||||
self.setter('mode', opts.index(val))
|
||||
|
||||
@property
|
||||
def det(self) -> str:
|
||||
opts = ("peak", "rms")
|
||||
return opts[self.getter("det")[0]]
|
||||
opts = ('peak', 'rms')
|
||||
return opts[self.getter('det')[0]]
|
||||
|
||||
@det.setter
|
||||
def det(self, val: str):
|
||||
opts = ("peak", "rms")
|
||||
opts = ('peak', 'rms')
|
||||
if val not in opts:
|
||||
self.logger.warning(f"det got {val}, expected one of {opts}")
|
||||
self.setter("det", opts.index(val))
|
||||
self.logger.warning(f'det got {val}, expected one of {opts}')
|
||||
self.setter('det', opts.index(val))
|
||||
|
||||
@property
|
||||
def env(self) -> str:
|
||||
opts = ("lin", "log")
|
||||
return opts[self.getter("env")[0]]
|
||||
opts = ('lin', 'log')
|
||||
return opts[self.getter('env')[0]]
|
||||
|
||||
@env.setter
|
||||
def env(self, val: str):
|
||||
opts = ("lin", "log")
|
||||
opts = ('lin', 'log')
|
||||
if val not in opts:
|
||||
self.logger.warning(f"env got {val}, expected one of {opts}")
|
||||
self.setter("env", opts.index(val))
|
||||
self.logger.warning(f'env got {val}, expected one of {opts}')
|
||||
self.setter('env', opts.index(val))
|
||||
|
||||
@property
|
||||
def threshold(self) -> float:
|
||||
return round(util.lin_get(-60, 0, self.getter("thr")[0]), 1)
|
||||
return round(util.lin_get(-60, 0, self.getter('thr')[0]), 1)
|
||||
|
||||
@threshold.setter
|
||||
def threshold(self, val: float):
|
||||
if not -60 <= val <= 0:
|
||||
self.logger.warning(
|
||||
f"threshold got {val}, expected value in range -60.0 to 0"
|
||||
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
|
||||
def ratio(self) -> Union[float, int]:
|
||||
opts = (1.1, 1.3, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 7.0, 10, 20, 100)
|
||||
return opts[self.getter("ratio")[0]]
|
||||
return opts[self.getter('ratio')[0]]
|
||||
|
||||
@ratio.setter
|
||||
def ratio(self, val: int):
|
||||
self.setter("ratio", val)
|
||||
self.setter('ratio', val)
|
||||
|
||||
@property
|
||||
def knee(self) -> int:
|
||||
return int(util.lin_get(0, 5, self.getter("knee")[0]))
|
||||
return int(util.lin_get(0, 5, self.getter('knee')[0]))
|
||||
|
||||
@knee.setter
|
||||
def knee(self, val: int):
|
||||
if not 0 <= val <= 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.logger.warning(f'knee got {val}, expected value in range 0 to 5')
|
||||
self.setter('knee', util.lin_set(0, 5, val))
|
||||
|
||||
@property
|
||||
def mgain(self) -> float:
|
||||
return round(util.lin_get(0, 24, self.getter("mgain")[0]), 1)
|
||||
return round(util.lin_get(0, 24, self.getter('mgain')[0]), 1)
|
||||
|
||||
@mgain.setter
|
||||
def mgain(self, val: float):
|
||||
if not 0 <= val <= 24:
|
||||
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.logger.warning(f'mgain got {val}, expected value in range 0.0 to 24.0')
|
||||
self.setter('mgain', util.lin_set(0, 24, val))
|
||||
|
||||
@property
|
||||
def attack(self) -> int:
|
||||
return int(util.lin_get(0, 120, self.getter("attack")[0]))
|
||||
return int(util.lin_get(0, 120, self.getter('attack')[0]))
|
||||
|
||||
@attack.setter
|
||||
def attack(self, val: int):
|
||||
if not 0 <= val <= 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.logger.warning(f'attack got {val}, expected value in range 0 to 120')
|
||||
self.setter('attack', util.lin_set(0, 120, val))
|
||||
|
||||
@property
|
||||
def hold(self) -> Union[float, int]:
|
||||
val = util.log_get(0.02, 2000, self.getter("hold")[0])
|
||||
val = util.log_get(0.02, 2000, self.getter('hold')[0])
|
||||
return round(val, 1) if val < 100 else int(val)
|
||||
|
||||
@hold.setter
|
||||
def hold(self, val: float):
|
||||
if not 0.02 <= val <= 2000:
|
||||
self.logger.warning(
|
||||
f"hold got {val}, expected value in range 0.02 to 2000.0"
|
||||
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
|
||||
def release(self) -> int:
|
||||
return int(util.log_get(5, 4000, self.getter("release")[0]))
|
||||
return int(util.log_get(5, 4000, self.getter('release')[0]))
|
||||
|
||||
@release.setter
|
||||
def release(self, val: int):
|
||||
if not 5 <= val <= 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.logger.warning(f'release got {val}, expected value in range 5 to 4000')
|
||||
self.setter('release', util.log_set(5, 4000, val))
|
||||
|
||||
@property
|
||||
def mix(self) -> int:
|
||||
return int(util.lin_get(0, 100, self.getter("mix")[0]))
|
||||
return int(util.lin_get(0, 100, self.getter('mix')[0]))
|
||||
|
||||
@mix.setter
|
||||
def mix(self, val: int):
|
||||
if not 0 <= val <= 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.logger.warning(f'mix got {val}, expected value in range 0 to 100')
|
||||
self.setter('mix', util.lin_set(0, 100, val))
|
||||
|
||||
@property
|
||||
def keysource(self):
|
||||
return self.getter("keysrc")[0]
|
||||
return self.getter('keysrc')[0]
|
||||
|
||||
@keysource.setter
|
||||
def keysource(self, val):
|
||||
self.setter("keysrc", val)
|
||||
self.setter('keysrc', val)
|
||||
|
||||
@property
|
||||
def auto(self) -> bool:
|
||||
return self.getter("auto")[0] == 1
|
||||
return self.getter('auto')[0] == 1
|
||||
|
||||
@auto.setter
|
||||
def auto(self, val: bool):
|
||||
self.setter("auto", 1 if val else 0)
|
||||
self.setter('auto', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def filteron(self):
|
||||
return self.getter("filter/on")[0] == 1
|
||||
return self.getter('filter/on')[0] == 1
|
||||
|
||||
@filteron.setter
|
||||
def filteron(self, val: bool):
|
||||
self.setter("filter/on", 1 if val else 0)
|
||||
self.setter('filter/on', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def filtertype(self) -> int:
|
||||
return int(self.getter("filter/type")[0])
|
||||
return int(self.getter('filter/type')[0])
|
||||
|
||||
@filtertype.setter
|
||||
def filtertype(self, val: int):
|
||||
self.setter("filter/type", val)
|
||||
self.setter('filter/type', val)
|
||||
|
||||
@property
|
||||
def filterfreq(self) -> Union[float, int]:
|
||||
retval = util.log_get(20, 20000, self.getter("filter/f")[0])
|
||||
retval = util.log_get(20, 20000, self.getter('filter/f')[0])
|
||||
return int(retval) if retval > 1000 else round(retval, 1)
|
||||
|
||||
@filterfreq.setter
|
||||
def filterfreq(self, val: Union[float, int]):
|
||||
if not 20 <= val <= 20000:
|
||||
self.logger.warning(
|
||||
f"filterfreq got {val}, expected value in range 20 to 20000"
|
||||
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))
|
||||
|
||||
|
||||
class Insert:
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(Insert, self).address
|
||||
return f"{root}/insert"
|
||||
return f'{root}/insert'
|
||||
|
||||
@property
|
||||
def on(self) -> bool:
|
||||
return self.getter("on")[0] == 1
|
||||
return self.getter('on')[0] == 1
|
||||
|
||||
@on.setter
|
||||
def on(self, val: bool):
|
||||
self.setter("on", 1 if val else 0)
|
||||
self.setter('on', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def sel(self) -> int:
|
||||
return self.getter("sel")[0]
|
||||
return self.getter('sel')[0]
|
||||
|
||||
@sel.setter
|
||||
def sel(self, val: int):
|
||||
self.setter("sel", val)
|
||||
self.setter('sel', val)
|
||||
|
||||
|
||||
class EQ:
|
||||
@classmethod
|
||||
def make_fourband(cls, _cls, remote, index=None):
|
||||
EQBand_cls = type("EQBand", (EQ.EQBand, _cls), {})
|
||||
EQBand_cls = type('EQBand', (EQ.EQBand, _cls), {})
|
||||
return type(
|
||||
"EQ",
|
||||
'EQ',
|
||||
(cls,),
|
||||
{
|
||||
"low": EQBand_cls(1, remote, index),
|
||||
"lomid": EQBand_cls(2, remote, index),
|
||||
"himid": EQBand_cls(3, remote, index),
|
||||
"high": EQBand_cls(4, remote, index),
|
||||
'low': EQBand_cls(1, remote, index),
|
||||
'lomid': EQBand_cls(2, remote, index),
|
||||
'himid': EQBand_cls(3, remote, index),
|
||||
'high': EQBand_cls(4, remote, index),
|
||||
},
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def make_sixband(cls, _cls, remote, index=None):
|
||||
EQBand_cls = type("EQBand", (EQ.EQBand, _cls), {})
|
||||
EQBand_cls = type('EQBand', (EQ.EQBand, _cls), {})
|
||||
return type(
|
||||
"EQ",
|
||||
'EQ',
|
||||
(cls,),
|
||||
{
|
||||
"low": EQBand_cls(1, remote, index),
|
||||
"low2": EQBand_cls(2, remote, index),
|
||||
"lomid": EQBand_cls(3, remote, index),
|
||||
"himid": EQBand_cls(4, remote, index),
|
||||
"high2": EQBand_cls(5, remote, index),
|
||||
"high": EQBand_cls(6, remote, index),
|
||||
'low': EQBand_cls(1, remote, index),
|
||||
'low2': EQBand_cls(2, remote, index),
|
||||
'lomid': EQBand_cls(3, remote, index),
|
||||
'himid': EQBand_cls(4, remote, index),
|
||||
'high2': EQBand_cls(5, remote, index),
|
||||
'high': EQBand_cls(6, remote, index),
|
||||
},
|
||||
)
|
||||
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(EQ, self).address
|
||||
return f"{root}/eq"
|
||||
return f'{root}/eq'
|
||||
|
||||
@property
|
||||
def on(self) -> bool:
|
||||
return self.getter("on")[0] == 1
|
||||
return self.getter('on')[0] == 1
|
||||
|
||||
@on.setter
|
||||
def on(self, val: bool):
|
||||
self.setter("on", 1 if val else 0)
|
||||
self.setter('on', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def mode(self) -> str:
|
||||
opts = ("peq", "geq", "teq")
|
||||
return opts[self.getter("mode")[0]]
|
||||
opts = ('peq', 'geq', 'teq')
|
||||
return opts[self.getter('mode')[0]]
|
||||
|
||||
@mode.setter
|
||||
def mode(self, val: str):
|
||||
opts = ("peq", "geq", "teq")
|
||||
opts = ('peq', 'geq', 'teq')
|
||||
if val not in opts:
|
||||
self.logger.warning(f"mode got {val}, expected one of {opts}")
|
||||
self.setter("mode", opts.index(val))
|
||||
self.logger.warning(f'mode got {val}, expected one of {opts}')
|
||||
self.setter('mode', opts.index(val))
|
||||
|
||||
class EQBand:
|
||||
def __init__(self, i, remote, index):
|
||||
@ -488,53 +488,53 @@ class EQ:
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(EQ.EQBand, self).address
|
||||
return f"{root}/eq/{self.i}"
|
||||
return f'{root}/eq/{self.i}'
|
||||
|
||||
@property
|
||||
def type(self) -> int:
|
||||
return int(self.getter("type")[0])
|
||||
return int(self.getter('type')[0])
|
||||
|
||||
@type.setter
|
||||
def type(self, val: int):
|
||||
self.setter("type", val)
|
||||
self.setter('type', val)
|
||||
|
||||
@property
|
||||
def frequency(self) -> float:
|
||||
retval = util.log_get(20, 20000, self.getter("f")[0])
|
||||
retval = util.log_get(20, 20000, self.getter('f')[0])
|
||||
return round(retval, 1)
|
||||
|
||||
@frequency.setter
|
||||
def frequency(self, val: float):
|
||||
if not 20 <= val <= 20000:
|
||||
self.logger.warning(
|
||||
f"frequency got {val}, expected value in range 20.0 to 20000.0"
|
||||
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
|
||||
def gain(self) -> float:
|
||||
return round(util.lin_get(-15, 15, self.getter("g")[0]), 1)
|
||||
return round(util.lin_get(-15, 15, self.getter('g')[0]), 1)
|
||||
|
||||
@gain.setter
|
||||
def gain(self, val: float):
|
||||
if not -15 <= val <= 15:
|
||||
self.logger.warning(
|
||||
f"gain got {val}, expected value in range -15.0 to 15.0"
|
||||
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
|
||||
def quality(self) -> float:
|
||||
retval = util.log_get(0.3, 10, self.getter("q")[0])
|
||||
retval = util.log_get(0.3, 10, self.getter('q')[0])
|
||||
return round(retval, 1)
|
||||
|
||||
@quality.setter
|
||||
def quality(self, val: float):
|
||||
if not 0.3 <= val <= 10:
|
||||
self.logger.warning(
|
||||
f"quality got {val}, expected value in range 0.3 to 10.0"
|
||||
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))
|
||||
|
||||
|
||||
class GEQ:
|
||||
@ -561,90 +561,90 @@ class GEQ:
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(GEQ, self).address
|
||||
return f"{root}/geq"
|
||||
return f'{root}/geq'
|
||||
|
||||
|
||||
class Mix:
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(Mix, self).address
|
||||
return f"{root}/mix"
|
||||
return f'{root}/mix'
|
||||
|
||||
@property
|
||||
def on(self) -> bool:
|
||||
return self.getter("on")[0] == 1
|
||||
return self.getter('on')[0] == 1
|
||||
|
||||
@on.setter
|
||||
def on(self, val: bool):
|
||||
self.setter("on", 1 if val else 0)
|
||||
self.setter('on', 1 if val else 0)
|
||||
|
||||
@property
|
||||
@util.db_from
|
||||
def fader(self) -> float:
|
||||
return self.getter("fader")[0]
|
||||
return self.getter('fader')[0]
|
||||
|
||||
@fader.setter
|
||||
@util.db_to
|
||||
def fader(self, val: float):
|
||||
self.setter("fader", val)
|
||||
self.setter('fader', val)
|
||||
|
||||
@property
|
||||
def lr(self) -> bool:
|
||||
return self.getter("lr")[0] == 1
|
||||
return self.getter('lr')[0] == 1
|
||||
|
||||
@lr.setter
|
||||
def lr(self, val: bool):
|
||||
self.setter("lr", 1 if val else 0)
|
||||
self.setter('lr', 1 if val else 0)
|
||||
|
||||
|
||||
class Group:
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(Group, self).address
|
||||
return f"{root}/grp"
|
||||
return f'{root}/grp'
|
||||
|
||||
@property
|
||||
def dca(self) -> int:
|
||||
return self.getter("dca")[0]
|
||||
return self.getter('dca')[0]
|
||||
|
||||
@dca.setter
|
||||
def dca(self, val: int):
|
||||
self.setter("dca", val)
|
||||
self.setter('dca', val)
|
||||
|
||||
@property
|
||||
def mute(self) -> int:
|
||||
return self.getter("mute")[0]
|
||||
return self.getter('mute')[0]
|
||||
|
||||
@mute.setter
|
||||
def mute(self, val: int):
|
||||
self.setter("mute", val)
|
||||
self.setter('mute', val)
|
||||
|
||||
|
||||
class Automix:
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(Automix, self).address
|
||||
return f"{root}/automix"
|
||||
return f'{root}/automix'
|
||||
|
||||
@property
|
||||
def group(self) -> int:
|
||||
return self.getter("group")[0]
|
||||
return self.getter('group')[0]
|
||||
|
||||
@group.setter
|
||||
def group(self, val: int):
|
||||
self.setter("group", val)
|
||||
self.setter('group', val)
|
||||
|
||||
@property
|
||||
def weight(self) -> float:
|
||||
return round(util.lin_get(-12, 12, self.getter("weight")[0]), 1)
|
||||
return round(util.lin_get(-12, 12, self.getter('weight')[0]), 1)
|
||||
|
||||
@weight.setter
|
||||
def weight(self, val: float):
|
||||
if not -12 <= val <= 12:
|
||||
self.logger.warning(
|
||||
f"weight got {val}, expected value in range -12.0 to 12.0"
|
||||
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))
|
||||
|
||||
|
||||
class Send:
|
||||
@ -654,20 +654,20 @@ class Send:
|
||||
|
||||
@classmethod
|
||||
def make(cls, _cls, i, remote, index=None):
|
||||
SEND_cls = type("Send", (cls, _cls), {})
|
||||
SEND_cls = type('Send', (cls, _cls), {})
|
||||
return SEND_cls(i, remote, index)
|
||||
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(Send, self).address
|
||||
return f"{root}/mix/{str(self.i).zfill(2)}"
|
||||
return f'{root}/mix/{str(self.i).zfill(2)}'
|
||||
|
||||
@property
|
||||
@util.db_from
|
||||
def level(self) -> float:
|
||||
return self.getter("level")[0]
|
||||
return self.getter('level')[0]
|
||||
|
||||
@level.setter
|
||||
@util.db_to
|
||||
def level(self, val: float):
|
||||
self.setter("level", val)
|
||||
self.setter('level', val)
|
||||
|
@ -16,10 +16,10 @@ class IStrip(abc.ABC):
|
||||
self.logger = logger.getChild(self.__class__.__name__)
|
||||
|
||||
def getter(self, param: str) -> tuple:
|
||||
return self._remote.query(f"{self.address}/{param}")
|
||||
return self._remote.query(f'{self.address}/{param}')
|
||||
|
||||
def setter(self, param: str, val: int):
|
||||
self._remote.send(f"{self.address}/{param}", val)
|
||||
self._remote.send(f'{self.address}/{param}', val)
|
||||
|
||||
@abc.abstractmethod
|
||||
def address(self):
|
||||
@ -40,12 +40,12 @@ class Strip(IStrip):
|
||||
"""
|
||||
|
||||
STRIP_cls = type(
|
||||
f"Strip{remote.kind}",
|
||||
f'Strip{remote.kind}',
|
||||
(cls,),
|
||||
{
|
||||
**{
|
||||
_cls.__name__.lower(): type(
|
||||
f"{_cls.__name__}{remote.kind}", (_cls, cls), {}
|
||||
f'{_cls.__name__}{remote.kind}', (_cls, cls), {}
|
||||
)(remote, index)
|
||||
for _cls in (
|
||||
Config,
|
||||
@ -59,15 +59,15 @@ class Strip(IStrip):
|
||||
Automix,
|
||||
)
|
||||
},
|
||||
"send": tuple(
|
||||
'send': tuple(
|
||||
Send.make(cls, i, remote, index)
|
||||
for i in range(remote.kind.num_bus + remote.kind.num_fx)
|
||||
),
|
||||
"mute": mute_prop(),
|
||||
'mute': mute_prop(),
|
||||
},
|
||||
)
|
||||
return STRIP_cls(remote, index)
|
||||
|
||||
@property
|
||||
def address(self) -> str:
|
||||
return f"/ch/{str(self.index).zfill(2)}"
|
||||
return f'/ch/{str(self.index).zfill(2)}'
|
||||
|
@ -19,7 +19,7 @@ def timeout(func):
|
||||
while time.time() < start + remote.connect_timeout:
|
||||
try:
|
||||
func(*args, **kwargs)
|
||||
remote.logger.debug(f"login time: {round(time.time() - start, 2)}")
|
||||
remote.logger.debug(f'login time: {round(time.time() - start, 2)}')
|
||||
err = None
|
||||
break
|
||||
except XAirRemoteConnectionTimeoutError as e:
|
||||
|
@ -31,7 +31,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class OSCClientServer(BlockingOSCUDPServer):
|
||||
def __init__(self, address: str, dispatcher: Dispatcher):
|
||||
super().__init__(("", 0), dispatcher)
|
||||
super().__init__(('', 0), dispatcher)
|
||||
self.xr_address = address
|
||||
|
||||
def send_message(self, address: str, vals: Optional[Union[str, list]]):
|
||||
@ -53,13 +53,13 @@ class XAirRemote(abc.ABC):
|
||||
def __init__(self, **kwargs):
|
||||
dispatcher = Dispatcher()
|
||||
dispatcher.set_default_handler(self.msg_handler)
|
||||
self.xair_ip = kwargs["ip"] or self._ip_from_toml()
|
||||
self.xair_port = kwargs["port"]
|
||||
self._delay = kwargs["delay"]
|
||||
self.connect_timeout = kwargs["connect_timeout"]
|
||||
self.xair_ip = kwargs['ip'] or self._ip_from_toml()
|
||||
self.xair_port = kwargs['port']
|
||||
self._delay = kwargs['delay']
|
||||
self.connect_timeout = kwargs['connect_timeout']
|
||||
self.logger = logger.getChild(self.__class__.__name__)
|
||||
if not self.xair_ip:
|
||||
raise XAirRemoteError("No valid ip detected")
|
||||
raise XAirRemoteError('No valid ip detected')
|
||||
self.server = OSCClientServer((self.xair_ip, self.xair_port), dispatcher)
|
||||
|
||||
def __enter__(self):
|
||||
@ -69,17 +69,17 @@ class XAirRemote(abc.ABC):
|
||||
return self
|
||||
|
||||
def _ip_from_toml(self) -> str:
|
||||
filepath = Path.cwd() / "config.toml"
|
||||
with open(filepath, "rb") as f:
|
||||
filepath = Path.cwd() / 'config.toml'
|
||||
with open(filepath, 'rb') as f:
|
||||
conn = tomllib.load(f)
|
||||
return conn["connection"].get("ip")
|
||||
return conn['connection'].get('ip')
|
||||
|
||||
@util.timeout
|
||||
def validate_connection(self):
|
||||
if not self.query("/xinfo"):
|
||||
if not self.query('/xinfo'):
|
||||
raise XAirRemoteConnectionTimeoutError(self.xair_ip, self.xair_port)
|
||||
self.logger.info(
|
||||
f"Successfully connected to {self.info_response[2]} at {self.info_response[0]}."
|
||||
f'Successfully connected to {self.info_response[2]} at {self.info_response[0]}.'
|
||||
)
|
||||
|
||||
@property
|
||||
@ -115,10 +115,10 @@ def _make_remote(kind: KindMap) -> XAirRemote:
|
||||
|
||||
def init_x32(self, *args, **kwargs):
|
||||
defaultkwargs = {
|
||||
"ip": None,
|
||||
"port": 10023,
|
||||
"delay": 0.02,
|
||||
"connect_timeout": 2,
|
||||
'ip': None,
|
||||
'port': 10023,
|
||||
'delay': 0.02,
|
||||
'connect_timeout': 2,
|
||||
}
|
||||
kwargs = defaultkwargs | kwargs
|
||||
XAirRemote.__init__(self, *args, **kwargs)
|
||||
@ -139,10 +139,10 @@ def _make_remote(kind: KindMap) -> XAirRemote:
|
||||
|
||||
def init_xair(self, *args, **kwargs):
|
||||
defaultkwargs = {
|
||||
"ip": None,
|
||||
"port": 10024,
|
||||
"delay": 0.02,
|
||||
"connect_timeout": 2,
|
||||
'ip': None,
|
||||
'port': 10024,
|
||||
'delay': 0.02,
|
||||
'connect_timeout': 2,
|
||||
}
|
||||
kwargs = defaultkwargs | kwargs
|
||||
XAirRemote.__init__(self, *args, **kwargs)
|
||||
@ -158,19 +158,19 @@ def _make_remote(kind: KindMap) -> XAirRemote:
|
||||
self.config = Config.make(self)
|
||||
self.headamp = tuple(HeadAmp(self, i) for i in range(kind.num_strip))
|
||||
|
||||
if kind.id_ == "X32":
|
||||
if kind.id_ == 'X32':
|
||||
return type(
|
||||
f"XAirRemote{kind}",
|
||||
f'XAirRemote{kind}',
|
||||
(XAirRemote,),
|
||||
{
|
||||
"__init__": init_x32,
|
||||
'__init__': init_x32,
|
||||
},
|
||||
)
|
||||
return type(
|
||||
f"XAirRemote{kind}",
|
||||
f'XAirRemote{kind}',
|
||||
(XAirRemote,),
|
||||
{
|
||||
"__init__": init_xair,
|
||||
'__init__': init_xair,
|
||||
},
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user