xair-api 2.4.1__py3-none-any.whl → 2.4.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
xair_api/meta.py CHANGED
@@ -1,75 +1,75 @@
1
- from .util import lin_get, lin_set
2
-
3
-
4
- def bool_prop(param):
5
- """A boolean property object."""
6
-
7
- def fget(self):
8
- return self.getter(param)[0] == 1
9
-
10
- def fset(self, val):
11
- self.setter(param, 1 if val else 0)
12
-
13
- return property(fget, fset)
14
-
15
-
16
- def string_prop(param):
17
- """A string property object"""
18
-
19
- def fget(self):
20
- return self.getter(param)[0]
21
-
22
- def fset(self, val):
23
- self.setter(param, val)
24
-
25
- return property(fget, fset)
26
-
27
-
28
- def int_prop(param):
29
- """An integer property object"""
30
-
31
- def fget(self):
32
- return int(self.getter(param)[0])
33
-
34
- def fset(self, val):
35
- self.setter(param, val)
36
-
37
- return property(fget, fset)
38
-
39
-
40
- def float_prop(param):
41
- """A float property object"""
42
-
43
- def fget(self):
44
- return round(self.getter(param)[0], 1)
45
-
46
- def fset(self, val):
47
- self.setter(param, val)
48
-
49
- return property(fget, fset)
50
-
51
-
52
- def geq_prop(param):
53
- param = param.replace('_', '.')
54
-
55
- def fget(self) -> float:
56
- return round(lin_get(-15, 15, self.getter(param)[0]), 1)
57
-
58
- def fset(self, val):
59
- if not -15 <= val <= 15:
60
- self.logger.warning(
61
- f'slider_{param} got {val}, expected value in range -15.0 to 15.0'
62
- )
63
- self.setter(param, lin_set(-15, 15, val))
64
-
65
- return property(fget, fset)
66
-
67
-
68
- def mute_prop():
69
- def fget(self):
70
- return not self.mix.on
71
-
72
- def fset(self, val):
73
- self.mix.on = not val
74
-
75
- return property(fget, fset)
1
+ from .util import lin_get, lin_set
2
+
3
+
4
+ def bool_prop(param):
5
+ """A boolean property object."""
6
+
7
+ def fget(self):
8
+ return self.getter(param)[0] == 1
9
+
10
+ def fset(self, val):
11
+ self.setter(param, 1 if val else 0)
12
+
13
+ return property(fget, fset)
14
+
15
+
16
+ def string_prop(param):
17
+ """A string property object"""
18
+
19
+ def fget(self):
20
+ return self.getter(param)[0]
21
+
22
+ def fset(self, val):
23
+ self.setter(param, val)
24
+
25
+ return property(fget, fset)
26
+
27
+
28
+ def int_prop(param):
29
+ """An integer property object"""
30
+
31
+ def fget(self):
32
+ return int(self.getter(param)[0])
33
+
34
+ def fset(self, val):
35
+ self.setter(param, val)
36
+
37
+ return property(fget, fset)
38
+
39
+
40
+ def float_prop(param):
41
+ """A float property object"""
42
+
43
+ def fget(self):
44
+ return round(self.getter(param)[0], 1)
45
+
46
+ def fset(self, val):
47
+ self.setter(param, val)
48
+
49
+ return property(fget, fset)
50
+
51
+
52
+ def geq_prop(param):
53
+ param = param.replace('_', '.')
54
+
55
+ def fget(self) -> float:
56
+ return round(lin_get(-15, 15, self.getter(param)[0]), 1)
57
+
58
+ def fset(self, val):
59
+ if not -15 <= val <= 15:
60
+ self.logger.warning(
61
+ f'slider_{param} got {val}, expected value in range -15.0 to 15.0'
62
+ )
63
+ self.setter(param, lin_set(-15, 15, val))
64
+
65
+ return property(fget, fset)
66
+
67
+
68
+ def mute_prop():
69
+ def fget(self):
70
+ return not self.mix.on
71
+
72
+ def fset(self, val):
73
+ self.mix.on = not val
74
+
75
+ return property(fget, fset)
xair_api/rtn.py CHANGED
@@ -1,112 +1,112 @@
1
- import abc
2
- import logging
3
- from typing import Optional
4
-
5
- from .meta import mute_prop
6
- from .shared import EQ, Config, Group, Mix, Preamp, Send
7
-
8
- logger = logging.getLogger(__name__)
9
-
10
-
11
- class IRtn(abc.ABC):
12
- """Abstract Base Class for rtn"""
13
-
14
- def __init__(self, remote, index: Optional[int] = None):
15
- self._remote = remote
16
- if index is not None:
17
- self.index = index + 1
18
- self.logger = logger.getChild(self.__class__.__name__)
19
-
20
- def getter(self, param: str):
21
- return self._remote.query(f'{self.address}/{param}')
22
-
23
- def setter(self, param: str, val: int):
24
- self._remote.send(f'{self.address}/{param}', val)
25
-
26
- @abc.abstractmethod
27
- def address(self):
28
- pass
29
-
30
-
31
- class AuxRtn(IRtn):
32
- """Concrete class for auxrtn"""
33
-
34
- @classmethod
35
- def make(cls, remote, index=None):
36
- """
37
- Factory function for auxrtn
38
-
39
- Creates a mixin of shared subclasses, sets them as class attributes.
40
-
41
- Returns an AuxRtn class of a kind.
42
- """
43
- AUXRTN_cls = type(
44
- f'AuxRtn{remote.kind}',
45
- (cls,),
46
- {
47
- **{
48
- _cls.__name__.lower(): type(
49
- f'{_cls.__name__}{remote.kind}', (_cls, cls), {}
50
- )(remote, index)
51
- for _cls in (
52
- Config,
53
- Preamp,
54
- EQ.make_fourband(cls, remote),
55
- Mix,
56
- Group,
57
- )
58
- },
59
- 'send': tuple(
60
- Send.make(cls, i, remote)
61
- for i in range(remote.kind.num_bus + remote.kind.num_fx)
62
- ),
63
- 'mute': mute_prop(),
64
- },
65
- )
66
- return AUXRTN_cls(remote, index)
67
-
68
- @property
69
- def address(self):
70
- return '/rtn/aux'
71
-
72
-
73
- class FxRtn(IRtn):
74
- """Concrete class for fxrtn"""
75
-
76
- @classmethod
77
- def make(cls, remote, index):
78
- """
79
- Factory function for fxrtn
80
-
81
- Creates a mixin of shared subclasses, sets them as class attributes.
82
-
83
- Returns an FxRtn class of a kind.
84
- """
85
- FXRTN_cls = type(
86
- f'FxRtn{remote.kind}',
87
- (cls,),
88
- {
89
- **{
90
- _cls.__name__.lower(): type(
91
- f'{_cls.__name__}{remote.kind}', (_cls, cls), {}
92
- )(remote, index)
93
- for _cls in (
94
- Config,
95
- Preamp,
96
- EQ.make_fourband(cls, remote, index),
97
- Mix,
98
- Group,
99
- )
100
- },
101
- 'send': tuple(
102
- Send.make(cls, i, remote, index)
103
- for i in range(remote.kind.num_bus + remote.kind.num_fx)
104
- ),
105
- 'mute': mute_prop(),
106
- },
107
- )
108
- return FXRTN_cls(remote, index)
109
-
110
- @property
111
- def address(self):
112
- return f'/rtn/{self.index}'
1
+ import abc
2
+ import logging
3
+ from typing import Optional
4
+
5
+ from .meta import mute_prop
6
+ from .shared import EQ, Config, Group, Mix, Preamp, Send
7
+
8
+ logger = logging.getLogger(__name__)
9
+
10
+
11
+ class IRtn(abc.ABC):
12
+ """Abstract Base Class for rtn"""
13
+
14
+ def __init__(self, remote, index: Optional[int] = None):
15
+ self._remote = remote
16
+ if index is not None:
17
+ self.index = index + 1
18
+ self.logger = logger.getChild(self.__class__.__name__)
19
+
20
+ def getter(self, param: str):
21
+ return self._remote.query(f'{self.address}/{param}')
22
+
23
+ def setter(self, param: str, val: int):
24
+ self._remote.send(f'{self.address}/{param}', val)
25
+
26
+ @abc.abstractmethod
27
+ def address(self):
28
+ pass
29
+
30
+
31
+ class AuxRtn(IRtn):
32
+ """Concrete class for auxrtn"""
33
+
34
+ @classmethod
35
+ def make(cls, remote, index=None):
36
+ """
37
+ Factory function for auxrtn
38
+
39
+ Creates a mixin of shared subclasses, sets them as class attributes.
40
+
41
+ Returns an AuxRtn class of a kind.
42
+ """
43
+ AUXRTN_cls = type(
44
+ f'AuxRtn{remote.kind}',
45
+ (cls,),
46
+ {
47
+ **{
48
+ _cls.__name__.lower(): type(
49
+ f'{_cls.__name__}{remote.kind}', (_cls, cls), {}
50
+ )(remote, index)
51
+ for _cls in (
52
+ Config,
53
+ Preamp,
54
+ EQ.make_fourband(cls, remote),
55
+ Mix,
56
+ Group,
57
+ )
58
+ },
59
+ 'send': tuple(
60
+ Send.make(cls, i, remote)
61
+ for i in range(remote.kind.num_bus + remote.kind.num_fx)
62
+ ),
63
+ 'mute': mute_prop(),
64
+ },
65
+ )
66
+ return AUXRTN_cls(remote, index)
67
+
68
+ @property
69
+ def address(self):
70
+ return '/rtn/aux'
71
+
72
+
73
+ class FxRtn(IRtn):
74
+ """Concrete class for fxrtn"""
75
+
76
+ @classmethod
77
+ def make(cls, remote, index):
78
+ """
79
+ Factory function for fxrtn
80
+
81
+ Creates a mixin of shared subclasses, sets them as class attributes.
82
+
83
+ Returns an FxRtn class of a kind.
84
+ """
85
+ FXRTN_cls = type(
86
+ f'FxRtn{remote.kind}',
87
+ (cls,),
88
+ {
89
+ **{
90
+ _cls.__name__.lower(): type(
91
+ f'{_cls.__name__}{remote.kind}', (_cls, cls), {}
92
+ )(remote, index)
93
+ for _cls in (
94
+ Config,
95
+ Preamp,
96
+ EQ.make_fourband(cls, remote, index),
97
+ Mix,
98
+ Group,
99
+ )
100
+ },
101
+ 'send': tuple(
102
+ Send.make(cls, i, remote, index)
103
+ for i in range(remote.kind.num_bus + remote.kind.num_fx)
104
+ ),
105
+ 'mute': mute_prop(),
106
+ },
107
+ )
108
+ return FXRTN_cls(remote, index)
109
+
110
+ @property
111
+ def address(self):
112
+ return f'/rtn/{self.index}'