mirror of
https://github.com/onyx-and-iris/xair-api-python.git
synced 2025-04-20 12:13:53 +01:00
Compare commits
13 Commits
df2d158618
...
6e017b4afc
Author | SHA1 | Date | |
---|---|---|---|
6e017b4afc | |||
85664c8465 | |||
a3473d5922 | |||
e9ef113b5c | |||
56ec9a17c0 | |||
9a7d98d58b | |||
f3cf215a76 | |||
a62a46d61a | |||
5eeaff2371 | |||
c2cf2fe523 | |||
265c26eb67 | |||
467b769ea4 | |||
27d0811091 |
81
CHANGELOG.md
81
CHANGELOG.md
@ -9,18 +9,25 @@ 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.2.0] - 2022-11-08
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- mute prop to Bus, FX, LR, RTN, Strip classes.
|
||||||
|
|
||||||
## [2.1.0] - 2022-11-08
|
## [2.1.0] - 2022-11-08
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- delay keyword argument
|
- delay keyword argument
|
||||||
- bounds checks for vals passed to lin_set/log_set
|
- bounds checks for vals passed to lin_set/log_set
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- type checks, prefer duck typing
|
- type checks, prefer duck typing
|
||||||
|
|
||||||
## [2.0.0] - 2022-11-07
|
## [2.0.0] - 2022-11-07
|
||||||
|
|
||||||
@ -29,76 +36,76 @@ However, a couple of changes have been made which are breaking, they are as foll
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- FX class added to fx module. This now deals with osc addresses that begin with "/fx/". Call it with mixer.fx.
|
- FX class added to fx module. This now deals with osc addresses that begin with "/fx/". Call it with mixer.fx.
|
||||||
- FxRtn class added to rtn module. This now deals with addresses that begin with "/rtn/". Call it with mixer.fxreturn
|
- FxRtn class added to rtn module. This now deals with addresses that begin with "/rtn/". Call it with mixer.fxreturn
|
||||||
- Aux class renamed to AuxRtn in rtn module. Call it with mixer.auxreturn.
|
- Aux class renamed to AuxRtn in rtn module. Call it with mixer.auxreturn.
|
||||||
|
|
||||||
These changes were made to better resemble the underlying osc api and to better describe the function of the classes.
|
These changes were made to better resemble the underlying osc api and to better describe the function of the classes.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- A small number of X32 tests. More will be added. XAir tests moved into it's own test module.
|
- A small number of X32 tests. More will be added. XAir tests moved into it's own test module.
|
||||||
- XAirRemote lower level section added to README.
|
- XAirRemote lower level section added to README.
|
||||||
- Links to OSC command documentation added to README.
|
- Links to OSC command documentation added to README.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- mixer.aux was renamed to mixer.auxreturn
|
- mixer.aux was renamed to mixer.auxreturn
|
||||||
|
|
||||||
## [1.1.0] - 2022-09-05
|
## [1.1.0] - 2022-09-05
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- tomli/tomllib compatibility layer to support python 3.10
|
- tomli/tomllib compatibility layer to support python 3.10
|
||||||
|
|
||||||
## [1.0.2] - 2022-08-07
|
## [1.0.2] - 2022-08-07
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- now packaged with poetry
|
- now packaged with poetry
|
||||||
- package added to pypi
|
- package added to pypi
|
||||||
- pypi, isort badges added to readme
|
- pypi, isort badges added to readme
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- package renamed to xair-api
|
- package renamed to xair-api
|
||||||
- now using tomllib for config, requires python 3.11
|
- now using tomllib for config, requires python 3.11
|
||||||
- readme, example updated.
|
- readme, example updated.
|
||||||
- imports isorted.
|
- imports isorted.
|
||||||
|
|
||||||
## [0.1.0] - 2022-05-01
|
## [0.1.0] - 2022-05-01
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- kind maps for "XR16", "XR12" added.
|
- kind maps for "XR16", "XR12" added.
|
||||||
- get() added to kind module.
|
- get() added to kind module.
|
||||||
- pre-commit.ps1 added for use with git hook.
|
- pre-commit.ps1 added for use with git hook.
|
||||||
- tests passed badge added to readme.
|
- tests passed badge added to readme.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- readme updated to reflect changes.
|
- readme updated to reflect changes.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- link to clone repo fixed in readme.
|
- link to clone repo fixed in readme.
|
||||||
- unit tests migrated from nose to pytest since nose will not be supported from python 3.10 onwards.
|
- unit tests migrated from nose to pytest since nose will not be supported from python 3.10 onwards.
|
||||||
|
|
||||||
## [0.0.1] - 2022-04-05
|
## [0.0.1] - 2022-04-05
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- \_query() added to base class, allows testing a single parameter.
|
- \_query() added to base class, allows testing a single parameter.
|
||||||
- Interface entry point defined.
|
- Interface entry point defined.
|
||||||
- Kind map for XR18/MR18 added
|
- Kind map for XR18/MR18 added
|
||||||
- Higher level classes (lr, strip, bus, fxsend, aux, rtn) implemented
|
- Higher level classes (lr, strip, bus, fxsend, aux, rtn) implemented
|
||||||
- Subclass mixin implemented (shared classes)
|
- Subclass mixin implemented (shared classes)
|
||||||
- meta module added
|
- meta module added
|
||||||
- util module added, mostly functions that perform math operations.
|
- util module added, mostly functions that perform math operations.
|
||||||
- readme initial commit.
|
- readme initial commit.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- base class now supports context manager.
|
- base class now supports context manager.
|
||||||
- load ip from ini
|
- load ip from ini
|
||||||
- unit tests initial commit. tests for shared classes added.
|
- unit tests initial commit. tests for shared classes added.
|
||||||
|
176
README.md
176
README.md
@ -12,7 +12,7 @@ For an outline of past/future changes refer to: [CHANGELOG](CHANGELOG.md)
|
|||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- Python 3.10 or greater
|
- Python 3.10 or greater
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -59,19 +59,19 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
Currently the following devices are supported:
|
Currently the following devices are supported:
|
||||||
|
|
||||||
- `MR18`
|
- `MR18`
|
||||||
- `XR18`
|
- `XR18`
|
||||||
- `XR16`
|
- `XR16`
|
||||||
- `XR12`
|
- `XR12`
|
||||||
|
|
||||||
The `X32` is partially supported. However, this document covers specifically the `XAir` series.
|
The `X32` is partially supported. However, this document covers specifically the `XAir` series.
|
||||||
|
|
||||||
The following keyword arguments may be passed:
|
The following keyword arguments may be passed:
|
||||||
|
|
||||||
- `ip`: ip address of the mixer
|
- `ip`: ip address of the mixer
|
||||||
- `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, 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.
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
@ -149,134 +149,134 @@ For each subclass the corresponding properties are available.
|
|||||||
|
|
||||||
`Config`
|
`Config`
|
||||||
|
|
||||||
- `name`: string
|
- `name`: string
|
||||||
- `color`: int, from 0, 16
|
- `color`: int, from 0, 16
|
||||||
- `inputsource`: int
|
- `inputsource`: int
|
||||||
- `usbreturn`: int
|
- `usbreturn`: int
|
||||||
|
|
||||||
`Preamp`
|
`Preamp`
|
||||||
|
|
||||||
- `on`: bool
|
- `on`: bool
|
||||||
- `usbtrim`: float, from -18.0 to 18.0
|
- `usbtrim`: float, from -18.0 to 18.0
|
||||||
- `usbinput`: bool
|
- `usbinput`: bool
|
||||||
- `invert`: bool
|
- `invert`: bool
|
||||||
- `highpasson`: bool
|
- `highpasson`: bool
|
||||||
- `highpassfilter`: int, from 20 to 400
|
- `highpassfilter`: int, from 20 to 400
|
||||||
|
|
||||||
`Gate`
|
`Gate`
|
||||||
|
|
||||||
- `on`: bool
|
- `on`: bool
|
||||||
- `mode`: str, one of ('gate', 'exp2', 'exp3', 'exp4', 'duck')
|
- `mode`: str, one of ('gate', 'exp2', 'exp3', 'exp4', 'duck')
|
||||||
- `threshold`: float, from -80.0 to 0.0
|
- `threshold`: float, from -80.0 to 0.0
|
||||||
- `range`: int, from 3 to 60
|
- `range`: int, from 3 to 60
|
||||||
- `attack`: int, from 0 to 120
|
- `attack`: int, from 0 to 120
|
||||||
- `hold`: float, from 0.02 to 2000
|
- `hold`: float, from 0.02 to 2000
|
||||||
- `release`: int, from 5 to 4000
|
- `release`: int, from 5 to 4000
|
||||||
- `keysource`, from 0 to 22
|
- `keysource`, from 0 to 22
|
||||||
- `filteron`: bool
|
- `filteron`: bool
|
||||||
- `filtertype`: int, from 0 to 8
|
- `filtertype`: int, from 0 to 8
|
||||||
- `filterfreq`: float, from 20 to 20000
|
- `filterfreq`: float, from 20 to 20000
|
||||||
|
|
||||||
`Dyn`
|
`Dyn`
|
||||||
|
|
||||||
- `on`: bool
|
- `on`: bool
|
||||||
- `mode`: str, one of ('comp', 'exp')
|
- `mode`: str, one of ('comp', 'exp')
|
||||||
- `det`: str, one of ('peak', 'rms')
|
- `det`: str, one of ('peak', 'rms')
|
||||||
- `env`: str, one of ('lin', 'log')
|
- `env`: str, one of ('lin', 'log')
|
||||||
- `threshold`: float, from -60.0 to 0.0
|
- `threshold`: float, from -60.0 to 0.0
|
||||||
- `ratio`: int, from 0 to 11
|
- `ratio`: int, from 0 to 11
|
||||||
- `knee`: int, from 0 to 5
|
- `knee`: int, from 0 to 5
|
||||||
- `mgain`: float, from 0.0 to 24.0
|
- `mgain`: float, from 0.0 to 24.0
|
||||||
- `attack`: int, from 0 to 120
|
- `attack`: int, from 0 to 120
|
||||||
- `hold`: float, from 0.02 to 2000
|
- `hold`: float, from 0.02 to 2000
|
||||||
- `release`: int, from 5 to 4000
|
- `release`: int, from 5 to 4000
|
||||||
- `mix`: int, from 0 to 100
|
- `mix`: int, from 0 to 100
|
||||||
- `keysource`: int, from 0 to 22
|
- `keysource`: int, from 0 to 22
|
||||||
- `auto`: bool
|
- `auto`: bool
|
||||||
- `filteron`: bool
|
- `filteron`: bool
|
||||||
- `filtertype`: int, from 0 to 8
|
- `filtertype`: int, from 0 to 8
|
||||||
- `filterfreq`: float, from 20 to 20000
|
- `filterfreq`: float, from 20 to 20000
|
||||||
|
|
||||||
`Insert`
|
`Insert`
|
||||||
|
|
||||||
- `on`: bool
|
- `on`: bool
|
||||||
- `sel`: int
|
- `sel`: int
|
||||||
|
|
||||||
`GEQ`
|
`GEQ`
|
||||||
The following method names preceded by `slider_`
|
The following method names preceded by `slider_`
|
||||||
|
|
||||||
- `20`, `25`, `31_5`, `40`, `50`, `63`, `80`, `100`, `125`, `160`,
|
- `20`, `25`, `31_5`, `40`, `50`, `63`, `80`, `100`, `125`, `160`,
|
||||||
- `200`, `250`, `315`, `400`, `500`, `630`, `800`, `1k`, `1k25`, `1k6`, `2k`,
|
- `200`, `250`, `315`, `400`, `500`, `630`, `800`, `1k`, `1k25`, `1k6`, `2k`,
|
||||||
- `2k5`, `3k15`, `4k`, `5k`, `6k3`, `8k`, `10k`, `12k5`, `16k`, `20k`: float, from -15.0 to 15.0
|
- `2k5`, `3k15`, `4k`, `5k`, `6k3`, `8k`, `10k`, `12k5`, `16k`, `20k`: float, from -15.0 to 15.0
|
||||||
|
|
||||||
for example: `slider_20`, `slider_6k3` etc..
|
for example: `slider_20`, `slider_6k3` etc..
|
||||||
|
|
||||||
`EQ`
|
`EQ`
|
||||||
|
|
||||||
- `on`: bool
|
- `on`: bool
|
||||||
- `mode`: str, one of ('peq', 'geq', 'teq')
|
- `mode`: str, one of ('peq', 'geq', 'teq')
|
||||||
|
|
||||||
For the subclasses: `low`, `low2`, `lomid`, `himid`, `high2`, `high` the following properties are available:
|
For the subclasses: `low`, `low2`, `lomid`, `himid`, `high2`, `high` the following properties are available:
|
||||||
|
|
||||||
- `type`: int, from 0 to 5
|
- `type`: int, from 0 to 5
|
||||||
- `frequency`: float, from 20.0 to 20000.0
|
- `frequency`: float, from 20.0 to 20000.0
|
||||||
- `gain`: float, -15.0 to 15.0
|
- `gain`: float, -15.0 to 15.0
|
||||||
- `quality`: float, from 0.3 to 10.0
|
- `quality`: float, from 0.3 to 10.0
|
||||||
|
|
||||||
for example: `eq.low2.type`
|
for example: `eq.low2.type`
|
||||||
|
|
||||||
`Mix`
|
`Mix`
|
||||||
|
|
||||||
- `on`: bool
|
- `on`: bool
|
||||||
- `fader`: float, -inf, to 10.0
|
- `fader`: float, -inf, to 10.0
|
||||||
- `lr`: bool
|
- `lr`: bool
|
||||||
|
|
||||||
`Group`
|
`Group`
|
||||||
|
|
||||||
- `dca`: int, from 0 to 15
|
- `dca`: int, from 0 to 15
|
||||||
- `mute`: int, from 0 to 15
|
- `mute`: int, from 0 to 15
|
||||||
|
|
||||||
`Automix`
|
`Automix`
|
||||||
|
|
||||||
- `group`: int, from 0 to 2
|
- `group`: int, from 0 to 2
|
||||||
- `weight`: float, from -12.0 to 12.0
|
- `weight`: float, from -12.0 to 12.0
|
||||||
|
|
||||||
### `DCA`
|
### `DCA`
|
||||||
|
|
||||||
- `on`: bool
|
- `on`: bool
|
||||||
- `name`: str
|
- `name`: str
|
||||||
- `color`: int, from 0 to 15
|
- `color`: int, from 0 to 15
|
||||||
|
|
||||||
### `Config`
|
### `Config`
|
||||||
|
|
||||||
The following method names preceded by `chlink`
|
The following method names preceded by `chlink`
|
||||||
|
|
||||||
- `1_2`, `3_4`, `5_6`, `7_8`, `9_10`, `11_12`, `13_14`, `15_16`
|
- `1_2`, `3_4`, `5_6`, `7_8`, `9_10`, `11_12`, `13_14`, `15_16`
|
||||||
|
|
||||||
The following method names preceded by `buslink`
|
The following method names preceded by `buslink`
|
||||||
|
|
||||||
- `1_2`, `3_4`, `5_6`
|
- `1_2`, `3_4`, `5_6`
|
||||||
|
|
||||||
for example: `chlink1_2`, `buslink5_6` etc..
|
for example: `chlink1_2`, `buslink5_6` etc..
|
||||||
|
|
||||||
- `link_eq`: bool
|
- `link_eq`: bool
|
||||||
- `link_dyn`: bool
|
- `link_dyn`: bool
|
||||||
- `link_fader_mute`: bool
|
- `link_fader_mute`: bool
|
||||||
- `amixenable`: bool
|
- `amixenable`: bool
|
||||||
- `amixlock`: bool
|
- `amixlock`: bool
|
||||||
|
|
||||||
For the subclass `monitor` the following properties are available
|
For the subclass `monitor` the following properties are available
|
||||||
|
|
||||||
- `level`: float, -inf to 10.0
|
- `level`: float, -inf to 10.0
|
||||||
- `source`: int, from 0 to 14
|
- `source`: int, from 0 to 14
|
||||||
- `sourcetrim`: float, from -18.0 to 18.0
|
- `sourcetrim`: float, from -18.0 to 18.0
|
||||||
- `chmode`: bool
|
- `chmode`: bool
|
||||||
- `busmode`: bool
|
- `busmode`: bool
|
||||||
- `dim`: bool
|
- `dim`: bool
|
||||||
- `dimgain`: float, from -40.0 to 0.0
|
- `dimgain`: float, from -40.0 to 0.0
|
||||||
- `mono`: bool
|
- `mono`: bool
|
||||||
- `mute`: bool
|
- `mute`: bool
|
||||||
- `dimfpl`: bool
|
- `dimfpl`: bool
|
||||||
|
|
||||||
for example: `config.monitor.chmode`
|
for example: `config.monitor.chmode`
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ for example: `config.monitor.chmode`
|
|||||||
|
|
||||||
tuple containing a class for each mute group
|
tuple containing a class for each mute group
|
||||||
|
|
||||||
- `on`: bool, from 0 to 3
|
- `on`: bool, from 0 to 3
|
||||||
|
|
||||||
for example: `config.mute_group[0].on = True`
|
for example: `config.mute_group[0].on = True`
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ for example: `config.mute_group[0].on = True`
|
|||||||
|
|
||||||
Send an OSC command directly to the mixer
|
Send an OSC command directly to the mixer
|
||||||
|
|
||||||
- `send(osc command, value)`
|
- `send(osc command, value)`
|
||||||
|
|
||||||
for example:
|
for example:
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ mixer.send("/bus/2/config/name", "somename")
|
|||||||
|
|
||||||
Query the value of a command:
|
Query the value of a command:
|
||||||
|
|
||||||
- `query(osc command)`
|
- `query(osc command)`
|
||||||
|
|
||||||
for example:
|
for example:
|
||||||
|
|
||||||
|
24
examples/sends/__main__.py
Normal file
24
examples/sends/__main__.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
|
import xair_api
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
with xair_api.connect("XR18", ip="mixer.local") as mixer:
|
||||||
|
for send in mixer.strip[0].send:
|
||||||
|
send.level = -22.8
|
||||||
|
|
||||||
|
mixer.strip[15].send[0].level = -16.5
|
||||||
|
print(mixer.strip[15].send[0].level)
|
||||||
|
|
||||||
|
mixer.auxreturn.send[0].level = -15.5
|
||||||
|
print(mixer.auxreturn.send[0].level)
|
||||||
|
|
||||||
|
mixer.fxreturn[0].send[0].level = -14.5
|
||||||
|
print(mixer.fxreturn[0].send[0].level)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
@ -1,12 +1,19 @@
|
|||||||
import obsws_python as obs
|
import obsws_python as obs
|
||||||
|
|
||||||
import xair_api
|
import xair_api
|
||||||
|
|
||||||
|
|
||||||
class Observer:
|
class Observer:
|
||||||
def __init__(self, mixer):
|
def __init__(self, mixer):
|
||||||
self._mixer = mixer
|
self._mixer = mixer
|
||||||
self._cl = obs.EventClient()
|
self._client = obs.EventClient()
|
||||||
self._cl.callback.register(self.on_current_program_scene_changed)
|
self._client.callback.register(self.on_current_program_scene_changed)
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, exc_traceback):
|
||||||
|
self._client.disconnect()
|
||||||
|
|
||||||
def on_current_program_scene_changed(self, data):
|
def on_current_program_scene_changed(self, data):
|
||||||
scene = data.scene_name
|
scene = data.scene_name
|
||||||
@ -28,11 +35,9 @@ class Observer:
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
with xair_api.connect("MR18", ip="mixer.local") as mixer:
|
with xair_api.connect("MR18", ip="mixer.local") as mixer:
|
||||||
Observer(mixer)
|
with Observer(mixer):
|
||||||
|
while _ := input("Press <Enter> to exit\n"):
|
||||||
while cmd := input("<Enter> to exit\n"):
|
pass
|
||||||
if not cmd:
|
|
||||||
break
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "xair-api"
|
name = "xair-api"
|
||||||
version = "2.2.3"
|
version = "2.2.4a0"
|
||||||
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"
|
||||||
@ -24,5 +24,6 @@ build-backend = "poetry.core.masonry.api"
|
|||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
obs = "scripts:ex_obs"
|
obs = "scripts:ex_obs"
|
||||||
|
sends = "scripts:ex_sends"
|
||||||
xair = "scripts:test_xair"
|
xair = "scripts:test_xair"
|
||||||
x32 = "scripts:test_x32"
|
x32 = "scripts:test_x32"
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
def ex_obs():
|
def ex_obs():
|
||||||
path = Path.cwd() / "examples" / "xair_obs" / "."
|
path = Path.cwd() / "examples" / "xair_obs" / "."
|
||||||
subprocess.run(["py", str(path)])
|
subprocess.run([sys.executable, str(path)])
|
||||||
|
|
||||||
|
|
||||||
|
def ex_sends():
|
||||||
|
path = Path.cwd() / "examples" / "sends" / "."
|
||||||
|
subprocess.run([sys.executable, str(path)])
|
||||||
|
|
||||||
|
|
||||||
def test_xair():
|
def test_xair():
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import abc
|
import abc
|
||||||
|
|
||||||
from . import kinds
|
from . import kinds, util
|
||||||
from .errors import XAirRemoteError
|
from .errors import XAirRemoteError
|
||||||
from .meta import bool_prop
|
from .meta import bool_prop
|
||||||
from .util import _get_level_val, _set_level_val, lin_get, lin_set
|
|
||||||
|
|
||||||
|
|
||||||
class IConfig(abc.ABC):
|
class IConfig(abc.ABC):
|
||||||
@ -91,13 +90,14 @@ class Config(IConfig):
|
|||||||
return f"{root}/solo"
|
return f"{root}/solo"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@util.db_from
|
||||||
def level(self) -> float:
|
def level(self) -> float:
|
||||||
retval = self.getter("level")[0]
|
return self.getter("level")[0]
|
||||||
return _get_level_val(retval)
|
|
||||||
|
|
||||||
@level.setter
|
@level.setter
|
||||||
|
@util.db_to
|
||||||
def level(self, val: float):
|
def level(self, val: float):
|
||||||
_set_level_val(self, val)
|
self.setter("level", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def source(self) -> int:
|
def source(self) -> int:
|
||||||
@ -109,13 +109,13 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def sourcetrim(self) -> float:
|
def sourcetrim(self) -> float:
|
||||||
return round(lin_get(-18, 18, self.getter("sourcetrim")[0]), 1)
|
return round(util.lin_get(-18, 18, self.getter("sourcetrim")[0]), 1)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range -18.0 to 18.0")
|
||||||
self.setter("sourcetrim", lin_set(-18, 18, val))
|
self.setter("sourcetrim", util.lin_set(-18, 18, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def chmode(self) -> bool:
|
def chmode(self) -> bool:
|
||||||
@ -135,13 +135,13 @@ class Config(IConfig):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def dimgain(self) -> int:
|
def dimgain(self) -> int:
|
||||||
return int(lin_get(-40, 0, self.getter("dimatt")[0]))
|
return int(util.lin_get(-40, 0, self.getter("dimatt")[0]))
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range -40 to 0")
|
||||||
self.setter("dimatt", lin_set(-40, 0, val))
|
self.setter("dimatt", util.lin_set(-40, 0, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dim(self) -> bool:
|
def dim(self) -> bool:
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
class XAirRemoteError(Exception):
|
class XAirRemoteError(Exception):
|
||||||
"""Base error class for XAIR Remote."""
|
"""Base error class for XAIR Remote."""
|
||||||
|
|
||||||
pass
|
|
||||||
|
@ -7,7 +7,7 @@ from .shared import EQ, GEQ, Automix, Config, Dyn, Gate, Group, Insert, Mix, Pre
|
|||||||
|
|
||||||
|
|
||||||
class ILR(abc.ABC):
|
class ILR(abc.ABC):
|
||||||
"""Abstract Base Class for buses"""
|
"""Abstract Base Class for lr"""
|
||||||
|
|
||||||
def __init__(self, remote, index: Optional[int] = None):
|
def __init__(self, remote, index: Optional[int] = None):
|
||||||
self._remote = remote
|
self._remote = remote
|
||||||
@ -26,7 +26,7 @@ class ILR(abc.ABC):
|
|||||||
|
|
||||||
|
|
||||||
class LR(ILR):
|
class LR(ILR):
|
||||||
"""Concrete class for buses"""
|
"""Concrete class for lr"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def make(cls, remote, index=None):
|
def make(cls, remote, index=None):
|
||||||
|
@ -3,11 +3,23 @@ from typing import Optional
|
|||||||
|
|
||||||
from .errors import XAirRemoteError
|
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,
|
||||||
|
Automix,
|
||||||
|
Config,
|
||||||
|
Dyn,
|
||||||
|
Gate,
|
||||||
|
Group,
|
||||||
|
Insert,
|
||||||
|
Mix,
|
||||||
|
Preamp,
|
||||||
|
Send,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class IRtn(abc.ABC):
|
class IRtn(abc.ABC):
|
||||||
"""Abstract Base Class for aux"""
|
"""Abstract Base Class for rtn"""
|
||||||
|
|
||||||
def __init__(self, remote, index: Optional[int] = None):
|
def __init__(self, remote, index: Optional[int] = None):
|
||||||
self._remote = remote
|
self._remote = remote
|
||||||
@ -26,13 +38,15 @@ class IRtn(abc.ABC):
|
|||||||
|
|
||||||
|
|
||||||
class AuxRtn(IRtn):
|
class AuxRtn(IRtn):
|
||||||
"""Concrete class for aux"""
|
"""Concrete class for auxrtn"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def make(cls, remote, index=None):
|
def make(cls, remote, index=None):
|
||||||
"""
|
"""
|
||||||
Factory function for auxrtn
|
Factory function for auxrtn
|
||||||
|
|
||||||
Creates a mixin of shared subclasses, sets them as class attributes.
|
Creates a mixin of shared subclasses, sets them as class attributes.
|
||||||
|
|
||||||
Returns an AuxRtn class of a kind.
|
Returns an AuxRtn class of a kind.
|
||||||
"""
|
"""
|
||||||
AUXRTN_cls = type(
|
AUXRTN_cls = type(
|
||||||
@ -51,6 +65,10 @@ class AuxRtn(IRtn):
|
|||||||
Group,
|
Group,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
"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(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -62,13 +80,15 @@ class AuxRtn(IRtn):
|
|||||||
|
|
||||||
|
|
||||||
class FxRtn(IRtn):
|
class FxRtn(IRtn):
|
||||||
"""Concrete class for rtn"""
|
"""Concrete class for fxrtn"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def make(cls, remote, index):
|
def make(cls, remote, index):
|
||||||
"""
|
"""
|
||||||
Factory function for fxrtn
|
Factory function for fxrtn
|
||||||
|
|
||||||
Creates a mixin of shared subclasses, sets them as class attributes.
|
Creates a mixin of shared subclasses, sets them as class attributes.
|
||||||
|
|
||||||
Returns an FxRtn class of a kind.
|
Returns an FxRtn class of a kind.
|
||||||
"""
|
"""
|
||||||
FXRTN_cls = type(
|
FXRTN_cls = type(
|
||||||
@ -87,6 +107,10 @@ class FxRtn(IRtn):
|
|||||||
Group,
|
Group,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
"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(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
from typing import Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
|
from . import util
|
||||||
from .errors import XAirRemoteError
|
from .errors import XAirRemoteError
|
||||||
from .meta import geq_prop
|
from .meta import geq_prop
|
||||||
from .util import _get_fader_val, _set_fader_val, lin_get, lin_set, log_get, log_set
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Classes shared by /ch, /rtn, /rtn/aux, /bus, /fxsend, /lr
|
Classes shared by /ch, /rtn, /rtn/aux, /bus, /fxsend, /lr
|
||||||
@ -56,13 +56,13 @@ class Preamp:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def usbtrim(self) -> float:
|
def usbtrim(self) -> float:
|
||||||
return round(lin_get(-18, 18, self.getter("rtntrim")[0]), 1)
|
return round(util.lin_get(-18, 18, self.getter("rtntrim")[0]), 1)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range -18.0 to 18.0")
|
||||||
self.setter("rtntrim", lin_set(-18, 18, val))
|
self.setter("rtntrim", util.lin_set(-18, 18, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def usbinput(self) -> bool:
|
def usbinput(self) -> bool:
|
||||||
@ -90,13 +90,13 @@ class Preamp:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def highpassfilter(self) -> int:
|
def highpassfilter(self) -> int:
|
||||||
return int(log_get(20, 400, self.getter("hpf")[0]))
|
return int(util.log_get(20, 400, self.getter("hpf")[0]))
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 20 to 400")
|
||||||
self.setter("hpf", log_set(20, 400, val))
|
self.setter("hpf", util.log_set(20, 400, val))
|
||||||
|
|
||||||
|
|
||||||
class Gate:
|
class Gate:
|
||||||
@ -127,54 +127,54 @@ class Gate:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def threshold(self) -> float:
|
def threshold(self) -> float:
|
||||||
return round(lin_get(-80, 0, self.getter("thr")[0]), 1)
|
return round(util.lin_get(-80, 0, self.getter("thr")[0]), 1)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range -80.0 to 0.0")
|
||||||
self.setter("thr", lin_set(-80, 0, val))
|
self.setter("thr", util.lin_set(-80, 0, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def range(self) -> int:
|
def range(self) -> int:
|
||||||
return int(lin_get(3, 60, self.getter("range")[0]))
|
return int(util.lin_get(3, 60, self.getter("range")[0]))
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 3 to 60")
|
||||||
self.setter("range", lin_set(3, 60, val))
|
self.setter("range", util.lin_set(3, 60, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def attack(self) -> int:
|
def attack(self) -> int:
|
||||||
return int(lin_get(0, 120, self.getter("attack")[0]))
|
return int(util.lin_get(0, 120, self.getter("attack")[0]))
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 0 to 120")
|
||||||
self.setter("attack", lin_set(0, 120, val))
|
self.setter("attack", util.lin_set(0, 120, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hold(self) -> Union[float, int]:
|
def hold(self) -> Union[float, int]:
|
||||||
val = 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)
|
return round(val, 1) if val < 100 else int(val)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 0.02 to 2000.0")
|
||||||
self.setter("hold", log_set(0.02, 2000, val))
|
self.setter("hold", util.log_set(0.02, 2000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def release(self) -> int:
|
def release(self) -> int:
|
||||||
return int(log_get(5, 4000, self.getter("release")[0]))
|
return int(util.log_get(5, 4000, self.getter("release")[0]))
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 5 to 4000")
|
||||||
self.setter("release", log_set(5, 4000, val))
|
self.setter("release", util.log_set(5, 4000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def keysource(self):
|
def keysource(self):
|
||||||
@ -202,14 +202,14 @@ class Gate:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def filterfreq(self) -> Union[float, int]:
|
def filterfreq(self) -> Union[float, int]:
|
||||||
retval = 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)
|
return int(retval) if retval > 1000 else round(retval, 1)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 20 to 20000")
|
||||||
self.setter("filter/f", log_set(20, 20000, val))
|
self.setter("filter/f", util.log_set(20, 20000, val))
|
||||||
|
|
||||||
|
|
||||||
class Dyn:
|
class Dyn:
|
||||||
@ -264,13 +264,13 @@ class Dyn:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def threshold(self) -> float:
|
def threshold(self) -> float:
|
||||||
return round(lin_get(-60, 0, self.getter("thr")[0]), 1)
|
return round(util.lin_get(-60, 0, self.getter("thr")[0]), 1)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range -60.0 to 0")
|
||||||
self.setter("thr", lin_set(-60, 0, val))
|
self.setter("thr", util.lin_set(-60, 0, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ratio(self) -> Union[float, int]:
|
def ratio(self) -> Union[float, int]:
|
||||||
@ -283,64 +283,64 @@ class Dyn:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def knee(self) -> int:
|
def knee(self) -> int:
|
||||||
return int(lin_get(0, 5, self.getter("knee")[0]))
|
return int(util.lin_get(0, 5, self.getter("knee")[0]))
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 0 to 5")
|
||||||
self.setter("knee", lin_set(0, 5, val))
|
self.setter("knee", util.lin_set(0, 5, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mgain(self) -> float:
|
def mgain(self) -> float:
|
||||||
return round(lin_get(0, 24, self.getter("mgain")[0]), 1)
|
return round(util.lin_get(0, 24, self.getter("mgain")[0]), 1)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 0.0 to 24.0")
|
||||||
self.setter("mgain", lin_set(0, 24, val))
|
self.setter("mgain", util.lin_set(0, 24, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def attack(self) -> int:
|
def attack(self) -> int:
|
||||||
return int(lin_get(0, 120, self.getter("attack")[0]))
|
return int(util.lin_get(0, 120, self.getter("attack")[0]))
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 0 to 120")
|
||||||
self.setter("attack", lin_set(0, 120, val))
|
self.setter("attack", util.lin_set(0, 120, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hold(self) -> Union[float, int]:
|
def hold(self) -> Union[float, int]:
|
||||||
val = 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)
|
return round(val, 1) if val < 100 else int(val)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 0.02 to 2000.0")
|
||||||
self.setter("hold", log_set(0.02, 2000, val))
|
self.setter("hold", util.log_set(0.02, 2000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def release(self) -> int:
|
def release(self) -> int:
|
||||||
return int(log_get(5, 4000, self.getter("release")[0]))
|
return int(util.log_get(5, 4000, self.getter("release")[0]))
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 5 to 4000")
|
||||||
self.setter("release", log_set(5, 4000, val))
|
self.setter("release", util.log_set(5, 4000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mix(self) -> int:
|
def mix(self) -> int:
|
||||||
return int(lin_get(0, 100, self.getter("mix")[0]))
|
return int(util.lin_get(0, 100, self.getter("mix")[0]))
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 0 to 100")
|
||||||
self.setter("mix", lin_set(0, 100, val))
|
self.setter("mix", util.lin_set(0, 100, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def keysource(self):
|
def keysource(self):
|
||||||
@ -376,14 +376,14 @@ class Dyn:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def filterfreq(self) -> Union[float, int]:
|
def filterfreq(self) -> Union[float, int]:
|
||||||
retval = 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)
|
return int(retval) if retval > 1000 else round(retval, 1)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 20 to 20000")
|
||||||
self.setter("filter/f", log_set(20, 20000, val))
|
self.setter("filter/f", util.log_set(20, 20000, val))
|
||||||
|
|
||||||
|
|
||||||
class Insert:
|
class Insert:
|
||||||
@ -467,10 +467,7 @@ class EQ:
|
|||||||
|
|
||||||
class EQBand:
|
class EQBand:
|
||||||
def __init__(self, i, remote, index):
|
def __init__(self, i, remote, index):
|
||||||
if index is None:
|
super(EQ.EQBand, self).__init__(remote, index)
|
||||||
super(EQ.EQBand, self).__init__(remote)
|
|
||||||
else:
|
|
||||||
super(EQ.EQBand, self).__init__(remote, index)
|
|
||||||
self.i = i
|
self.i = i
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -488,35 +485,35 @@ class EQ:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def frequency(self) -> float:
|
def frequency(self) -> float:
|
||||||
retval = log_get(20, 20000, self.getter("f")[0])
|
retval = util.log_get(20, 20000, self.getter("f")[0])
|
||||||
return round(retval, 1)
|
return round(retval, 1)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 20.0 to 20000.0")
|
||||||
self.setter("f", log_set(20, 20000, val))
|
self.setter("f", util.log_set(20, 20000, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gain(self) -> float:
|
def gain(self) -> float:
|
||||||
return round(lin_get(-15, 15, self.getter("g")[0]), 1)
|
return round(util.lin_get(-15, 15, self.getter("g")[0]), 1)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range -15.0 to 15.0")
|
||||||
self.setter("g", lin_set(-15, 15, val))
|
self.setter("g", util.lin_set(-15, 15, val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def quality(self) -> float:
|
def quality(self) -> float:
|
||||||
retval = log_get(0.3, 10, self.getter("q")[0])
|
retval = util.log_get(0.3, 10, self.getter("q")[0])
|
||||||
return round(retval, 1)
|
return round(retval, 1)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range 0.3 to 10.0")
|
||||||
self.setter("q", log_set(0.3, 10, val))
|
self.setter("q", util.log_set(0.3, 10, val))
|
||||||
|
|
||||||
|
|
||||||
class GEQ:
|
class GEQ:
|
||||||
@ -561,13 +558,14 @@ class Mix:
|
|||||||
self.setter("on", 1 if val else 0)
|
self.setter("on", 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@util.db_from
|
||||||
def fader(self) -> float:
|
def fader(self) -> float:
|
||||||
retval = self.getter("fader")[0]
|
return self.getter("fader")[0]
|
||||||
return _get_fader_val(retval)
|
|
||||||
|
|
||||||
@fader.setter
|
@fader.setter
|
||||||
|
@util.db_to
|
||||||
def fader(self, val: float):
|
def fader(self, val: float):
|
||||||
_set_fader_val(self, val)
|
self.setter("fader", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def lr(self) -> bool:
|
def lr(self) -> bool:
|
||||||
@ -617,10 +615,36 @@ class Automix:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def weight(self) -> float:
|
def weight(self) -> float:
|
||||||
return round(lin_get(-12, 12, self.getter("weight")[0]), 1)
|
return round(util.lin_get(-12, 12, self.getter("weight")[0]), 1)
|
||||||
|
|
||||||
@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")
|
raise XAirRemoteError("expected value in range -12.0 to 12.0")
|
||||||
self.setter("weight", lin_set(-12, 12, val))
|
self.setter("weight", util.lin_set(-12, 12, val))
|
||||||
|
|
||||||
|
|
||||||
|
class Send:
|
||||||
|
def __init__(self, i, remote, index: Optional[int] = None):
|
||||||
|
super(Send, self).__init__(remote, index)
|
||||||
|
self.i = i + 1
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def make(cls, _cls, i, remote, index=None):
|
||||||
|
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)}"
|
||||||
|
|
||||||
|
@property
|
||||||
|
@util.db_from
|
||||||
|
def level(self):
|
||||||
|
return self.getter("level")[0]
|
||||||
|
|
||||||
|
@level.setter
|
||||||
|
@util.db_to
|
||||||
|
def level(self, val):
|
||||||
|
self.setter("level", val)
|
||||||
|
@ -2,7 +2,19 @@ import abc
|
|||||||
|
|
||||||
from .errors import XAirRemoteError
|
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,
|
||||||
|
Automix,
|
||||||
|
Config,
|
||||||
|
Dyn,
|
||||||
|
Gate,
|
||||||
|
Group,
|
||||||
|
Insert,
|
||||||
|
Mix,
|
||||||
|
Preamp,
|
||||||
|
Send,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class IStrip(abc.ABC):
|
class IStrip(abc.ABC):
|
||||||
@ -56,6 +68,10 @@ class Strip(IStrip):
|
|||||||
Automix,
|
Automix,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
"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(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import functools
|
||||||
from math import exp, log
|
from math import exp, log
|
||||||
|
|
||||||
|
|
||||||
@ -17,61 +18,48 @@ def log_set(min, max, val):
|
|||||||
return log(val / min) / log(max / min)
|
return log(val / min) / log(max / min)
|
||||||
|
|
||||||
|
|
||||||
def _get_fader_val(retval):
|
def db_from(func):
|
||||||
if retval >= 1:
|
"""fader|level converter for getters"""
|
||||||
return 10
|
|
||||||
elif retval >= 0.5:
|
@functools.wraps(func)
|
||||||
return round((40 * retval) - 30, 1)
|
def wrapper(*args, **kwargs):
|
||||||
elif retval >= 0.25:
|
retval = func(*args, **kwargs)
|
||||||
return round((80 * retval) - 50, 1)
|
|
||||||
elif retval >= 0.0625:
|
if retval >= 1:
|
||||||
return round((160 * retval) - 70, 1)
|
return 10
|
||||||
elif retval >= 0:
|
elif retval >= 0.5:
|
||||||
return round((480 * retval) - 90, 1)
|
return round((40 * retval) - 30, 1)
|
||||||
else:
|
elif retval >= 0.25:
|
||||||
return -90
|
return round((80 * retval) - 50, 1)
|
||||||
|
elif retval >= 0.0625:
|
||||||
|
return round((160 * retval) - 70, 1)
|
||||||
|
elif retval >= 0:
|
||||||
|
return round((480 * retval) - 90, 1)
|
||||||
|
else:
|
||||||
|
return -90
|
||||||
|
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
def _set_fader_val(self, val):
|
def db_to(func):
|
||||||
if val >= 10:
|
"""fader|level converter for setters"""
|
||||||
self.setter("fader", 1)
|
|
||||||
elif val >= -10:
|
|
||||||
self.setter("fader", (val + 30) / 40)
|
|
||||||
elif val >= -30:
|
|
||||||
self.setter("fader", (val + 50) / 80)
|
|
||||||
elif val >= -60:
|
|
||||||
self.setter("fader", (val + 70) / 160)
|
|
||||||
elif val >= -90:
|
|
||||||
self.setter("fader", (val + 90) / 480)
|
|
||||||
else:
|
|
||||||
self.setter("fader", 0)
|
|
||||||
|
|
||||||
|
@functools.wraps(func)
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
|
param, val = args
|
||||||
|
if val >= 10:
|
||||||
|
val = 1
|
||||||
|
elif val >= -10:
|
||||||
|
val = (val + 30) / 40
|
||||||
|
elif val >= -30:
|
||||||
|
val = (val + 50) / 80
|
||||||
|
elif val >= -60:
|
||||||
|
val = (val + 70) / 160
|
||||||
|
elif val >= -90:
|
||||||
|
val = (val + 90) / 480
|
||||||
|
else:
|
||||||
|
val = 0
|
||||||
|
|
||||||
def _get_level_val(retval):
|
func(param, val, **kwargs)
|
||||||
if retval >= 1:
|
|
||||||
return 10
|
|
||||||
elif retval >= 0.5:
|
|
||||||
return round((40 * retval) - 30, 1)
|
|
||||||
elif retval >= 0.25:
|
|
||||||
return round((80 * retval) - 50, 1)
|
|
||||||
elif retval >= 0.0625:
|
|
||||||
return round((160 * retval) - 70, 1)
|
|
||||||
elif retval >= 0:
|
|
||||||
return round((480 * retval) - 90, 1)
|
|
||||||
else:
|
|
||||||
return -90
|
|
||||||
|
|
||||||
|
return wrapper
|
||||||
def _set_level_val(self, val):
|
|
||||||
if val >= 10:
|
|
||||||
self.setter("level", 1)
|
|
||||||
elif val >= -10:
|
|
||||||
self.setter("level", (val + 30) / 40)
|
|
||||||
elif val >= -30:
|
|
||||||
self.setter("level", (val + 50) / 80)
|
|
||||||
elif val >= -60:
|
|
||||||
self.setter("level", (val + 70) / 160)
|
|
||||||
elif val >= -90:
|
|
||||||
self.setter("level", (val + 90) / 480)
|
|
||||||
else:
|
|
||||||
self.setter("level", 0)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user