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/dca.py CHANGED
@@ -1,63 +1,63 @@
1
- import abc
2
- import logging
3
-
4
- logger = logging.getLogger(__name__)
5
-
6
-
7
- class IDCA(abc.ABC):
8
- """Abstract Base Class for DCA groups"""
9
-
10
- def __init__(self, remote, index: int):
11
- self._remote = remote
12
- self.index = index + 1
13
- self.logger = logger.getChild(self.__class__.__name__)
14
-
15
- def getter(self, param: str) -> tuple:
16
- return self._remote.query(f'{self.address}/{param}')
17
-
18
- def setter(self, param: str, val: int):
19
- self._remote.send(f'{self.address}/{param}', val)
20
-
21
- @abc.abstractmethod
22
- def address(self):
23
- pass
24
-
25
-
26
- class DCA(IDCA):
27
- """Concrete class for DCA groups"""
28
-
29
- @property
30
- def address(self) -> str:
31
- return f'/dca/{self.index}'
32
-
33
- @property
34
- def on(self) -> bool:
35
- return self.getter('on')[0] == 1
36
-
37
- @on.setter
38
- def on(self, val: bool):
39
- self.setter('on', 1 if val else 0)
40
-
41
- @property
42
- def mute(self) -> bool:
43
- return not self.on
44
-
45
- @mute.setter
46
- def mute(self, val: bool):
47
- self.on = not val
48
-
49
- @property
50
- def name(self) -> str:
51
- return self.getter('config/name')[0]
52
-
53
- @name.setter
54
- def name(self, val: str):
55
- self.setter('config/name', val)
56
-
57
- @property
58
- def color(self) -> int:
59
- return self.getter('config/color')[0]
60
-
61
- @color.setter
62
- def color(self, val: int):
63
- self.setter('config/color', val)
1
+ import abc
2
+ import logging
3
+
4
+ logger = logging.getLogger(__name__)
5
+
6
+
7
+ class IDCA(abc.ABC):
8
+ """Abstract Base Class for DCA groups"""
9
+
10
+ def __init__(self, remote, index: int):
11
+ self._remote = remote
12
+ self.index = index + 1
13
+ self.logger = logger.getChild(self.__class__.__name__)
14
+
15
+ def getter(self, param: str) -> tuple:
16
+ return self._remote.query(f'{self.address}/{param}')
17
+
18
+ def setter(self, param: str, val: int):
19
+ self._remote.send(f'{self.address}/{param}', val)
20
+
21
+ @abc.abstractmethod
22
+ def address(self):
23
+ pass
24
+
25
+
26
+ class DCA(IDCA):
27
+ """Concrete class for DCA groups"""
28
+
29
+ @property
30
+ def address(self) -> str:
31
+ return f'/dca/{self.index}'
32
+
33
+ @property
34
+ def on(self) -> bool:
35
+ return self.getter('on')[0] == 1
36
+
37
+ @on.setter
38
+ def on(self, val: bool):
39
+ self.setter('on', 1 if val else 0)
40
+
41
+ @property
42
+ def mute(self) -> bool:
43
+ return not self.on
44
+
45
+ @mute.setter
46
+ def mute(self, val: bool):
47
+ self.on = not val
48
+
49
+ @property
50
+ def name(self) -> str:
51
+ return self.getter('config/name')[0]
52
+
53
+ @name.setter
54
+ def name(self, val: str):
55
+ self.setter('config/name', val)
56
+
57
+ @property
58
+ def color(self) -> int:
59
+ return self.getter('config/color')[0]
60
+
61
+ @color.setter
62
+ def color(self, val: int):
63
+ self.setter('config/color', val)
xair_api/errors.py CHANGED
@@ -1,14 +1,14 @@
1
- class XAirRemoteError(Exception):
2
- """Base error class for XAIR Remote."""
3
-
4
-
5
- class XAirRemoteConnectionTimeoutError(XAirRemoteError):
6
- """Exception raised when a connection attempt times out"""
7
-
8
- def __init__(self, ip, port):
9
- self.ip = ip
10
- self.port = port
11
-
12
- super().__init__(
13
- f'Timeout attempting to connect to mixer at {self.ip}:{self.port}'
14
- )
1
+ class XAirRemoteError(Exception):
2
+ """Base error class for XAIR Remote."""
3
+
4
+
5
+ class XAirRemoteConnectionTimeoutError(XAirRemoteError):
6
+ """Exception raised when a connection attempt times out"""
7
+
8
+ def __init__(self, ip, port):
9
+ self.ip = ip
10
+ self.port = port
11
+
12
+ super().__init__(
13
+ f'Timeout attempting to connect to mixer at {self.ip}:{self.port}'
14
+ )
xair_api/fx.py CHANGED
@@ -1,74 +1,74 @@
1
- import abc
2
- import logging
3
-
4
- from .meta import mute_prop
5
- from .shared import Config, Group, Mix
6
-
7
- logger = logging.getLogger(__name__)
8
-
9
-
10
- class IFX(abc.ABC):
11
- """Abstract Base Class for fxs"""
12
-
13
- def __init__(self, remote, index: int):
14
- self._remote = remote
15
- self.index = index + 1
16
- self.logger = logger.getChild(self.__class__.__name__)
17
-
18
- def getter(self, param: str):
19
- return self._remote.query(f'{self.address}/{param}')
20
-
21
- def setter(self, param: str, val: int):
22
- self._remote.send(f'{self.address}/{param}', val)
23
-
24
- @abc.abstractmethod
25
- def address(self):
26
- pass
27
-
28
-
29
- class FX(IFX):
30
- """Concrete class for fx"""
31
-
32
- @property
33
- def address(self) -> str:
34
- return f'/fx/{self.index}'
35
-
36
- @property
37
- def type(self) -> int:
38
- return self.getter('type')[0]
39
-
40
- @type.setter
41
- def type(self, val: int):
42
- self.setter('type', val)
43
-
44
-
45
- class FXSend(IFX):
46
- """Concrete class for fxsend"""
47
-
48
- @classmethod
49
- def make(cls, remote, index):
50
- """
51
- Factory function for FXSend
52
-
53
- Creates a mixin of shared subclasses, sets them as class attributes.
54
-
55
- Returns an FXSend class of a kind.
56
- """
57
- FXSEND_cls = type(
58
- f'FXSend{remote.kind}',
59
- (cls,),
60
- {
61
- **{
62
- _cls.__name__.lower(): type(
63
- f'{_cls.__name__}{remote.kind}', (_cls, cls), {}
64
- )(remote, index)
65
- for _cls in (Config, Mix, Group)
66
- },
67
- 'mute': mute_prop(),
68
- },
69
- )
70
- return FXSEND_cls(remote, index)
71
-
72
- @property
73
- def address(self) -> str:
74
- return f'/fxsend/{self.index}'
1
+ import abc
2
+ import logging
3
+
4
+ from .meta import mute_prop
5
+ from .shared import Config, Group, Mix
6
+
7
+ logger = logging.getLogger(__name__)
8
+
9
+
10
+ class IFX(abc.ABC):
11
+ """Abstract Base Class for fxs"""
12
+
13
+ def __init__(self, remote, index: int):
14
+ self._remote = remote
15
+ self.index = index + 1
16
+ self.logger = logger.getChild(self.__class__.__name__)
17
+
18
+ def getter(self, param: str):
19
+ return self._remote.query(f'{self.address}/{param}')
20
+
21
+ def setter(self, param: str, val: int):
22
+ self._remote.send(f'{self.address}/{param}', val)
23
+
24
+ @abc.abstractmethod
25
+ def address(self):
26
+ pass
27
+
28
+
29
+ class FX(IFX):
30
+ """Concrete class for fx"""
31
+
32
+ @property
33
+ def address(self) -> str:
34
+ return f'/fx/{self.index}'
35
+
36
+ @property
37
+ def type(self) -> int:
38
+ return self.getter('type')[0]
39
+
40
+ @type.setter
41
+ def type(self, val: int):
42
+ self.setter('type', val)
43
+
44
+
45
+ class FXSend(IFX):
46
+ """Concrete class for fxsend"""
47
+
48
+ @classmethod
49
+ def make(cls, remote, index):
50
+ """
51
+ Factory function for FXSend
52
+
53
+ Creates a mixin of shared subclasses, sets them as class attributes.
54
+
55
+ Returns an FXSend class of a kind.
56
+ """
57
+ FXSEND_cls = type(
58
+ f'FXSend{remote.kind}',
59
+ (cls,),
60
+ {
61
+ **{
62
+ _cls.__name__.lower(): type(
63
+ f'{_cls.__name__}{remote.kind}', (_cls, cls), {}
64
+ )(remote, index)
65
+ for _cls in (Config, Mix, Group)
66
+ },
67
+ 'mute': mute_prop(),
68
+ },
69
+ )
70
+ return FXSEND_cls(remote, index)
71
+
72
+ @property
73
+ def address(self) -> str:
74
+ return f'/fxsend/{self.index}'
xair_api/headamp.py CHANGED
@@ -1,49 +1,49 @@
1
- import abc
2
- import logging
3
-
4
- from . import util
5
-
6
- logger = logging.getLogger(__name__)
7
-
8
-
9
- class IHeadAmp(abc.ABC):
10
- """Abstract Base Class for headamps"""
11
-
12
- def __init__(self, remote, index: int):
13
- self._remote = remote
14
- self.index = index + 1
15
- self.logger = logger.getChild(self.__class__.__name__)
16
-
17
- def getter(self, param: str):
18
- return self._remote.query(f'{self.address}/{param}')
19
-
20
- def setter(self, param: str, val: int):
21
- self._remote.send(f'{self.address}/{param}', val)
22
-
23
- @abc.abstractmethod
24
- def address(self):
25
- pass
26
-
27
-
28
- class HeadAmp(IHeadAmp):
29
- """Concrete class for headamps"""
30
-
31
- @property
32
- def address(self):
33
- return f'/headamp/{str(self.index).zfill(2)}'
34
-
35
- @property
36
- def gain(self):
37
- return round(util.lin_get(-12, 60, self.getter('gain')[0]), 1)
38
-
39
- @gain.setter
40
- def gain(self, val):
41
- self.setter('gain', util.lin_set(-12, 60, val))
42
-
43
- @property
44
- def phantom(self):
45
- return self.getter('phantom')[0] == 1
46
-
47
- @phantom.setter
48
- def phantom(self, val):
49
- self.setter('phantom', 1 if val else 0)
1
+ import abc
2
+ import logging
3
+
4
+ from . import util
5
+
6
+ logger = logging.getLogger(__name__)
7
+
8
+
9
+ class IHeadAmp(abc.ABC):
10
+ """Abstract Base Class for headamps"""
11
+
12
+ def __init__(self, remote, index: int):
13
+ self._remote = remote
14
+ self.index = index + 1
15
+ self.logger = logger.getChild(self.__class__.__name__)
16
+
17
+ def getter(self, param: str):
18
+ return self._remote.query(f'{self.address}/{param}')
19
+
20
+ def setter(self, param: str, val: int):
21
+ self._remote.send(f'{self.address}/{param}', val)
22
+
23
+ @abc.abstractmethod
24
+ def address(self):
25
+ pass
26
+
27
+
28
+ class HeadAmp(IHeadAmp):
29
+ """Concrete class for headamps"""
30
+
31
+ @property
32
+ def address(self):
33
+ return f'/headamp/{str(self.index).zfill(2)}'
34
+
35
+ @property
36
+ def gain(self):
37
+ return round(util.lin_get(-12, 60, self.getter('gain')[0]), 1)
38
+
39
+ @gain.setter
40
+ def gain(self, val):
41
+ self.setter('gain', util.lin_set(-12, 60, val))
42
+
43
+ @property
44
+ def phantom(self):
45
+ return self.getter('phantom')[0] == 1
46
+
47
+ @phantom.setter
48
+ def phantom(self, val):
49
+ self.setter('phantom', 1 if val else 0)
xair_api/kinds.py CHANGED
@@ -1,61 +1,61 @@
1
- from dataclasses import dataclass
2
-
3
-
4
- @dataclass(frozen=True)
5
- class KindMap:
6
- id_: str
7
-
8
- def __str__(self) -> str:
9
- return self.id_
10
-
11
-
12
- @dataclass(frozen=True)
13
- class X32KindMap(KindMap):
14
- num_dca: int = 8
15
- num_strip: int = 32
16
- num_bus: int = 16
17
- num_fx: int = 8
18
- num_auxrtn: int = 8
19
- num_matrix: int = 6
20
- num_headamp: int = 127
21
-
22
-
23
- @dataclass(frozen=True)
24
- class XR18KindMap(KindMap):
25
- # note ch 17-18 defined as aux return
26
- num_dca: int = 4
27
- num_strip: int = 16
28
- num_bus: int = 6
29
- num_fx: int = 4
30
-
31
-
32
- @dataclass(frozen=True)
33
- class XR16KindMap(KindMap):
34
- num_dca: int = 4
35
- num_strip: int = 16
36
- num_bus: int = 4
37
- num_fx: int = 4
38
-
39
-
40
- @dataclass(frozen=True)
41
- class XR12KindMap(KindMap):
42
- num_dca: int = 4
43
- num_strip: int = 12
44
- num_bus: int = 2
45
- num_fx: int = 4
46
-
47
-
48
- _kinds = {
49
- 'X32': X32KindMap(id_='X32'),
50
- 'MR18': XR18KindMap(id_='MR18'),
51
- 'XR18': XR18KindMap(id_='XR18'),
52
- 'XR16': XR16KindMap(id_='XR16'),
53
- 'XR12': XR12KindMap(id_='XR12'),
54
- }
55
-
56
-
57
- def get(kind_id):
58
- return _kinds[kind_id]
59
-
60
-
61
- all = list(_kinds.values())
1
+ from dataclasses import dataclass
2
+
3
+
4
+ @dataclass(frozen=True)
5
+ class KindMap:
6
+ id_: str
7
+
8
+ def __str__(self) -> str:
9
+ return self.id_
10
+
11
+
12
+ @dataclass(frozen=True)
13
+ class X32KindMap(KindMap):
14
+ num_dca: int = 8
15
+ num_strip: int = 32
16
+ num_bus: int = 16
17
+ num_fx: int = 8
18
+ num_auxrtn: int = 8
19
+ num_matrix: int = 6
20
+ num_headamp: int = 127
21
+
22
+
23
+ @dataclass(frozen=True)
24
+ class XR18KindMap(KindMap):
25
+ # note ch 17-18 defined as aux return
26
+ num_dca: int = 4
27
+ num_strip: int = 16
28
+ num_bus: int = 6
29
+ num_fx: int = 4
30
+
31
+
32
+ @dataclass(frozen=True)
33
+ class XR16KindMap(KindMap):
34
+ num_dca: int = 4
35
+ num_strip: int = 16
36
+ num_bus: int = 4
37
+ num_fx: int = 4
38
+
39
+
40
+ @dataclass(frozen=True)
41
+ class XR12KindMap(KindMap):
42
+ num_dca: int = 4
43
+ num_strip: int = 12
44
+ num_bus: int = 2
45
+ num_fx: int = 4
46
+
47
+
48
+ _kinds = {
49
+ 'X32': X32KindMap(id_='X32'),
50
+ 'MR18': XR18KindMap(id_='MR18'),
51
+ 'XR18': XR18KindMap(id_='XR18'),
52
+ 'XR16': XR16KindMap(id_='XR16'),
53
+ 'XR12': XR12KindMap(id_='XR12'),
54
+ }
55
+
56
+
57
+ def get(kind_id):
58
+ return _kinds[kind_id]
59
+
60
+
61
+ all = list(_kinds.values())
xair_api/lr.py CHANGED
@@ -1,67 +1,67 @@
1
- import abc
2
- import logging
3
- from typing import Optional
4
-
5
- from .meta import mute_prop
6
- from .shared import EQ, GEQ, Config, Dyn, Insert, Mix
7
-
8
- logger = logging.getLogger(__name__)
9
-
10
-
11
- class ILR(abc.ABC):
12
- """Abstract Base Class for lr"""
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 LR(ILR):
32
- """Concrete class for lr"""
33
-
34
- @classmethod
35
- def make(cls, remote, index=None):
36
- """
37
- Factory function for LR
38
-
39
- Creates a mixin of shared subclasses, sets them as class attributes.
40
-
41
- Returns an LR class of a kind.
42
- """
43
- LR_cls = type(
44
- f'LR{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
- Dyn,
54
- Insert,
55
- GEQ.make(),
56
- EQ.make_sixband(cls, remote, index),
57
- Mix,
58
- )
59
- },
60
- 'mute': mute_prop(),
61
- },
62
- )
63
- return LR_cls(remote, index)
64
-
65
- @property
66
- def address(self) -> str:
67
- return '/lr'
1
+ import abc
2
+ import logging
3
+ from typing import Optional
4
+
5
+ from .meta import mute_prop
6
+ from .shared import EQ, GEQ, Config, Dyn, Insert, Mix
7
+
8
+ logger = logging.getLogger(__name__)
9
+
10
+
11
+ class ILR(abc.ABC):
12
+ """Abstract Base Class for lr"""
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 LR(ILR):
32
+ """Concrete class for lr"""
33
+
34
+ @classmethod
35
+ def make(cls, remote, index=None):
36
+ """
37
+ Factory function for LR
38
+
39
+ Creates a mixin of shared subclasses, sets them as class attributes.
40
+
41
+ Returns an LR class of a kind.
42
+ """
43
+ LR_cls = type(
44
+ f'LR{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
+ Dyn,
54
+ Insert,
55
+ GEQ.make(),
56
+ EQ.make_sixband(cls, remote, index),
57
+ Mix,
58
+ )
59
+ },
60
+ 'mute': mute_prop(),
61
+ },
62
+ )
63
+ return LR_cls(remote, index)
64
+
65
+ @property
66
+ def address(self) -> str:
67
+ return '/lr'