mirror of
https://github.com/onyx-and-iris/xair-api-python.git
synced 2026-04-07 16:43:32 +00:00
Compare commits
17 Commits
add-send-c
...
add-connec
| Author | SHA1 | Date | |
|---|---|---|---|
| caaf2689ff | |||
| 7e7aa1b4de | |||
| 2dc096e306 | |||
| ed397e57aa | |||
| 718ecbd982 | |||
| 69cabb3db0 | |||
| 6a2df6352d | |||
| 9c1fa36aed | |||
| 3a70a4c578 | |||
| 8b1b2c7f79 | |||
| 1e5e458105 | |||
| e05460e998 | |||
| d27824d1cf | |||
| 764195a452 | |||
| b295fee6e1 | |||
| 06be2f2831 | |||
| 2d0c0f91f0 |
32
CHANGELOG.md
32
CHANGELOG.md
@@ -9,8 +9,36 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
- [x] Send class mixed into Strip, AuxRtn, FxRtn. May now be accessed with {Class}.send
|
- [ ]
|
||||||
- [x] Sends example added
|
|
||||||
|
## [2.3.2] - 2024-02-16
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Configurable kwarg `connect_timeout` added. Defaults to 2 seconds.
|
||||||
|
- New error class `XAirRemoteConnectionTimeoutError`. Raised if a connection validation times out.
|
||||||
|
- timeout kwarg + Errors section added to README.
|
||||||
|
|
||||||
|
## [2.3.1] - 2024-02-15
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Module level loggers implemented
|
||||||
|
- class loggers are now child loggers
|
||||||
|
- Passing an incorrect kind_id to the entry point now raises an XAirRemoteError.
|
||||||
|
- Passing a value out of bounds to a setter now logs a warning instead of raising an exception.
|
||||||
|
- Send class added to README.
|
||||||
|
|
||||||
|
## [2.2.4] - 2024-02-14
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Send class mixed into Strip, AuxRtn, FxRtn. May now be accessed with {Class}.send
|
||||||
|
- Sends example added
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- delay kwarg now applies to getters. See [Issue #6](https://github.com/onyx-and-iris/xair-api-python/issues/6).
|
||||||
|
|
||||||
## [2.2.0] - 2022-11-08
|
## [2.2.0] - 2022-11-08
|
||||||
|
|
||||||
|
|||||||
23
README.md
23
README.md
@@ -55,7 +55,7 @@ if __name__ == "__main__":
|
|||||||
main()
|
main()
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `xair_api.connect(kind_id, ip=ip, delay=delay)`
|
#### `xair_api.connect(kind_id, ip=ip, delay=0.02, connect_timeout=2)`
|
||||||
|
|
||||||
Currently the following devices are supported:
|
Currently the following devices are supported:
|
||||||
|
|
||||||
@@ -72,6 +72,7 @@ The following keyword arguments may be passed:
|
|||||||
- `port`: mixer port, defaults to 10023 for x32 and 10024 for xair
|
- `port`: mixer port, defaults to 10023 for x32 and 10024 for xair
|
||||||
- `delay`: a delay between each command (applies to the getters). Defaults to 20ms.
|
- `delay`: a delay between each command (applies to the getters). Defaults to 20ms.
|
||||||
- a note about delay, stability may rely on network connection. For wired connections the delay can be safely reduced.
|
- a note about delay, stability may rely on network connection. For wired connections the delay can be safely reduced.
|
||||||
|
- `connect_timeout`: amount of time to wait for a validated connection. Defaults to 2s.
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
@@ -121,7 +122,7 @@ Contains the subclasses:
|
|||||||
### `Strip`
|
### `Strip`
|
||||||
|
|
||||||
Contains the subclasses:
|
Contains the subclasses:
|
||||||
(`Config`, `Preamp`, `Gate`, `Dyn`, `Insert`, `GEQ`, `EQ`, `Mix`, `Group`, `Automix`)
|
(`Config`, `Preamp`, `Gate`, `Dyn`, `Insert`, `GEQ`, `EQ`, `Mix`, `Group`, `Automix`, `Send`)
|
||||||
|
|
||||||
### `Bus`
|
### `Bus`
|
||||||
|
|
||||||
@@ -136,12 +137,12 @@ Contains the subclasses:
|
|||||||
### `FXRtn`
|
### `FXRtn`
|
||||||
|
|
||||||
Contains the subclasses:
|
Contains the subclasses:
|
||||||
(`Config`, `Preamp`, `EQ`, `Mix`, `Group`)
|
(`Config`, `Preamp`, `EQ`, `Mix`, `Group`, `Send`)
|
||||||
|
|
||||||
### `AuxRtn`
|
### `AuxRtn`
|
||||||
|
|
||||||
Contains the subclasses:
|
Contains the subclasses:
|
||||||
(`Config`, `Preamp`, `EQ`, `Mix`, `Group`)
|
(`Config`, `Preamp`, `EQ`, `Mix`, `Group`, `Send`)
|
||||||
|
|
||||||
### `Subclasses`
|
### `Subclasses`
|
||||||
|
|
||||||
@@ -288,6 +289,12 @@ tuple containing a class for each mute group
|
|||||||
|
|
||||||
for example: `config.mute_group[0].on = True`
|
for example: `config.mute_group[0].on = True`
|
||||||
|
|
||||||
|
### `Send`
|
||||||
|
|
||||||
|
- `level`: float, -inf to 10.0
|
||||||
|
|
||||||
|
for example: `mixer.strip[10].send[3].level = -16.5`
|
||||||
|
|
||||||
### XAirRemote class (lower level)
|
### XAirRemote class (lower level)
|
||||||
|
|
||||||
Send an OSC command directly to the mixer
|
Send an OSC command directly to the mixer
|
||||||
@@ -311,6 +318,14 @@ for example:
|
|||||||
print(mixer.query("/ch/01/mix/on"))
|
print(mixer.query("/ch/01/mix/on"))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Errors
|
||||||
|
|
||||||
|
- `errors.XAirRemoteError`: Base error class for XAIR Remote.
|
||||||
|
- `errors.XAirRemoteConnectionTimeoutError`:Exception raised when a connection attempt times out.
|
||||||
|
- The following attributes are available:
|
||||||
|
- `ip`: IP of the mixer.
|
||||||
|
- `port`: Port of the mixer.
|
||||||
|
|
||||||
### `Tests`
|
### `Tests`
|
||||||
|
|
||||||
Unplug any expensive equipment before running tests.
|
Unplug any expensive equipment before running tests.
|
||||||
|
|||||||
211
poetry.lock
generated
211
poetry.lock
generated
@@ -1,22 +1,5 @@
|
|||||||
# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand.
|
# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand.
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "attrs"
|
|
||||||
version = "22.1.0"
|
|
||||||
description = "Classes Without Boilerplate"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.5"
|
|
||||||
files = [
|
|
||||||
{file = "attrs-22.1.0-py2.py3-none-any.whl", hash = "sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c"},
|
|
||||||
{file = "attrs-22.1.0.tar.gz", hash = "sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy (>=0.900,!=0.940)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "sphinx", "sphinx-notfound-page", "zope.interface"]
|
|
||||||
docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"]
|
|
||||||
tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "zope.interface"]
|
|
||||||
tests-no-zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "black"
|
name = "black"
|
||||||
version = "22.8.0"
|
version = "22.8.0"
|
||||||
@@ -62,6 +45,28 @@ d = ["aiohttp (>=3.7.4)"]
|
|||||||
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
|
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
|
||||||
uvloop = ["uvloop (>=0.15.2)"]
|
uvloop = ["uvloop (>=0.15.2)"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cachetools"
|
||||||
|
version = "5.3.2"
|
||||||
|
description = "Extensible memoizing collections and decorators"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.7"
|
||||||
|
files = [
|
||||||
|
{file = "cachetools-5.3.2-py3-none-any.whl", hash = "sha256:861f35a13a451f94e301ce2bec7cac63e881232ccce7ed67fab9b5df4d3beaa1"},
|
||||||
|
{file = "cachetools-5.3.2.tar.gz", hash = "sha256:086ee420196f7b2ab9ca2db2520aca326318b68fe5ba8bc4d49cca91add450f2"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chardet"
|
||||||
|
version = "5.2.0"
|
||||||
|
description = "Universal encoding detector for Python 3"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.7"
|
||||||
|
files = [
|
||||||
|
{file = "chardet-5.2.0-py3-none-any.whl", hash = "sha256:e1cf59446890a00105fe7b7912492ea04b6e6f06d4b742b2c788469e34c82970"},
|
||||||
|
{file = "chardet-5.2.0.tar.gz", hash = "sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "click"
|
name = "click"
|
||||||
version = "8.1.3"
|
version = "8.1.3"
|
||||||
@@ -78,15 +83,56 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""}
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "colorama"
|
name = "colorama"
|
||||||
version = "0.4.5"
|
version = "0.4.6"
|
||||||
description = "Cross-platform colored terminal text."
|
description = "Cross-platform colored terminal text."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"},
|
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
|
||||||
{file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"},
|
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "distlib"
|
||||||
|
version = "0.3.8"
|
||||||
|
description = "Distribution utilities"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
files = [
|
||||||
|
{file = "distlib-0.3.8-py2.py3-none-any.whl", hash = "sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784"},
|
||||||
|
{file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "exceptiongroup"
|
||||||
|
version = "1.2.0"
|
||||||
|
description = "Backport of PEP 654 (exception groups)"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.7"
|
||||||
|
files = [
|
||||||
|
{file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"},
|
||||||
|
{file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
test = ["pytest (>=6)"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "filelock"
|
||||||
|
version = "3.13.1"
|
||||||
|
description = "A platform independent file lock."
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.8"
|
||||||
|
files = [
|
||||||
|
{file = "filelock-3.13.1-py3-none-any.whl", hash = "sha256:57dbda9b35157b05fb3e58ee91448612eb674172fab98ee235ccb0b5bee19a1c"},
|
||||||
|
{file = "filelock-3.13.1.tar.gz", hash = "sha256:521f5f56c50f8426f5e03ad3b281b490a87ef15bc6c526f168290f0c7148d44e"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.24)"]
|
||||||
|
testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)"]
|
||||||
|
typing = ["typing-extensions (>=4.8)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iniconfig"
|
name = "iniconfig"
|
||||||
version = "1.1.1"
|
version = "1.1.1"
|
||||||
@@ -128,18 +174,15 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "packaging"
|
name = "packaging"
|
||||||
version = "21.3"
|
version = "23.2"
|
||||||
description = "Core utilities for Python packages"
|
description = "Core utilities for Python packages"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.6"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"},
|
{file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"},
|
||||||
{file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"},
|
{file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
|
||||||
pyparsing = ">=2.0.2,<3.0.5 || >3.0.5"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pathspec"
|
name = "pathspec"
|
||||||
version = "0.10.1"
|
version = "0.10.1"
|
||||||
@@ -153,28 +196,28 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "platformdirs"
|
name = "platformdirs"
|
||||||
version = "2.5.2"
|
version = "4.2.0"
|
||||||
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
|
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "platformdirs-2.5.2-py3-none-any.whl", hash = "sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788"},
|
{file = "platformdirs-4.2.0-py3-none-any.whl", hash = "sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068"},
|
||||||
{file = "platformdirs-2.5.2.tar.gz", hash = "sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"},
|
{file = "platformdirs-4.2.0.tar.gz", hash = "sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx (>=4)", "sphinx-autodoc-typehints (>=1.12)"]
|
docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"]
|
||||||
test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)"]
|
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pluggy"
|
name = "pluggy"
|
||||||
version = "1.0.0"
|
version = "1.4.0"
|
||||||
description = "plugin and hook calling mechanisms for python"
|
description = "plugin and hook calling mechanisms for python"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.6"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"},
|
{file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"},
|
||||||
{file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"},
|
{file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
@@ -182,52 +225,45 @@ dev = ["pre-commit", "tox"]
|
|||||||
testing = ["pytest", "pytest-benchmark"]
|
testing = ["pytest", "pytest-benchmark"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "py"
|
name = "pyproject-api"
|
||||||
version = "1.11.0"
|
version = "1.6.1"
|
||||||
description = "library with cross-python path, ini-parsing, io, code, log facilities"
|
description = "API to interact with the python pyproject.toml based projects"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"},
|
{file = "pyproject_api-1.6.1-py3-none-any.whl", hash = "sha256:4c0116d60476b0786c88692cf4e325a9814965e2469c5998b830bba16b183675"},
|
||||||
{file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"},
|
{file = "pyproject_api-1.6.1.tar.gz", hash = "sha256:1817dc018adc0d1ff9ca1ed8c60e1623d5aaca40814b953af14a9cf9a5cae538"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[package.dependencies]
|
||||||
name = "pyparsing"
|
packaging = ">=23.1"
|
||||||
version = "3.0.9"
|
tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""}
|
||||||
description = "pyparsing module - Classes and methods to define and execute parsing grammars"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.6.8"
|
|
||||||
files = [
|
|
||||||
{file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"},
|
|
||||||
{file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
diagrams = ["jinja2", "railroad-diagrams"]
|
docs = ["furo (>=2023.8.19)", "sphinx (<7.2)", "sphinx-autodoc-typehints (>=1.24)"]
|
||||||
|
testing = ["covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)", "setuptools (>=68.1.2)", "wheel (>=0.41.2)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pytest"
|
name = "pytest"
|
||||||
version = "7.1.3"
|
version = "7.4.4"
|
||||||
description = "pytest: simple powerful testing with Python"
|
description = "pytest: simple powerful testing with Python"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "pytest-7.1.3-py3-none-any.whl", hash = "sha256:1377bda3466d70b55e3f5cecfa55bb7cfcf219c7964629b967c37cf0bda818b7"},
|
{file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"},
|
||||||
{file = "pytest-7.1.3.tar.gz", hash = "sha256:4f365fec2dff9c1162f834d9f18af1ba13062db0c708bf7b946f8a5c76180c39"},
|
{file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
attrs = ">=19.2.0"
|
|
||||||
colorama = {version = "*", markers = "sys_platform == \"win32\""}
|
colorama = {version = "*", markers = "sys_platform == \"win32\""}
|
||||||
|
exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
|
||||||
iniconfig = "*"
|
iniconfig = "*"
|
||||||
packaging = "*"
|
packaging = "*"
|
||||||
pluggy = ">=0.12,<2.0"
|
pluggy = ">=0.12,<2.0"
|
||||||
py = ">=1.8.2"
|
tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
|
||||||
tomli = ">=1.0.0"
|
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"]
|
testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pytest-randomly"
|
name = "pytest-randomly"
|
||||||
@@ -265,7 +301,54 @@ files = [
|
|||||||
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
|
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tox"
|
||||||
|
version = "4.12.1"
|
||||||
|
description = "tox is a generic virtualenv management and test command line tool"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.8"
|
||||||
|
files = [
|
||||||
|
{file = "tox-4.12.1-py3-none-any.whl", hash = "sha256:c07ea797880a44f3c4f200ad88ad92b446b83079d4ccef89585df64cc574375c"},
|
||||||
|
{file = "tox-4.12.1.tar.gz", hash = "sha256:61aafbeff1bd8a5af84e54ef6e8402f53c6a6066d0782336171ddfbf5362122e"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
cachetools = ">=5.3.2"
|
||||||
|
chardet = ">=5.2"
|
||||||
|
colorama = ">=0.4.6"
|
||||||
|
filelock = ">=3.13.1"
|
||||||
|
packaging = ">=23.2"
|
||||||
|
platformdirs = ">=4.1"
|
||||||
|
pluggy = ">=1.3"
|
||||||
|
pyproject-api = ">=1.6.1"
|
||||||
|
tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""}
|
||||||
|
virtualenv = ">=20.25"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-argparse-cli (>=1.11.1)", "sphinx-autodoc-typehints (>=1.25.2)", "sphinx-copybutton (>=0.5.2)", "sphinx-inline-tabs (>=2023.4.21)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.11)"]
|
||||||
|
testing = ["build[virtualenv] (>=1.0.3)", "covdefaults (>=2.3)", "detect-test-pollution (>=1.2)", "devpi-process (>=1)", "diff-cover (>=8.0.2)", "distlib (>=0.3.8)", "flaky (>=3.7)", "hatch-vcs (>=0.4)", "hatchling (>=1.21)", "psutil (>=5.9.7)", "pytest (>=7.4.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-xdist (>=3.5)", "re-assert (>=1.1)", "time-machine (>=2.13)", "wheel (>=0.42)"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "virtualenv"
|
||||||
|
version = "20.25.0"
|
||||||
|
description = "Virtual Python Environment builder"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.7"
|
||||||
|
files = [
|
||||||
|
{file = "virtualenv-20.25.0-py3-none-any.whl", hash = "sha256:4238949c5ffe6876362d9c0180fc6c3a824a7b12b80604eeb8085f2ed7460de3"},
|
||||||
|
{file = "virtualenv-20.25.0.tar.gz", hash = "sha256:bf51c0d9c7dd63ea8e44086fa1e4fb1093a31e963b86959257378aef020e1f1b"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
distlib = ">=0.3.7,<1"
|
||||||
|
filelock = ">=3.12.2,<4"
|
||||||
|
platformdirs = ">=3.9.1,<5"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"]
|
||||||
|
test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"]
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = "^3.10"
|
python-versions = "^3.10"
|
||||||
content-hash = "def96d1658f870a9820fef363ee6a04455f1d895e15a189ea4f39801f168552f"
|
content-hash = "43084819c12a97bdb6adbd7fd0b077292e8c4e78e4921fd8c0f14dd192a334ff"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "xair-api"
|
name = "xair-api"
|
||||||
version = "2.2.4a0"
|
version = "2.3.2"
|
||||||
description = "Remote control Behringer X-Air | Midas MR mixers through OSC"
|
description = "Remote control Behringer X-Air | Midas MR mixers through OSC"
|
||||||
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@@ -13,10 +13,11 @@ python-osc = "^1.8.0"
|
|||||||
tomli = { version = "^2.0.1", python = "<3.11" }
|
tomli = { version = "^2.0.1", python = "<3.11" }
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
pytest = "^7.1.2"
|
pytest = "^7.4.4"
|
||||||
pytest-randomly = "^3.12.0"
|
pytest-randomly = "^3.12.0"
|
||||||
black = "^22.6.0"
|
black = "^22.6.0"
|
||||||
isort = "^5.10.1"
|
isort = "^5.10.1"
|
||||||
|
tox = "^4.12.1"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
@@ -27,3 +28,16 @@ obs = "scripts:ex_obs"
|
|||||||
sends = "scripts:ex_sends"
|
sends = "scripts:ex_sends"
|
||||||
xair = "scripts:test_xair"
|
xair = "scripts:test_xair"
|
||||||
x32 = "scripts:test_x32"
|
x32 = "scripts:test_x32"
|
||||||
|
all = "scripts:test_all"
|
||||||
|
|
||||||
|
[tool.tox]
|
||||||
|
legacy_tox_ini = """
|
||||||
|
[tox]
|
||||||
|
envlist = py310,py311,py312
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
allowlist_externals = poetry
|
||||||
|
commands =
|
||||||
|
poetry install -v
|
||||||
|
poetry run pytest tests/
|
||||||
|
"""
|
||||||
|
|||||||
@@ -21,3 +21,7 @@ def test_xair():
|
|||||||
def test_x32():
|
def test_x32():
|
||||||
path = Path.cwd() / "tests" / "x32"
|
path = Path.cwd() / "tests" / "x32"
|
||||||
subprocess.run(["pytest", "-v", str(path)])
|
subprocess.run(["pytest", "-v", str(path)])
|
||||||
|
|
||||||
|
|
||||||
|
def test_all():
|
||||||
|
subprocess.run(["tox"])
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from xair_api import kinds
|
|||||||
kind_id = "X32"
|
kind_id = "X32"
|
||||||
ip = "x32.local"
|
ip = "x32.local"
|
||||||
|
|
||||||
tests = xair_api.connect(kind_id, ip=ip, delay=0.008)
|
tests = xair_api.connect(kind_id, ip=ip)
|
||||||
|
|
||||||
kind = kinds.get(kind_id)
|
kind = kinds.get(kind_id)
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from xair_api import kinds
|
|||||||
kind_id = "MR18"
|
kind_id = "MR18"
|
||||||
ip = "mixer.local"
|
ip = "mixer.local"
|
||||||
|
|
||||||
tests = xair_api.connect(kind_id, ip=ip, delay=0.008)
|
tests = xair_api.connect(kind_id, ip=ip)
|
||||||
|
|
||||||
kind = kinds.get(kind_id)
|
kind = kinds.get(kind_id)
|
||||||
|
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ class FxRtn(IFxRtn):
|
|||||||
class MainStereo(ILR):
|
class MainStereo(ILR):
|
||||||
@property
|
@property
|
||||||
def address(self) -> str:
|
def address(self) -> str:
|
||||||
return f"/main/st"
|
return "/main/st"
|
||||||
|
|
||||||
|
|
||||||
class MainMono(ILR):
|
class MainMono(ILR):
|
||||||
@property
|
@property
|
||||||
def address(self) -> str:
|
def address(self) -> str:
|
||||||
return f"/main/m"
|
return "/main/m"
|
||||||
|
|
||||||
|
|
||||||
class Matrix(ILR):
|
class Matrix(ILR):
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import abc
|
import abc
|
||||||
|
import logging
|
||||||
|
|
||||||
from .errors import XAirRemoteError
|
|
||||||
from .meta import mute_prop
|
from .meta import mute_prop
|
||||||
from .shared import EQ, GEQ, Automix, Config, Dyn, Gate, Group, Insert, Mix, Preamp
|
from .shared import EQ, GEQ, Config, Dyn, Group, Insert, Mix
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class IBus(abc.ABC):
|
class IBus(abc.ABC):
|
||||||
@@ -11,6 +13,7 @@ class IBus(abc.ABC):
|
|||||||
def __init__(self, remote, index: int):
|
def __init__(self, remote, index: int):
|
||||||
self._remote = remote
|
self._remote = remote
|
||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
|
|
||||||
def getter(self, param: str):
|
def getter(self, param: str):
|
||||||
return self._remote.query(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
import abc
|
import abc
|
||||||
|
import logging
|
||||||
|
|
||||||
from . import kinds, util
|
from . import kinds, util
|
||||||
from .errors import XAirRemoteError
|
|
||||||
from .meta import bool_prop
|
from .meta import bool_prop
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class IConfig(abc.ABC):
|
class IConfig(abc.ABC):
|
||||||
"""Abstract Base Class for config"""
|
"""Abstract Base Class for config"""
|
||||||
|
|
||||||
def __init__(self, remote):
|
def __init__(self, remote):
|
||||||
self._remote = remote
|
self._remote = remote
|
||||||
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
|
|
||||||
def getter(self, param: str):
|
def getter(self, param: str):
|
||||||
return self._remote.query(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
@@ -33,8 +36,8 @@ class Config(IConfig):
|
|||||||
Returns a Config class of a kind.
|
Returns a Config class of a kind.
|
||||||
"""
|
"""
|
||||||
LINKS_cls = _make_links_mixins[remote.kind.id_]
|
LINKS_cls = _make_links_mixins[remote.kind.id_]
|
||||||
MUTEGROUP_cls = type(f"MuteGroup", (Config.MuteGroup, cls), {})
|
MUTEGROUP_cls = type("MuteGroup", (Config.MuteGroup, cls), {})
|
||||||
MONITOR_cls = type(f"ConfigMonitor", (Config.Monitor, cls), {})
|
MONITOR_cls = type("ConfigMonitor", (Config.Monitor, cls), {})
|
||||||
CONFIG_cls = type(
|
CONFIG_cls = type(
|
||||||
f"Config{remote.kind}",
|
f"Config{remote.kind}",
|
||||||
(cls, LINKS_cls),
|
(cls, LINKS_cls),
|
||||||
@@ -47,7 +50,7 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def address(self) -> str:
|
def address(self) -> str:
|
||||||
return f"/config"
|
return "/config"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def amixenable(self) -> bool:
|
def amixenable(self) -> bool:
|
||||||
@@ -105,7 +108,7 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@source.setter
|
@source.setter
|
||||||
def source(self, val: int):
|
def source(self, val: int):
|
||||||
self.setter(f"source", val)
|
self.setter("source", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sourcetrim(self) -> float:
|
def sourcetrim(self) -> float:
|
||||||
@@ -114,7 +117,9 @@ class Config(IConfig):
|
|||||||
@sourcetrim.setter
|
@sourcetrim.setter
|
||||||
def sourcetrim(self, val: float):
|
def sourcetrim(self, val: float):
|
||||||
if not -18 <= val <= 18:
|
if not -18 <= val <= 18:
|
||||||
raise XAirRemoteError("expected value in range -18.0 to 18.0")
|
self.logger.warning(
|
||||||
|
f"sourcetrim got {val}, expected value in range -18.0 to 18.0"
|
||||||
|
)
|
||||||
self.setter("sourcetrim", util.lin_set(-18, 18, val))
|
self.setter("sourcetrim", util.lin_set(-18, 18, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -140,7 +145,9 @@ class Config(IConfig):
|
|||||||
@dimgain.setter
|
@dimgain.setter
|
||||||
def dimgain(self, val: int):
|
def dimgain(self, val: int):
|
||||||
if not -40 <= val <= 0:
|
if not -40 <= val <= 0:
|
||||||
raise XAirRemoteError("expected value in range -40 to 0")
|
self.logger.warning(
|
||||||
|
f"dimgain got {val}, expected value in range -40 to 0"
|
||||||
|
)
|
||||||
self.setter("dimatt", util.lin_set(-40, 0, val))
|
self.setter("dimatt", util.lin_set(-40, 0, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import abc
|
import abc
|
||||||
|
import logging
|
||||||
|
|
||||||
from .errors import XAirRemoteError
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class IDCA(abc.ABC):
|
class IDCA(abc.ABC):
|
||||||
@@ -9,6 +10,7 @@ class IDCA(abc.ABC):
|
|||||||
def __init__(self, remote, index: int):
|
def __init__(self, remote, index: int):
|
||||||
self._remote = remote
|
self._remote = remote
|
||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
|
|
||||||
def getter(self, param: str) -> tuple:
|
def getter(self, param: str) -> tuple:
|
||||||
return self._remote.query(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
@@ -50,7 +52,7 @@ class DCA(IDCA):
|
|||||||
|
|
||||||
@name.setter
|
@name.setter
|
||||||
def name(self, val: str):
|
def name(self, val: str):
|
||||||
self.setter("config/name")[0]
|
self.setter("config/name", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def color(self) -> int:
|
def color(self) -> int:
|
||||||
|
|||||||
@@ -1,2 +1,14 @@
|
|||||||
class XAirRemoteError(Exception):
|
class XAirRemoteError(Exception):
|
||||||
"""Base error class for XAIR Remote."""
|
"""Base error class for XAIR Remote."""
|
||||||
|
|
||||||
|
|
||||||
|
class XAirRemoteConnectionTimeoutError(XAirRemoteError):
|
||||||
|
"""Exception raised when a connection attempt times out"""
|
||||||
|
|
||||||
|
def __init__(self, ip, port):
|
||||||
|
self.ip = ip
|
||||||
|
self.port = port
|
||||||
|
|
||||||
|
super().__init__(
|
||||||
|
f"Timeout attempting to connect to mixer at {self.ip}:{self.port}"
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import abc
|
import abc
|
||||||
|
import logging
|
||||||
|
|
||||||
from .errors import XAirRemoteError
|
|
||||||
from .meta import mute_prop
|
from .meta import mute_prop
|
||||||
from .shared import EQ, GEQ, Automix, Config, Dyn, Gate, Group, Insert, Mix, Preamp
|
from .shared import Config, Group, Mix
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class IFX(abc.ABC):
|
class IFX(abc.ABC):
|
||||||
@@ -11,6 +13,7 @@ class IFX(abc.ABC):
|
|||||||
def __init__(self, remote, index: int):
|
def __init__(self, remote, index: int):
|
||||||
self._remote = remote
|
self._remote = remote
|
||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
|
|
||||||
def getter(self, param: str):
|
def getter(self, param: str):
|
||||||
return self._remote.query(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import abc
|
import abc
|
||||||
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from .errors import XAirRemoteError
|
|
||||||
from .meta import mute_prop
|
from .meta import mute_prop
|
||||||
from .shared import EQ, GEQ, Automix, Config, Dyn, Gate, Group, Insert, Mix, Preamp
|
from .shared import EQ, GEQ, Config, Dyn, Insert, Mix
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ILR(abc.ABC):
|
class ILR(abc.ABC):
|
||||||
@@ -13,6 +15,7 @@ class ILR(abc.ABC):
|
|||||||
self._remote = remote
|
self._remote = remote
|
||||||
if index is not None:
|
if index is not None:
|
||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
|
|
||||||
def getter(self, param: str):
|
def getter(self, param: str):
|
||||||
return self._remote.query(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
@@ -61,4 +64,4 @@ class LR(ILR):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def address(self) -> str:
|
def address(self) -> str:
|
||||||
return f"/lr"
|
return "/lr"
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
from .errors import XAirRemoteError
|
|
||||||
from .util import lin_get, lin_set
|
from .util import lin_get, lin_set
|
||||||
|
|
||||||
|
|
||||||
@@ -51,13 +50,6 @@ def float_prop(param):
|
|||||||
|
|
||||||
|
|
||||||
def geq_prop(param):
|
def geq_prop(param):
|
||||||
# fmt: off
|
|
||||||
opts = {
|
|
||||||
"1k": 1000, "1k25": 1250, "1k6": 1600, "2k": 2000, "3k15": 3150, "4k": 4000,
|
|
||||||
"5k": 5000, "6k3": 6300, "8k": 8000, "10k": 10000, "12k5": 12500, "16k": 16000,
|
|
||||||
"20k": 20000,
|
|
||||||
}
|
|
||||||
# fmt: on
|
|
||||||
param = param.replace("_", ".")
|
param = param.replace("_", ".")
|
||||||
|
|
||||||
def fget(self) -> float:
|
def fget(self) -> float:
|
||||||
@@ -65,7 +57,9 @@ def geq_prop(param):
|
|||||||
|
|
||||||
def fset(self, val):
|
def fset(self, val):
|
||||||
if not -15 <= val <= 15:
|
if not -15 <= val <= 15:
|
||||||
raise XAirRemoteError("expected value in range -15.0 to 15.0")
|
self.logger.warning(
|
||||||
|
f"slider_{param} got {val}, expected value in range -15.0 to 15.0"
|
||||||
|
)
|
||||||
self.setter(param, lin_set(-15, 15, val))
|
self.setter(param, lin_set(-15, 15, val))
|
||||||
|
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
|
|||||||
@@ -1,21 +1,11 @@
|
|||||||
import abc
|
import abc
|
||||||
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from .errors import XAirRemoteError
|
|
||||||
from .meta import mute_prop
|
from .meta import mute_prop
|
||||||
from .shared import (
|
from .shared import EQ, Config, Group, Mix, Preamp, Send
|
||||||
EQ,
|
|
||||||
GEQ,
|
logger = logging.getLogger(__name__)
|
||||||
Automix,
|
|
||||||
Config,
|
|
||||||
Dyn,
|
|
||||||
Gate,
|
|
||||||
Group,
|
|
||||||
Insert,
|
|
||||||
Mix,
|
|
||||||
Preamp,
|
|
||||||
Send,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IRtn(abc.ABC):
|
class IRtn(abc.ABC):
|
||||||
@@ -25,6 +15,7 @@ class IRtn(abc.ABC):
|
|||||||
self._remote = remote
|
self._remote = remote
|
||||||
if index is not None:
|
if index is not None:
|
||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
|
|
||||||
def getter(self, param: str):
|
def getter(self, param: str):
|
||||||
return self._remote.query(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
from . import util
|
from . import util
|
||||||
from .errors import XAirRemoteError
|
|
||||||
from .meta import geq_prop
|
from .meta import geq_prop
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -61,7 +60,9 @@ class Preamp:
|
|||||||
@usbtrim.setter
|
@usbtrim.setter
|
||||||
def usbtrim(self, val: float):
|
def usbtrim(self, val: float):
|
||||||
if not -18 <= val <= 18:
|
if not -18 <= val <= 18:
|
||||||
raise XAirRemoteError("expected value in range -18.0 to 18.0")
|
self.logger.warning(
|
||||||
|
f"usbtrim got {val}, expected value in range -18.0 to 18.0"
|
||||||
|
)
|
||||||
self.setter("rtntrim", util.lin_set(-18, 18, val))
|
self.setter("rtntrim", util.lin_set(-18, 18, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -95,7 +96,9 @@ class Preamp:
|
|||||||
@highpassfilter.setter
|
@highpassfilter.setter
|
||||||
def highpassfilter(self, val: int):
|
def highpassfilter(self, val: int):
|
||||||
if not 20 <= val <= 400:
|
if not 20 <= val <= 400:
|
||||||
raise XAirRemoteError("expected value in range 20 to 400")
|
self.logger.warning(
|
||||||
|
f"highpassfilter got {val}, expected value in range 20 to 400"
|
||||||
|
)
|
||||||
self.setter("hpf", util.log_set(20, 400, val))
|
self.setter("hpf", util.log_set(20, 400, val))
|
||||||
|
|
||||||
|
|
||||||
@@ -122,7 +125,7 @@ class Gate:
|
|||||||
def mode(self, val: str):
|
def mode(self, val: str):
|
||||||
opts = ("gate", "exp2", "exp3", "exp4", "duck")
|
opts = ("gate", "exp2", "exp3", "exp4", "duck")
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"expected one of {opts}")
|
self.logger.warning(f"mode got {val}, expected one of {opts}")
|
||||||
self.setter("mode", opts.index(val))
|
self.setter("mode", opts.index(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -132,7 +135,9 @@ class Gate:
|
|||||||
@threshold.setter
|
@threshold.setter
|
||||||
def threshold(self, val: float):
|
def threshold(self, val: float):
|
||||||
if not -80 <= val <= 0:
|
if not -80 <= val <= 0:
|
||||||
raise XAirRemoteError("expected value in range -80.0 to 0.0")
|
self.logger.warning(
|
||||||
|
f"threshold got {val}, expected value in range -80.0 to 0.0"
|
||||||
|
)
|
||||||
self.setter("thr", util.lin_set(-80, 0, val))
|
self.setter("thr", util.lin_set(-80, 0, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -142,7 +147,7 @@ class Gate:
|
|||||||
@range.setter
|
@range.setter
|
||||||
def range(self, val: int):
|
def range(self, val: int):
|
||||||
if not 3 <= val <= 60:
|
if not 3 <= val <= 60:
|
||||||
raise XAirRemoteError("expected value in range 3 to 60")
|
self.logger.warning(f"range got {val}, expected value in range 3 to 60")
|
||||||
self.setter("range", util.lin_set(3, 60, val))
|
self.setter("range", util.lin_set(3, 60, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -152,7 +157,7 @@ class Gate:
|
|||||||
@attack.setter
|
@attack.setter
|
||||||
def attack(self, val: int):
|
def attack(self, val: int):
|
||||||
if not 0 <= val <= 120:
|
if not 0 <= val <= 120:
|
||||||
raise XAirRemoteError("expected value in range 0 to 120")
|
self.logger.warning(f"attack got {val}, expected value in range 0 to 120")
|
||||||
self.setter("attack", util.lin_set(0, 120, val))
|
self.setter("attack", util.lin_set(0, 120, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -163,7 +168,9 @@ class Gate:
|
|||||||
@hold.setter
|
@hold.setter
|
||||||
def hold(self, val: float):
|
def hold(self, val: float):
|
||||||
if not 0.02 <= val <= 2000:
|
if not 0.02 <= val <= 2000:
|
||||||
raise XAirRemoteError("expected value in range 0.02 to 2000.0")
|
self.logger.warning(
|
||||||
|
f"hold got {val}, expected value in range 0.02 to 2000.0"
|
||||||
|
)
|
||||||
self.setter("hold", util.log_set(0.02, 2000, val))
|
self.setter("hold", util.log_set(0.02, 2000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -173,7 +180,7 @@ class Gate:
|
|||||||
@release.setter
|
@release.setter
|
||||||
def release(self, val: int):
|
def release(self, val: int):
|
||||||
if not 5 <= val <= 4000:
|
if not 5 <= val <= 4000:
|
||||||
raise XAirRemoteError("expected value in range 5 to 4000")
|
self.logger.warning(f"release got {val}, expected value in range 5 to 4000")
|
||||||
self.setter("release", util.log_set(5, 4000, val))
|
self.setter("release", util.log_set(5, 4000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -208,7 +215,9 @@ class Gate:
|
|||||||
@filterfreq.setter
|
@filterfreq.setter
|
||||||
def filterfreq(self, val: Union[float, int]):
|
def filterfreq(self, val: Union[float, int]):
|
||||||
if not 20 <= val <= 20000:
|
if not 20 <= val <= 20000:
|
||||||
raise XAirRemoteError("expected value in range 20 to 20000")
|
self.logger.warning(
|
||||||
|
f"filterfreq got {val}, expected value in range 20 to 20000"
|
||||||
|
)
|
||||||
self.setter("filter/f", util.log_set(20, 20000, val))
|
self.setter("filter/f", util.log_set(20, 20000, val))
|
||||||
|
|
||||||
|
|
||||||
@@ -235,7 +244,7 @@ class Dyn:
|
|||||||
def mode(self, val: str):
|
def mode(self, val: str):
|
||||||
opts = ("comp", "exp")
|
opts = ("comp", "exp")
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"expected one of {opts}")
|
self.logger.warning(f"mode got {val}, expected one of {opts}")
|
||||||
self.setter("mode", opts.index(val))
|
self.setter("mode", opts.index(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -247,7 +256,7 @@ class Dyn:
|
|||||||
def det(self, val: str):
|
def det(self, val: str):
|
||||||
opts = ("peak", "rms")
|
opts = ("peak", "rms")
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"expected one of {opts}")
|
self.logger.warning(f"det got {val}, expected one of {opts}")
|
||||||
self.setter("det", opts.index(val))
|
self.setter("det", opts.index(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -259,7 +268,7 @@ class Dyn:
|
|||||||
def env(self, val: str):
|
def env(self, val: str):
|
||||||
opts = ("lin", "log")
|
opts = ("lin", "log")
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"expected one of {opts}")
|
self.logger.warning(f"env got {val}, expected one of {opts}")
|
||||||
self.setter("env", opts.index(val))
|
self.setter("env", opts.index(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -269,7 +278,9 @@ class Dyn:
|
|||||||
@threshold.setter
|
@threshold.setter
|
||||||
def threshold(self, val: float):
|
def threshold(self, val: float):
|
||||||
if not -60 <= val <= 0:
|
if not -60 <= val <= 0:
|
||||||
raise XAirRemoteError("expected value in range -60.0 to 0")
|
self.logger.warning(
|
||||||
|
f"threshold got {val}, expected value in range -60.0 to 0"
|
||||||
|
)
|
||||||
self.setter("thr", util.lin_set(-60, 0, val))
|
self.setter("thr", util.lin_set(-60, 0, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -288,7 +299,7 @@ class Dyn:
|
|||||||
@knee.setter
|
@knee.setter
|
||||||
def knee(self, val: int):
|
def knee(self, val: int):
|
||||||
if not 0 <= val <= 5:
|
if not 0 <= val <= 5:
|
||||||
raise XAirRemoteError("expected value in range 0 to 5")
|
self.logger.warning(f"knee got {val}, expected value in range 0 to 5")
|
||||||
self.setter("knee", util.lin_set(0, 5, val))
|
self.setter("knee", util.lin_set(0, 5, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -298,7 +309,7 @@ class Dyn:
|
|||||||
@mgain.setter
|
@mgain.setter
|
||||||
def mgain(self, val: float):
|
def mgain(self, val: float):
|
||||||
if not 0 <= val <= 24:
|
if not 0 <= val <= 24:
|
||||||
raise XAirRemoteError("expected value in range 0.0 to 24.0")
|
self.logger.warning(f"mgain got {val}, expected value in range 0.0 to 24.0")
|
||||||
self.setter("mgain", util.lin_set(0, 24, val))
|
self.setter("mgain", util.lin_set(0, 24, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -308,7 +319,7 @@ class Dyn:
|
|||||||
@attack.setter
|
@attack.setter
|
||||||
def attack(self, val: int):
|
def attack(self, val: int):
|
||||||
if not 0 <= val <= 120:
|
if not 0 <= val <= 120:
|
||||||
raise XAirRemoteError("expected value in range 0 to 120")
|
self.logger.warning(f"attack got {val}, expected value in range 0 to 120")
|
||||||
self.setter("attack", util.lin_set(0, 120, val))
|
self.setter("attack", util.lin_set(0, 120, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -319,7 +330,9 @@ class Dyn:
|
|||||||
@hold.setter
|
@hold.setter
|
||||||
def hold(self, val: float):
|
def hold(self, val: float):
|
||||||
if not 0.02 <= val <= 2000:
|
if not 0.02 <= val <= 2000:
|
||||||
raise XAirRemoteError("expected value in range 0.02 to 2000.0")
|
self.logger.warning(
|
||||||
|
f"hold got {val}, expected value in range 0.02 to 2000.0"
|
||||||
|
)
|
||||||
self.setter("hold", util.log_set(0.02, 2000, val))
|
self.setter("hold", util.log_set(0.02, 2000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -329,7 +342,7 @@ class Dyn:
|
|||||||
@release.setter
|
@release.setter
|
||||||
def release(self, val: int):
|
def release(self, val: int):
|
||||||
if not 5 <= val <= 4000:
|
if not 5 <= val <= 4000:
|
||||||
raise XAirRemoteError("expected value in range 5 to 4000")
|
self.logger.warning(f"release got {val}, expected value in range 5 to 4000")
|
||||||
self.setter("release", util.log_set(5, 4000, val))
|
self.setter("release", util.log_set(5, 4000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -339,7 +352,7 @@ class Dyn:
|
|||||||
@mix.setter
|
@mix.setter
|
||||||
def mix(self, val: int):
|
def mix(self, val: int):
|
||||||
if not 0 <= val <= 100:
|
if not 0 <= val <= 100:
|
||||||
raise XAirRemoteError("expected value in range 0 to 100")
|
self.logger.warning(f"mix got {val}, expected value in range 0 to 100")
|
||||||
self.setter("mix", util.lin_set(0, 100, val))
|
self.setter("mix", util.lin_set(0, 100, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -382,7 +395,9 @@ class Dyn:
|
|||||||
@filterfreq.setter
|
@filterfreq.setter
|
||||||
def filterfreq(self, val: Union[float, int]):
|
def filterfreq(self, val: Union[float, int]):
|
||||||
if not 20 <= val <= 20000:
|
if not 20 <= val <= 20000:
|
||||||
raise XAirRemoteError("expected value in range 20 to 20000")
|
self.logger.warning(
|
||||||
|
f"filterfreq got {val}, expected value in range 20 to 20000"
|
||||||
|
)
|
||||||
self.setter("filter/f", util.log_set(20, 20000, val))
|
self.setter("filter/f", util.log_set(20, 20000, val))
|
||||||
|
|
||||||
|
|
||||||
@@ -462,7 +477,7 @@ class EQ:
|
|||||||
def mode(self, val: str):
|
def mode(self, val: str):
|
||||||
opts = ("peq", "geq", "teq")
|
opts = ("peq", "geq", "teq")
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
raise XAirRemoteError(f"expected one of {opts}")
|
self.logger.warning(f"mode got {val}, expected one of {opts}")
|
||||||
self.setter("mode", opts.index(val))
|
self.setter("mode", opts.index(val))
|
||||||
|
|
||||||
class EQBand:
|
class EQBand:
|
||||||
@@ -481,7 +496,7 @@ class EQ:
|
|||||||
|
|
||||||
@type.setter
|
@type.setter
|
||||||
def type(self, val: int):
|
def type(self, val: int):
|
||||||
self.setter(f"type", val)
|
self.setter("type", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def frequency(self) -> float:
|
def frequency(self) -> float:
|
||||||
@@ -491,7 +506,9 @@ class EQ:
|
|||||||
@frequency.setter
|
@frequency.setter
|
||||||
def frequency(self, val: float):
|
def frequency(self, val: float):
|
||||||
if not 20 <= val <= 20000:
|
if not 20 <= val <= 20000:
|
||||||
raise XAirRemoteError("expected value in range 20.0 to 20000.0")
|
self.logger.warning(
|
||||||
|
f"frequency got {val}, expected value in range 20.0 to 20000.0"
|
||||||
|
)
|
||||||
self.setter("f", util.log_set(20, 20000, val))
|
self.setter("f", util.log_set(20, 20000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -501,7 +518,9 @@ class EQ:
|
|||||||
@gain.setter
|
@gain.setter
|
||||||
def gain(self, val: float):
|
def gain(self, val: float):
|
||||||
if not -15 <= val <= 15:
|
if not -15 <= val <= 15:
|
||||||
raise XAirRemoteError("expected value in range -15.0 to 15.0")
|
self.logger.warning(
|
||||||
|
f"gain got {val}, expected value in range -15.0 to 15.0"
|
||||||
|
)
|
||||||
self.setter("g", util.lin_set(-15, 15, val))
|
self.setter("g", util.lin_set(-15, 15, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -512,7 +531,9 @@ class EQ:
|
|||||||
@quality.setter
|
@quality.setter
|
||||||
def quality(self, val: float):
|
def quality(self, val: float):
|
||||||
if not 0.3 <= val <= 10:
|
if not 0.3 <= val <= 10:
|
||||||
raise XAirRemoteError("expected value in range 0.3 to 10.0")
|
self.logger.warning(
|
||||||
|
f"quality got {val}, expected value in range 0.3 to 10.0"
|
||||||
|
)
|
||||||
self.setter("q", util.log_set(0.3, 10, val))
|
self.setter("q", util.log_set(0.3, 10, val))
|
||||||
|
|
||||||
|
|
||||||
@@ -528,7 +549,7 @@ class GEQ:
|
|||||||
f"slider_{param}": geq_prop(param)
|
f"slider_{param}": geq_prop(param)
|
||||||
for param in [
|
for param in [
|
||||||
"20", "25", "31_5", "40", "50", "63", "80", "100", "125",
|
"20", "25", "31_5", "40", "50", "63", "80", "100", "125",
|
||||||
"160", "200", "250", "315" "400", "500", "630", "800", "1k",
|
"160", "200", "250", "315", "400", "500", "630", "800", "1k",
|
||||||
"1k25", "1k6", "2k", "2k5", "3k15", "4k", "5k", "6k3", "8k",
|
"1k25", "1k6", "2k", "2k5", "3k15", "4k", "5k", "6k3", "8k",
|
||||||
"10k", "12k5", "16k", "20k",
|
"10k", "12k5", "16k", "20k",
|
||||||
]
|
]
|
||||||
@@ -620,7 +641,9 @@ class Automix:
|
|||||||
@weight.setter
|
@weight.setter
|
||||||
def weight(self, val: float):
|
def weight(self, val: float):
|
||||||
if not -12 <= val <= 12:
|
if not -12 <= val <= 12:
|
||||||
raise XAirRemoteError("expected value in range -12.0 to 12.0")
|
self.logger.warning(
|
||||||
|
f"weight got {val}, expected value in range -12.0 to 12.0"
|
||||||
|
)
|
||||||
self.setter("weight", util.lin_set(-12, 12, val))
|
self.setter("weight", util.lin_set(-12, 12, val))
|
||||||
|
|
||||||
|
|
||||||
@@ -641,10 +664,10 @@ class Send:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
@util.db_from
|
@util.db_from
|
||||||
def level(self):
|
def level(self) -> float:
|
||||||
return self.getter("level")[0]
|
return self.getter("level")[0]
|
||||||
|
|
||||||
@level.setter
|
@level.setter
|
||||||
@util.db_to
|
@util.db_to
|
||||||
def level(self, val):
|
def level(self, val: float):
|
||||||
self.setter("level", val)
|
self.setter("level", val)
|
||||||
|
|||||||
@@ -1,20 +1,10 @@
|
|||||||
import abc
|
import abc
|
||||||
|
import logging
|
||||||
|
|
||||||
from .errors import XAirRemoteError
|
|
||||||
from .meta import mute_prop
|
from .meta import mute_prop
|
||||||
from .shared import (
|
from .shared import EQ, Automix, Config, Dyn, Gate, Group, Insert, Mix, Preamp, Send
|
||||||
EQ,
|
|
||||||
GEQ,
|
logger = logging.getLogger(__name__)
|
||||||
Automix,
|
|
||||||
Config,
|
|
||||||
Dyn,
|
|
||||||
Gate,
|
|
||||||
Group,
|
|
||||||
Insert,
|
|
||||||
Mix,
|
|
||||||
Preamp,
|
|
||||||
Send,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IStrip(abc.ABC):
|
class IStrip(abc.ABC):
|
||||||
@@ -23,6 +13,7 @@ class IStrip(abc.ABC):
|
|||||||
def __init__(self, remote, index: int):
|
def __init__(self, remote, index: int):
|
||||||
self._remote = remote
|
self._remote = remote
|
||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
|
|
||||||
def getter(self, param: str) -> tuple:
|
def getter(self, param: str) -> tuple:
|
||||||
return self._remote.query(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
|
|||||||
@@ -1,6 +1,35 @@
|
|||||||
import functools
|
import functools
|
||||||
|
import time
|
||||||
from math import exp, log
|
from math import exp, log
|
||||||
|
|
||||||
|
from .errors import XAirRemoteConnectionTimeoutError
|
||||||
|
|
||||||
|
|
||||||
|
def timeout(func):
|
||||||
|
"""
|
||||||
|
Times out the validate_connection function once time elapsed exceeds remote.connect_timeout.
|
||||||
|
"""
|
||||||
|
|
||||||
|
@functools.wraps(func)
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
|
remote, *_ = args
|
||||||
|
|
||||||
|
err = None
|
||||||
|
start = time.time()
|
||||||
|
while time.time() < start + remote.connect_timeout:
|
||||||
|
try:
|
||||||
|
func(*args, **kwargs)
|
||||||
|
remote.logger.debug(f"login time: {round(time.time() - start, 2)}")
|
||||||
|
err = None
|
||||||
|
break
|
||||||
|
except XAirRemoteConnectionTimeoutError as e:
|
||||||
|
err = e
|
||||||
|
continue
|
||||||
|
if err:
|
||||||
|
raise err
|
||||||
|
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
def lin_get(min, max, val):
|
def lin_get(min, max, val):
|
||||||
return min + (max - min) * val
|
return min + (max - min) * val
|
||||||
|
|||||||
@@ -14,17 +14,19 @@ from pythonosc.dispatcher import Dispatcher
|
|||||||
from pythonosc.osc_message_builder import OscMessageBuilder
|
from pythonosc.osc_message_builder import OscMessageBuilder
|
||||||
from pythonosc.osc_server import BlockingOSCUDPServer
|
from pythonosc.osc_server import BlockingOSCUDPServer
|
||||||
|
|
||||||
from . import adapter, kinds
|
from . import adapter, kinds, util
|
||||||
from .bus import Bus
|
from .bus import Bus
|
||||||
from .config import Config
|
from .config import Config
|
||||||
from .dca import DCA
|
from .dca import DCA
|
||||||
from .errors import XAirRemoteError
|
from .errors import XAirRemoteConnectionTimeoutError, XAirRemoteError
|
||||||
from .fx import FX, FXSend
|
from .fx import FX, FXSend
|
||||||
from .kinds import KindMap
|
from .kinds import KindMap
|
||||||
from .lr import LR
|
from .lr import LR
|
||||||
from .rtn import AuxRtn, FxRtn
|
from .rtn import AuxRtn, FxRtn
|
||||||
from .strip import Strip
|
from .strip import Strip
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class OSCClientServer(BlockingOSCUDPServer):
|
class OSCClientServer(BlockingOSCUDPServer):
|
||||||
def __init__(self, address: str, dispatcher: Dispatcher):
|
def __init__(self, address: str, dispatcher: Dispatcher):
|
||||||
@@ -45,10 +47,6 @@ class OSCClientServer(BlockingOSCUDPServer):
|
|||||||
class XAirRemote(abc.ABC):
|
class XAirRemote(abc.ABC):
|
||||||
"""Handles the communication with the mixer via the OSC protocol"""
|
"""Handles the communication with the mixer via the OSC protocol"""
|
||||||
|
|
||||||
logger = logging.getLogger("xair.xairremote")
|
|
||||||
|
|
||||||
_CONNECT_TIMEOUT = 0.5
|
|
||||||
|
|
||||||
_info_response = []
|
_info_response = []
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
@@ -57,6 +55,8 @@ class XAirRemote(abc.ABC):
|
|||||||
self.xair_ip = kwargs["ip"] or self._ip_from_toml()
|
self.xair_ip = kwargs["ip"] or self._ip_from_toml()
|
||||||
self.xair_port = kwargs["port"]
|
self.xair_port = kwargs["port"]
|
||||||
self._delay = kwargs["delay"]
|
self._delay = kwargs["delay"]
|
||||||
|
self.connect_timeout = kwargs["connect_timeout"]
|
||||||
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
if not self.xair_ip:
|
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)
|
self.server = OSCClientServer((self.xair_ip, self.xair_port), dispatcher)
|
||||||
@@ -73,14 +73,11 @@ class XAirRemote(abc.ABC):
|
|||||||
conn = tomllib.load(f)
|
conn = tomllib.load(f)
|
||||||
return conn["connection"].get("ip")
|
return conn["connection"].get("ip")
|
||||||
|
|
||||||
|
@util.timeout
|
||||||
def validate_connection(self):
|
def validate_connection(self):
|
||||||
self.send("/xinfo")
|
if not self.query("/xinfo"):
|
||||||
time.sleep(self._CONNECT_TIMEOUT)
|
raise XAirRemoteConnectionTimeoutError(self.xair_ip, self.xair_port)
|
||||||
if not self.info_response:
|
self.logger.info(
|
||||||
raise XAirRemoteError(
|
|
||||||
"Failed to setup OSC connection to mixer. Please check for correct ip address."
|
|
||||||
)
|
|
||||||
print(
|
|
||||||
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]}."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -116,7 +113,12 @@ def _make_remote(kind: KindMap) -> XAirRemote:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def init_x32(self, *args, **kwargs):
|
def init_x32(self, *args, **kwargs):
|
||||||
defaultkwargs = {"ip": None, "port": 10023, "delay": 0.02}
|
defaultkwargs = {
|
||||||
|
"ip": None,
|
||||||
|
"port": 10023,
|
||||||
|
"delay": 0.02,
|
||||||
|
"connect_timeout": 2,
|
||||||
|
}
|
||||||
kwargs = defaultkwargs | kwargs
|
kwargs = defaultkwargs | kwargs
|
||||||
XAirRemote.__init__(self, *args, **kwargs)
|
XAirRemote.__init__(self, *args, **kwargs)
|
||||||
self.kind = kind
|
self.kind = kind
|
||||||
@@ -134,7 +136,12 @@ def _make_remote(kind: KindMap) -> XAirRemote:
|
|||||||
self.config = Config.make(self)
|
self.config = Config.make(self)
|
||||||
|
|
||||||
def init_xair(self, *args, **kwargs):
|
def init_xair(self, *args, **kwargs):
|
||||||
defaultkwargs = {"ip": None, "port": 10024, "delay": 0.02}
|
defaultkwargs = {
|
||||||
|
"ip": None,
|
||||||
|
"port": 10024,
|
||||||
|
"delay": 0.02,
|
||||||
|
"connect_timeout": 2,
|
||||||
|
}
|
||||||
kwargs = defaultkwargs | kwargs
|
kwargs = defaultkwargs | kwargs
|
||||||
XAirRemote.__init__(self, *args, **kwargs)
|
XAirRemote.__init__(self, *args, **kwargs)
|
||||||
self.kind = kind
|
self.kind = kind
|
||||||
@@ -174,9 +181,10 @@ def request_remote_obj(kind_id: str, *args, **kwargs) -> XAirRemote:
|
|||||||
|
|
||||||
Returns a reference to an XAirRemote class of a kind
|
Returns a reference to an XAirRemote class of a kind
|
||||||
"""
|
"""
|
||||||
|
|
||||||
XAIRREMOTE_cls = None
|
XAIRREMOTE_cls = None
|
||||||
try:
|
try:
|
||||||
XAIRREMOTE_cls = _remotes[kind_id]
|
XAIRREMOTE_cls = _remotes[kind_id]
|
||||||
except ValueError as e:
|
except KeyError as e:
|
||||||
raise SystemExit(e)
|
raise XAirRemoteError(f"Unknown mixer kind '{kind_id}'") from e
|
||||||
return XAIRREMOTE_cls(*args, **kwargs)
|
return XAIRREMOTE_cls(*args, **kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user