mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2026-04-06 23:43:30 +00:00
Compare commits
45 Commits
add-bits-k
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 48614ab5fa | |||
|
|
99350f2c63 | ||
| 2a7a1c5d2a | |||
|
|
f0664f9cfb | ||
| e395e7a373 | |||
| 842feb2407 | |||
| 84b4426e44 | |||
| 0396892530 | |||
| 919dc0d325 | |||
| 0a81c458e2 | |||
| 9903ecca72 | |||
| 00ac5b1428 | |||
| 3d56ba99b6 | |||
| 58ec875521 | |||
| 4c6ec6d989 | |||
| feb6ee5821 | |||
| 15f0fcda69 | |||
| 738688a8a7 | |||
| 1509afd4f5 | |||
| 7232ba6248 | |||
| 1ff2017d51 | |||
|
|
fe1f4ee324 | ||
| 4953751c02 | |||
|
|
abbbf57982 | ||
| 714d2fc972 | |||
| c797912458 | |||
|
|
f702b4feb3 | ||
|
|
f8f10e358f | ||
| f7abc5248b | |||
| fec4315be2 | |||
| a3e3db3c37 | |||
| 3e201443e0 | |||
| 868017c79f | |||
| 795296d71e | |||
| e21a458c6f | |||
| b79d9494a2 | |||
| 328bea347c | |||
| 38bd284ba6 | |||
| da1d5132a8 | |||
| 7b725a51e3 | |||
| cf7301712c | |||
| a6f52be9ac | |||
| 01633f06da | |||
| 79a0c93466 | |||
| c1b2a543cc |
53
.github/workflows/publish.yml
vendored
Normal file
53
.github/workflows/publish.yml
vendored
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
name: Publish to PyPI
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*.*.*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
|
||||||
|
- name: Install Poetry
|
||||||
|
run: |
|
||||||
|
pip install poetry==2.3.1
|
||||||
|
poetry --version
|
||||||
|
|
||||||
|
- name: Build package
|
||||||
|
run: |
|
||||||
|
poetry install --only-root
|
||||||
|
poetry build
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: ./dist
|
||||||
|
|
||||||
|
pypi-publish:
|
||||||
|
needs: build
|
||||||
|
name: Upload release to PyPI
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment:
|
||||||
|
name: pypi
|
||||||
|
url: https://pypi.org/project/voicemeeter-api/
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: ./dist
|
||||||
|
|
||||||
|
- name: Publish package distributions to PyPI
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
with:
|
||||||
|
packages-dir: ./dist
|
||||||
19
.github/workflows/ruff.yml
vendored
Normal file
19
.github/workflows/ruff.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
name: Ruff
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ruff:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: astral-sh/ruff-action@v3
|
||||||
|
with:
|
||||||
|
args: 'format --check --diff'
|
||||||
14
.gitignore
vendored
14
.gitignore
vendored
@@ -128,10 +128,12 @@ dmypy.json
|
|||||||
# Pyre type checker
|
# Pyre type checker
|
||||||
.pyre/
|
.pyre/
|
||||||
|
|
||||||
# test/config
|
# test reports
|
||||||
quick.py
|
tests/reports/
|
||||||
config.toml
|
!tests/reports/badge-*.svg
|
||||||
vm-api.log
|
|
||||||
logging.json
|
|
||||||
|
|
||||||
.vscode/
|
# test/config
|
||||||
|
test-*.py
|
||||||
|
config.toml
|
||||||
|
|
||||||
|
.vscode/
|
||||||
|
|||||||
13
.pre-commit-config.yaml
Normal file
13
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v2.3.0
|
||||||
|
hooks:
|
||||||
|
- id: check-yaml
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: trailing-whitespace
|
||||||
|
|
||||||
|
- repo: https://github.com/python-poetry/poetry
|
||||||
|
rev: '2.3.2'
|
||||||
|
hooks:
|
||||||
|
- id: poetry-check
|
||||||
|
- id: poetry-lock
|
||||||
12
CHANGELOG.md
12
CHANGELOG.md
@@ -11,11 +11,21 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass
|
|||||||
|
|
||||||
- [x]
|
- [x]
|
||||||
|
|
||||||
|
## [2.7.1] - 2025-06-15
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Strip.EQ Channel Cell commands added, see [Strip.EQ.Channel.Cell](https://github.com/onyx-and-iris/voicemeeter-api-python?tab=readme-ov-file#stripeqchannelcell)
|
||||||
|
- They are only available for potato version.
|
||||||
|
|
||||||
|
- Bus.EQ Channel Cell commands added, see [Bus.EQ.Channel.Cell](https://github.com/onyx-and-iris/voicemeeter-api-python?tab=readme-ov-file#buseqchannelcell).
|
||||||
|
- Added by [PR #16](https://github.com/onyx-and-iris/voicemeeter-api-python/pull/16)
|
||||||
|
|
||||||
## [2.6.0] - 2024-06-29
|
## [2.6.0] - 2024-06-29
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- bits kwarg for overriding the type of GUI that is launched on startup.
|
- bits kwarg for overriding the type of GUI that is launched on startup.
|
||||||
- Defaults to 64, set it to either 32 or 64.
|
- Defaults to 64, set it to either 32 or 64.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
117
README.md
117
README.md
@@ -1,12 +1,10 @@
|
|||||||
[](https://badge.fury.io/py/voicemeeter-api)
|
[](https://badge.fury.io/py/voicemeeter-api)
|
||||||
[](https://github.com/onyx-and-iris/voicemeeter-api-python/blob/dev/LICENSE)
|
[](https://github.com/onyx-and-iris/voicemeeter-api-python/blob/dev/LICENSE)
|
||||||
[](https://python-poetry.org/)
|
[](https://python-poetry.org/)
|
||||||
[](https://github.com/psf/black)
|
|
||||||
[](https://pycqa.github.io/isort/)
|
|
||||||
[](https://github.com/astral-sh/ruff)
|
[](https://github.com/astral-sh/ruff)
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
# Python Wrapper for Voicemeeter API
|
# Python Wrapper for Voicemeeter API
|
||||||
|
|
||||||
@@ -16,9 +14,9 @@ For an outline of past/future changes refer to: [CHANGELOG](CHANGELOG.md)
|
|||||||
|
|
||||||
## Tested against
|
## Tested against
|
||||||
|
|
||||||
- Basic 1.1.1.1
|
- Basic 1.1.2.2
|
||||||
- Banana 2.1.1.1
|
- Banana 2.1.2.2
|
||||||
- Potato 3.1.1.1
|
- Potato 3.1.2.2
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@@ -46,24 +44,24 @@ class ManyThings:
|
|||||||
self.vm = vm
|
self.vm = vm
|
||||||
|
|
||||||
def things(self):
|
def things(self):
|
||||||
self.vm.strip[0].label = "podmic"
|
self.vm.strip[0].label = 'podmic'
|
||||||
self.vm.strip[0].mute = True
|
self.vm.strip[0].mute = True
|
||||||
print(
|
print(
|
||||||
f"strip 0 ({self.vm.strip[0].label}) mute has been set to {self.vm.strip[0].mute}"
|
f'strip 0 ({self.vm.strip[0].label}) mute has been set to {self.vm.strip[0].mute}'
|
||||||
)
|
)
|
||||||
|
|
||||||
def other_things(self):
|
def other_things(self):
|
||||||
self.vm.bus[3].gain = -6.3
|
self.vm.bus[3].gain = -6.3
|
||||||
self.vm.bus[4].eq.on = True
|
self.vm.bus[4].eq.on = True
|
||||||
info = (
|
info = (
|
||||||
f"bus 3 gain has been set to {self.vm.bus[3].gain}",
|
f'bus 3 gain has been set to {self.vm.bus[3].gain}',
|
||||||
f"bus 4 eq has been set to {self.vm.bus[4].eq.on}",
|
f'bus 4 eq has been set to {self.vm.bus[4].eq.on}',
|
||||||
)
|
)
|
||||||
print("\n".join(info))
|
print('\n'.join(info))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
KIND_ID = "banana"
|
KIND_ID = 'banana'
|
||||||
|
|
||||||
with voicemeeterlib.api(KIND_ID) as vm:
|
with voicemeeterlib.api(KIND_ID) as vm:
|
||||||
do = ManyThings(vm)
|
do = ManyThings(vm)
|
||||||
@@ -73,18 +71,17 @@ def main():
|
|||||||
# set many parameters at once
|
# set many parameters at once
|
||||||
vm.apply(
|
vm.apply(
|
||||||
{
|
{
|
||||||
"strip-2": {"A1": True, "B1": True, "gain": -6.0},
|
'strip-2': {'A1': True, 'B1': True, 'gain': -6.0},
|
||||||
"bus-2": {"mute": True, "eq": {"on": True}},
|
'bus-2': {'mute': True, 'eq': {'on': True}},
|
||||||
"button-0": {"state": True},
|
'button-0': {'state': True},
|
||||||
"vban-in-0": {"on": True},
|
'vban-in-0': {'on': True},
|
||||||
"vban-out-1": {"name": "streamname"},
|
'vban-out-1': {'name': 'streamname'},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Otherwise you must remember to call `vm.login()`, `vm.logout()` at the start/end of your code.
|
Otherwise you must remember to call `vm.login()`, `vm.logout()` at the start/end of your code.
|
||||||
@@ -151,8 +148,8 @@ Set mute state as value for the app matching name.
|
|||||||
example:
|
example:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
vm.strip[5].appmute("Spotify", True)
|
vm.strip[5].appmute('Spotify', True)
|
||||||
vm.strip[5].appgain("Spotify", 0.5)
|
vm.strip[5].appgain('Spotify', 0.5)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Strip.Comp
|
#### Strip.Comp
|
||||||
@@ -228,6 +225,24 @@ example:
|
|||||||
vm.strip[0].eq.ab = True
|
vm.strip[0].eq.ab = True
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### Strip.EQ.Channel.Cell
|
||||||
|
|
||||||
|
The following properties are available.
|
||||||
|
|
||||||
|
- `on`: boolean
|
||||||
|
- `type`: int, from 0 up to 6
|
||||||
|
- `f`: float, from 20.0 up to 20_000.0
|
||||||
|
- `gain`: float, from -36.0 up to 18.0
|
||||||
|
- currently there is a bug with the remote API, only values -12 up to +12 are settable, this will be fixed in an upcoming patch.
|
||||||
|
- `q`: float, from 0.3 up to 100
|
||||||
|
|
||||||
|
example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
vm.strip[0].eq.channel[0].cell[2].on = True
|
||||||
|
vm.strip[1].eq.channel[0].cell[2].f = 5000
|
||||||
|
```
|
||||||
|
|
||||||
Strip EQ parameters are defined for PhysicalStrips, potato version only.
|
Strip EQ parameters are defined for PhysicalStrips, potato version only.
|
||||||
|
|
||||||
##### Strip.Gainlayers
|
##### Strip.Gainlayers
|
||||||
@@ -262,7 +277,7 @@ Level properties will return -200.0 if no audio detected.
|
|||||||
|
|
||||||
The following properties are available.
|
The following properties are available.
|
||||||
|
|
||||||
- `mono`: boolean
|
- `mono`: int, from 0 up to 2
|
||||||
- `mute`: boolean
|
- `mute`: boolean
|
||||||
- `sel`: boolean
|
- `sel`: boolean
|
||||||
- `gain`: float, from -60.0 to 12.0
|
- `gain`: float, from -60.0 to 12.0
|
||||||
@@ -279,7 +294,7 @@ example:
|
|||||||
vm.bus[3].gain = 3.7
|
vm.bus[3].gain = 3.7
|
||||||
print(vm.bus[0].label)
|
print(vm.bus[0].label)
|
||||||
|
|
||||||
vm.bus[4].mono = True
|
vm.bus[4].mono = 2
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Bus.EQ
|
##### Bus.EQ
|
||||||
@@ -295,6 +310,24 @@ example:
|
|||||||
vm.bus[3].eq.on = True
|
vm.bus[3].eq.on = True
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### Bus.EQ.Channel.Cell
|
||||||
|
|
||||||
|
The following properties are available.
|
||||||
|
|
||||||
|
- `on`: boolean
|
||||||
|
- `type`: int, from 0 up to 6
|
||||||
|
- `f`: float, from 20.0 up to 20_000.0
|
||||||
|
- `gain`: float, from -36.0 up to 18.0
|
||||||
|
- currently there is a bug with the remote API, only values -12 up to +12 are settable, this will be fixed in an upcoming patch.
|
||||||
|
- `q`: float, from 0.3 up to 100.0
|
||||||
|
|
||||||
|
example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
vm.bus[3].eq.channel[0].cell[2].on = True
|
||||||
|
vm.bus[3].eq.channel[0].cell[2].f = 5000
|
||||||
|
```
|
||||||
|
|
||||||
##### Bus.Modes
|
##### Bus.Modes
|
||||||
|
|
||||||
The following properties are available.
|
The following properties are available.
|
||||||
@@ -368,7 +401,7 @@ example:
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
print(vm.strip[0].device.name)
|
print(vm.strip[0].device.name)
|
||||||
vm.bus[0].device.asio = "Audient USB Audio ASIO Driver"
|
vm.bus[0].device.asio = 'Audient USB Audio ASIO Driver'
|
||||||
```
|
```
|
||||||
|
|
||||||
strip|bus device parameters are defined for physical channels only.
|
strip|bus device parameters are defined for physical channels only.
|
||||||
@@ -427,7 +460,7 @@ vm.recorder.B2 = False
|
|||||||
vm.recorder.load(r'C:\music\mytune.mp3')
|
vm.recorder.load(r'C:\music\mytune.mp3')
|
||||||
|
|
||||||
# set the goto time to 1m 30s
|
# set the goto time to 1m 30s
|
||||||
vm.recorder.goto("00:01:30")
|
vm.recorder.goto('00:01:30')
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Recorder.Mode
|
#### Recorder.Mode
|
||||||
@@ -681,11 +714,11 @@ get() may return None if no value for requested key in midi cache
|
|||||||
```python
|
```python
|
||||||
vm.apply(
|
vm.apply(
|
||||||
{
|
{
|
||||||
"strip-2": {"A1": True, "B1": True, "gain": -6.0},
|
'strip-2': {'A1': True, 'B1': True, 'gain': -6.0},
|
||||||
"bus-2": {"mute": True, "eq": {"on": True}},
|
'bus-2': {'mute': True, 'eq': {'on': True}},
|
||||||
"button-0": {"state": True},
|
'button-0': {'state': True},
|
||||||
"vban-in-0": {"on": True},
|
'vban-in-0': {'on': True},
|
||||||
"vban-out-1": {"name": "streamname"},
|
'vban-out-1': {'name': 'streamname'},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
@@ -693,8 +726,8 @@ vm.apply(
|
|||||||
Or for each class you may do:
|
Or for each class you may do:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
vm.strip[0].apply({"mute": True, "gain": 3.2, "A1": True})
|
vm.strip[0].apply({'mute': True, 'gain': 3.2, 'A1': True})
|
||||||
vm.vban.outstream[0].apply({"on": True, "name": "streamname", "bit": 24})
|
vm.vban.outstream[0].apply({'on': True, 'name': 'streamname', 'bit': 24})
|
||||||
```
|
```
|
||||||
|
|
||||||
## Config Files
|
## Config Files
|
||||||
@@ -795,7 +828,7 @@ The following methods are available:
|
|||||||
example:
|
example:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
vm.event.remove(["pdirty", "mdirty", "midi"])
|
vm.event.remove(['pdirty', 'mdirty', 'midi'])
|
||||||
|
|
||||||
# get a list of currently subscribed
|
# get a list of currently subscribed
|
||||||
print(vm.event.get())
|
print(vm.event.get())
|
||||||
@@ -865,17 +898,19 @@ import voicemeeterlib
|
|||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
with voicemeeterlib.api("banana") as vm:
|
with voicemeeterlib.api('banana') as vm:
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Run tests
|
### Run tests
|
||||||
|
|
||||||
To run all tests:
|
Install [poetry](https://python-poetry.org/docs/#installation) and then:
|
||||||
|
|
||||||
```
|
```powershell
|
||||||
pytest -v
|
poetry poe test-basic
|
||||||
|
poetry poe test-banana
|
||||||
|
poetry poe test-potato
|
||||||
```
|
```
|
||||||
|
|
||||||
### Official Documentation
|
### Official Documentation
|
||||||
@@ -883,4 +918,4 @@ pytest -v
|
|||||||
- [Voicemeeter Remote C API](https://github.com/onyx-and-iris/Voicemeeter-SDK/blob/main/VoicemeeterRemoteAPI.pdf)
|
- [Voicemeeter Remote C API](https://github.com/onyx-and-iris/Voicemeeter-SDK/blob/main/VoicemeeterRemoteAPI.pdf)
|
||||||
|
|
||||||
|
|
||||||
[Voicemeeter Remote Header]: https://github.com/onyx-and-iris/Voicemeeter-SDK/blob/main/VoicemeeterRemote.h
|
[Voicemeeter Remote Header]: https://github.com/onyx-and-iris/Voicemeeter-SDK/blob/main/VoicemeeterRemote.h
|
||||||
|
|||||||
24
__main__.py
24
__main__.py
@@ -6,24 +6,24 @@ class ManyThings:
|
|||||||
self.vm = vm
|
self.vm = vm
|
||||||
|
|
||||||
def things(self):
|
def things(self):
|
||||||
self.vm.strip[0].label = "podmic"
|
self.vm.strip[0].label = 'podmic'
|
||||||
self.vm.strip[0].mute = True
|
self.vm.strip[0].mute = True
|
||||||
print(
|
print(
|
||||||
f"strip 0 ({self.vm.strip[0].label}) mute has been set to {self.vm.strip[0].mute}"
|
f'strip 0 ({self.vm.strip[0].label}) mute has been set to {self.vm.strip[0].mute}'
|
||||||
)
|
)
|
||||||
|
|
||||||
def other_things(self):
|
def other_things(self):
|
||||||
self.vm.bus[3].gain = -6.3
|
self.vm.bus[3].gain = -6.3
|
||||||
self.vm.bus[4].eq.on = True
|
self.vm.bus[4].eq.on = True
|
||||||
info = (
|
info = (
|
||||||
f"bus 3 gain has been set to {self.vm.bus[3].gain}",
|
f'bus 3 gain has been set to {self.vm.bus[3].gain}',
|
||||||
f"bus 4 eq has been set to {self.vm.bus[4].eq.on}",
|
f'bus 4 eq has been set to {self.vm.bus[4].eq.on}',
|
||||||
)
|
)
|
||||||
print("\n".join(info))
|
print('\n'.join(info))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
KIND_ID = "banana"
|
KIND_ID = 'banana'
|
||||||
|
|
||||||
with voicemeeterlib.api(KIND_ID) as vm:
|
with voicemeeterlib.api(KIND_ID) as vm:
|
||||||
do = ManyThings(vm)
|
do = ManyThings(vm)
|
||||||
@@ -33,14 +33,14 @@ def main():
|
|||||||
# set many parameters at once
|
# set many parameters at once
|
||||||
vm.apply(
|
vm.apply(
|
||||||
{
|
{
|
||||||
"strip-2": {"A1": True, "B1": True, "gain": -6.0},
|
'strip-2': {'A1': True, 'B1': True, 'gain': -6.0},
|
||||||
"bus-2": {"mute": True, "eq": {"on": True}},
|
'bus-2': {'mute': True, 'eq': {'on': True}},
|
||||||
"button-0": {"state": True},
|
'button-0': {'state': True},
|
||||||
"vban-in-0": {"on": True},
|
'vban-in-0': {'on': True},
|
||||||
"vban-out-1": {"name": "streamname"},
|
'vban-out-1': {'name': 'streamname'},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ logging.basicConfig(level=logging.DEBUG)
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
argparser = argparse.ArgumentParser(description="creates a basic dsl")
|
argparser = argparse.ArgumentParser(description='creates a basic dsl')
|
||||||
argparser.add_argument("-i", action="store_true")
|
argparser.add_argument('-i', action='store_true')
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
ParamKinds = IntEnum(
|
ParamKinds = IntEnum(
|
||||||
"ParamKinds",
|
'ParamKinds',
|
||||||
"bool float string",
|
'bool float string',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -51,12 +51,12 @@ class BoolStrategy(Strategy):
|
|||||||
"""Convert a string representation of truth to it's numeric form."""
|
"""Convert a string representation of truth to it's numeric form."""
|
||||||
|
|
||||||
val = val.lower()
|
val = val.lower()
|
||||||
if val in ("y", "yes", "t", "true", "on", "1"):
|
if val in ('y', 'yes', 't', 'true', 'on', '1'):
|
||||||
return 1
|
return 1
|
||||||
elif val in ("n", "no", "f", "false", "off", "0"):
|
elif val in ('n', 'no', 'f', 'false', 'off', '0'):
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
raise ValueError("invalid truth value %r" % (val,))
|
raise ValueError('invalid truth value %r' % (val,))
|
||||||
|
|
||||||
|
|
||||||
class FloatStrategy(Strategy):
|
class FloatStrategy(Strategy):
|
||||||
@@ -66,7 +66,7 @@ class FloatStrategy(Strategy):
|
|||||||
|
|
||||||
class StringStrategy(Strategy):
|
class StringStrategy(Strategy):
|
||||||
def run(self):
|
def run(self):
|
||||||
setattr(self.target, self.param, " ".join(self.val))
|
setattr(self.target, self.param, ' '.join(self.val))
|
||||||
|
|
||||||
|
|
||||||
class Context:
|
class Context:
|
||||||
@@ -86,16 +86,16 @@ class Context:
|
|||||||
|
|
||||||
|
|
||||||
class Parser:
|
class Parser:
|
||||||
IS_STRING = ("label",)
|
IS_STRING = ('label',)
|
||||||
|
|
||||||
def __init__(self, vm):
|
def __init__(self, vm):
|
||||||
self.logger = logger.getChild(self.__class__.__name__)
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
self.vm = vm
|
self.vm = vm
|
||||||
self.kls = Group(OneOrMore(Word(alphanums)))
|
self.kls = Group(OneOrMore(Word(alphanums)))
|
||||||
self.token = Suppress("->")
|
self.token = Suppress('->')
|
||||||
self.param = Group(OneOrMore(Word(alphanums)))
|
self.param = Group(OneOrMore(Word(alphanums)))
|
||||||
self.value = Combine(
|
self.value = Combine(
|
||||||
Optional("-") + Word(nums) + Optional(".") + Optional(Word(nums))
|
Optional('-') + Word(nums) + Optional('.') + Optional(Word(nums))
|
||||||
) | Group(OneOrMore(Word(alphanums)))
|
) | Group(OneOrMore(Word(alphanums)))
|
||||||
self.event = (
|
self.event = (
|
||||||
self.kls
|
self.kls
|
||||||
@@ -110,7 +110,7 @@ class Parser:
|
|||||||
|
|
||||||
res = list()
|
res = list()
|
||||||
for cmd in cmds:
|
for cmd in cmds:
|
||||||
self.logger.debug(f"running command: {cmd}")
|
self.logger.debug(f'running command: {cmd}')
|
||||||
match cmd_parsed := self.event.parseString(cmd):
|
match cmd_parsed := self.event.parseString(cmd):
|
||||||
case [[kls, index], [param]]:
|
case [[kls, index], [param]]:
|
||||||
target = getattr(self.vm, kls)[int(index)]
|
target = getattr(self.vm, kls)[int(index)]
|
||||||
@@ -125,13 +125,14 @@ class Parser:
|
|||||||
context = self._get_context(ParamKinds.bool, target, param, val)
|
context = self._get_context(ParamKinds.bool, target, param, val)
|
||||||
context.run()
|
context.run()
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.logger.error(f"{e}... switching to float strategy")
|
self.logger.error(f'{e}... switching to float strategy')
|
||||||
context.strategy = FloatStrategy(target, param, val)
|
context.strategy = FloatStrategy(target, param, val)
|
||||||
context.run()
|
context.run()
|
||||||
case [
|
case [
|
||||||
[kls, index],
|
[kls, index],
|
||||||
[secondary, param],
|
[secondary, param],
|
||||||
[val] | val,
|
[val]
|
||||||
|
| val,
|
||||||
]:
|
]:
|
||||||
primary = getattr(self.vm, kls)[int(index)]
|
primary = getattr(self.vm, kls)[int(index)]
|
||||||
target = getattr(primary, secondary)
|
target = getattr(primary, secondary)
|
||||||
@@ -139,12 +140,12 @@ class Parser:
|
|||||||
context = self._get_context(ParamKinds.bool, target, param, val)
|
context = self._get_context(ParamKinds.bool, target, param, val)
|
||||||
context.run()
|
context.run()
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.logger.error(f"{e}... switching to float strategy")
|
self.logger.error(f'{e}... switching to float strategy')
|
||||||
context.strategy = FloatStrategy(target, param, val)
|
context.strategy = FloatStrategy(target, param, val)
|
||||||
context.run()
|
context.run()
|
||||||
case _:
|
case _:
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
f"unable to determine the kind of parameter from {cmd_parsed}"
|
f'unable to determine the kind of parameter from {cmd_parsed}'
|
||||||
)
|
)
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
return res
|
return res
|
||||||
@@ -165,7 +166,7 @@ class Parser:
|
|||||||
|
|
||||||
|
|
||||||
def interactive_mode(parser):
|
def interactive_mode(parser):
|
||||||
while cmd := input("Please enter command (Press <Enter> to exit)\n"):
|
while cmd := input('Please enter command (Press <Enter> to exit)\n'):
|
||||||
if res := parser.parse((cmd,)):
|
if res := parser.parse((cmd,)):
|
||||||
print(res)
|
print(res)
|
||||||
|
|
||||||
@@ -183,7 +184,7 @@ def main():
|
|||||||
)
|
)
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
with voicemeeterlib.api("potato") as vm:
|
with voicemeeterlib.api('potato') as vm:
|
||||||
parser = Parser(vm)
|
parser = Parser(vm)
|
||||||
if args.i:
|
if args.i:
|
||||||
interactive_mode(parser)
|
interactive_mode(parser)
|
||||||
@@ -193,5 +194,5 @@ def main():
|
|||||||
print(res)
|
print(res)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
9
examples/eq_edit/README.md
Normal file
9
examples/eq_edit/README.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
## About
|
||||||
|
|
||||||
|
The purpose of this script is to demonstratehow to utilize the channels and cells that are available as part of the EQ. It should take audio playing in the second virtual strip and then apply a LGF on the first physical at 500 Hz.
|
||||||
|
|
||||||
|
## Use
|
||||||
|
|
||||||
|
Configured for banana version.
|
||||||
|
|
||||||
|
Make sure you are playing audio into the second virtual strip and out of the first physical bus, both channels are unmuted and that you aren't monitoring another mixbus. Then run the script.
|
||||||
50
examples/eq_edit/__main__.py
Normal file
50
examples/eq_edit/__main__.py
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import time
|
||||||
|
|
||||||
|
import voicemeeterlib
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
KIND_ID = 'banana'
|
||||||
|
BUS_INDEX = 0 # Index of the bus to edit, can be changed as needed
|
||||||
|
CHANNEL_INDEX = 0 # Index of the channel to edit, can be changed as needed
|
||||||
|
|
||||||
|
with voicemeeterlib.api(KIND_ID) as vm:
|
||||||
|
print(f'Bus[{BUS_INDEX}].EQ.on: {vm.bus[BUS_INDEX].eq.on}')
|
||||||
|
print(
|
||||||
|
f'Bus[{BUS_INDEX}].EQ.channel[{CHANNEL_INDEX}].cell[0].on: {vm.bus[BUS_INDEX].eq.channel[CHANNEL_INDEX].cell[0].on}'
|
||||||
|
)
|
||||||
|
|
||||||
|
print('Check sending commands (should affect your VM Banana window)')
|
||||||
|
|
||||||
|
vm.bus[BUS_INDEX].eq.on = True
|
||||||
|
vm.bus[BUS_INDEX].eq.ab = 0 # corresponds to A EQ memory slot
|
||||||
|
vm.bus[BUS_INDEX].mute = False
|
||||||
|
|
||||||
|
for j, cell in enumerate(vm.bus[BUS_INDEX].eq.channel[CHANNEL_INDEX].cell):
|
||||||
|
cell.on = True
|
||||||
|
cell.f = 500
|
||||||
|
cell.gain = -10
|
||||||
|
cell.type = 3 # Should correspond to LPF
|
||||||
|
cell.q = 10
|
||||||
|
|
||||||
|
print(
|
||||||
|
f'Channel {CHANNEL_INDEX}, Cell {j}: on={cell.on}, f={cell.f}, type={cell.type}, gain={cell.gain}, q={cell.q}'
|
||||||
|
)
|
||||||
|
|
||||||
|
time.sleep(1) # Sleep to simulate processing time
|
||||||
|
|
||||||
|
cell.on = False
|
||||||
|
cell.f = 50
|
||||||
|
cell.gain = 0
|
||||||
|
cell.type = 0
|
||||||
|
cell.q = 3
|
||||||
|
|
||||||
|
print(
|
||||||
|
f'Channel {CHANNEL_INDEX}, Cell {j}: on={cell.on}, f={cell.f}, type={cell.type} , gain={cell.gain}, q={cell.q}'
|
||||||
|
)
|
||||||
|
|
||||||
|
vm.bus[BUS_INDEX].eq.on = False
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -1,33 +1,8 @@
|
|||||||
## About
|
# Events
|
||||||
|
|
||||||
This script demonstrates how to interact with the event thread/event object. It also demonstrates how to register event specific callbacks.
|
If you want to receive updates on certain events there are two routes you can take:
|
||||||
|
|
||||||
By default the interface does not broadcast any events. So even though our callbacks are registered, and the event thread has been initiated, we won't receive updates.
|
- Register a class that implements an `on_update(self, event) -> None` method on the `{Remote}.subject` class.
|
||||||
|
- Register callback functions/methods on the `{Remote}.subject` class, one for each type of update.
|
||||||
|
|
||||||
After five seconds the event object is used to subscribe to all events for a total of thirty seconds.
|
Included are examples of both approaches.
|
||||||
|
|
||||||
Remember that events can also be unsubscribed to with `vm.event.remove()`. Callbacks can also be deregistered using vm.observer.remove().
|
|
||||||
|
|
||||||
The same can be done without a context manager:
|
|
||||||
|
|
||||||
```python
|
|
||||||
vm = voicemeeterlib.api(KIND_ID)
|
|
||||||
vm.login()
|
|
||||||
vm.observer.add(on_midi) # register an `on_midi` callback function
|
|
||||||
vm.init_thread()
|
|
||||||
vm.event.add("midi") # in this case we only subscribe to midi events.
|
|
||||||
...
|
|
||||||
vm.end_thread()
|
|
||||||
vm.logout()
|
|
||||||
```
|
|
||||||
|
|
||||||
Once initialized, the event thread will continously run until end_thread() is called. Even if all events are unsubscribed to.
|
|
||||||
|
|
||||||
## Use
|
|
||||||
|
|
||||||
Simply run the script and trigger events and you should see the output after 5 seconds. To trigger events do the following:
|
|
||||||
|
|
||||||
- change GUI parameters to trigger pdirty
|
|
||||||
- press any macrobutton to trigger mdirty
|
|
||||||
- play audio through any bus to trigger ldirty
|
|
||||||
- any midi input to trigger midi
|
|
||||||
|
|||||||
33
examples/events/callbacks/README.md
Normal file
33
examples/events/callbacks/README.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
## About
|
||||||
|
|
||||||
|
This script demonstrates how to interact with the event thread/event object. It also demonstrates how to register event specific callbacks.
|
||||||
|
|
||||||
|
By default the interface does not broadcast any events. So even though our callbacks are registered, and the event thread has been initiated, we won't receive updates.
|
||||||
|
|
||||||
|
After five seconds the event object is used to subscribe to all events for a total of thirty seconds.
|
||||||
|
|
||||||
|
Remember that events can also be unsubscribed to with `vm.event.remove()`. Callbacks can also be deregistered using vm.observer.remove().
|
||||||
|
|
||||||
|
The same can be done without a context manager:
|
||||||
|
|
||||||
|
```python
|
||||||
|
vm = voicemeeterlib.api(KIND_ID)
|
||||||
|
vm.login()
|
||||||
|
vm.observer.add(on_midi) # register an `on_midi` callback function
|
||||||
|
vm.init_thread()
|
||||||
|
vm.event.add("midi") # in this case we only subscribe to midi events.
|
||||||
|
...
|
||||||
|
vm.end_thread()
|
||||||
|
vm.logout()
|
||||||
|
```
|
||||||
|
|
||||||
|
Once initialized, the event thread will continously run until end_thread() is called. Even if all events are unsubscribed to.
|
||||||
|
|
||||||
|
## Use
|
||||||
|
|
||||||
|
Simply run the script and trigger events and you should see the output after 5 seconds. To trigger events do the following:
|
||||||
|
|
||||||
|
- change GUI parameters to trigger pdirty
|
||||||
|
- press any macrobutton to trigger mdirty
|
||||||
|
- play audio through any bus to trigger ldirty
|
||||||
|
- any midi input to trigger midi
|
||||||
@@ -8,46 +8,46 @@ logging.basicConfig(level=logging.INFO)
|
|||||||
|
|
||||||
class App:
|
class App:
|
||||||
def __init__(self, vm):
|
def __init__(self, vm):
|
||||||
self.vm = vm
|
self._vm = vm
|
||||||
# register the callbacks for each event
|
# register the callbacks for each event
|
||||||
self.vm.observer.add(
|
self._vm.observer.add(
|
||||||
[self.on_pdirty, self.on_mdirty, self.on_ldirty, self.on_midi]
|
[self.on_pdirty, self.on_mdirty, self.on_ldirty, self.on_midi]
|
||||||
)
|
)
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self.vm.init_thread()
|
self._vm.init_thread()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, traceback):
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
self.vm.end_thread()
|
self._vm.end_thread()
|
||||||
|
|
||||||
def on_pdirty(self):
|
def on_pdirty(self):
|
||||||
print("pdirty!")
|
print('pdirty!')
|
||||||
|
|
||||||
def on_mdirty(self):
|
def on_mdirty(self):
|
||||||
print("mdirty!")
|
print('mdirty!')
|
||||||
|
|
||||||
def on_ldirty(self):
|
def on_ldirty(self):
|
||||||
for bus in self.vm.bus:
|
for bus in self._vm.bus:
|
||||||
if bus.levels.isdirty:
|
if bus.levels.isdirty:
|
||||||
print(bus, bus.levels.all)
|
print(bus, bus.levels.all)
|
||||||
|
|
||||||
def on_midi(self):
|
def on_midi(self):
|
||||||
current = self.vm.midi.current
|
current = self._vm.midi.current
|
||||||
print(f"Value of midi button {current} is {self.vm.midi.get(current)}")
|
print(f'Value of midi button {current} is {self._vm.midi.get(current)}')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
KIND_ID = "banana"
|
KIND_ID = 'banana'
|
||||||
|
|
||||||
with voicemeeterlib.api(KIND_ID) as vm:
|
with voicemeeterlib.api(KIND_ID) as vm:
|
||||||
with App(vm) as app:
|
with App(vm):
|
||||||
for i in range(5, 0, -1):
|
for i in range(5, 0, -1):
|
||||||
print(f"events start in {i} seconds")
|
print(f'events start in {i} seconds')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
vm.event.add(["pdirty", "ldirty", "midi", "mdirty"])
|
vm.event.add(['pdirty', 'ldirty', 'midi', 'mdirty'])
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
45
examples/events/observer/__main__.py
Normal file
45
examples/events/observer/__main__.py
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
|
import voicemeeterlib
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
|
class App:
|
||||||
|
def __init__(self, vm):
|
||||||
|
self._vm = vm
|
||||||
|
# register your app as event observer
|
||||||
|
self._vm.observer.add(self)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return type(self).__name__
|
||||||
|
|
||||||
|
# define an 'on_update' callback function to receive event updates
|
||||||
|
def on_update(self, event):
|
||||||
|
if event == 'pdirty':
|
||||||
|
print('pdirty!')
|
||||||
|
elif event == 'mdirty':
|
||||||
|
print('mdirty!')
|
||||||
|
elif event == 'ldirty':
|
||||||
|
for bus in self._vm.bus:
|
||||||
|
if bus.levels.isdirty:
|
||||||
|
print(bus, bus.levels.all)
|
||||||
|
elif event == 'midi':
|
||||||
|
current = self._vm.midi.current
|
||||||
|
print(f'Value of midi button {current} is {self._vm.midi.get(current)}')
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
KIND_ID = 'banana'
|
||||||
|
|
||||||
|
with voicemeeterlib.api(
|
||||||
|
KIND_ID, **{k: True for k in ('pdirty', 'mdirty', 'ldirty', 'midi')}
|
||||||
|
) as vm:
|
||||||
|
App(vm)
|
||||||
|
|
||||||
|
while _ := input('Press <Enter> to exit\n'):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import tkinter as tk
|
||||||
|
from tkinter import ttk
|
||||||
|
|
||||||
import voicemeeterlib
|
import voicemeeterlib
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
import tkinter as tk
|
|
||||||
from tkinter import ttk
|
|
||||||
|
|
||||||
|
|
||||||
class App(tk.Tk):
|
class App(tk.Tk):
|
||||||
@@ -12,9 +12,9 @@ class App(tk.Tk):
|
|||||||
|
|
||||||
def __init__(self, vm):
|
def __init__(self, vm):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.vm = vm
|
self._vm = vm
|
||||||
self.title(f"{vm} - version {vm.version}")
|
self.title(f'{vm} - version {vm.version}')
|
||||||
self.vm.observer.add(self.on_ldirty)
|
self._vm.observer.add(self.on_ldirty)
|
||||||
|
|
||||||
# create widget variables
|
# create widget variables
|
||||||
self.button_var = tk.BooleanVar(value=vm.strip[self.INDEX].mute)
|
self.button_var = tk.BooleanVar(value=vm.strip[self.INDEX].mute)
|
||||||
@@ -24,14 +24,14 @@ class App(tk.Tk):
|
|||||||
|
|
||||||
# initialize style table
|
# initialize style table
|
||||||
self.style = ttk.Style()
|
self.style = ttk.Style()
|
||||||
self.style.theme_use("clam")
|
self.style.theme_use('clam')
|
||||||
self.style.configure(
|
self.style.configure(
|
||||||
"Mute.TButton",
|
'Mute.TButton',
|
||||||
foreground="#cd5c5c" if vm.strip[self.INDEX].mute else "#5a5a5a",
|
foreground='#cd5c5c' if vm.strip[self.INDEX].mute else '#5a5a5a',
|
||||||
)
|
)
|
||||||
|
|
||||||
# create labelframe and grid it onto the mainframe
|
# create labelframe and grid it onto the mainframe
|
||||||
self.labelframe = tk.LabelFrame(self, text=self.vm.strip[self.INDEX].label)
|
self.labelframe = tk.LabelFrame(self, text=self._vm.strip[self.INDEX].label)
|
||||||
self.labelframe.grid(padx=1)
|
self.labelframe.grid(padx=1)
|
||||||
|
|
||||||
# create slider and grid it onto the labelframe
|
# create slider and grid it onto the labelframe
|
||||||
@@ -39,7 +39,7 @@ class App(tk.Tk):
|
|||||||
self.labelframe,
|
self.labelframe,
|
||||||
from_=12,
|
from_=12,
|
||||||
to_=-60,
|
to_=-60,
|
||||||
orient="vertical",
|
orient='vertical',
|
||||||
variable=self.slider_var,
|
variable=self.slider_var,
|
||||||
command=lambda arg: self.on_slider_move(arg),
|
command=lambda arg: self.on_slider_move(arg),
|
||||||
)
|
)
|
||||||
@@ -47,15 +47,15 @@ class App(tk.Tk):
|
|||||||
column=0,
|
column=0,
|
||||||
row=0,
|
row=0,
|
||||||
)
|
)
|
||||||
slider.bind("<Double-Button-1>", self.on_button_double_click)
|
slider.bind('<Double-Button-1>', self.on_button_double_click)
|
||||||
|
|
||||||
# create level meter and grid it onto the labelframe
|
# create level meter and grid it onto the labelframe
|
||||||
level_meter = ttk.Progressbar(
|
level_meter = ttk.Progressbar(
|
||||||
self.labelframe,
|
self.labelframe,
|
||||||
orient="vertical",
|
orient='vertical',
|
||||||
variable=self.meter_var,
|
variable=self.meter_var,
|
||||||
maximum=72,
|
maximum=72,
|
||||||
mode="determinate",
|
mode='determinate',
|
||||||
)
|
)
|
||||||
level_meter.grid(column=1, row=0)
|
level_meter.grid(column=1, row=0)
|
||||||
|
|
||||||
@@ -66,8 +66,8 @@ class App(tk.Tk):
|
|||||||
# create button and grid it onto the labelframe
|
# create button and grid it onto the labelframe
|
||||||
button = ttk.Button(
|
button = ttk.Button(
|
||||||
self.labelframe,
|
self.labelframe,
|
||||||
text="Mute",
|
text='Mute',
|
||||||
style="Mute.TButton",
|
style='Mute.TButton',
|
||||||
command=lambda: self.on_button_press(),
|
command=lambda: self.on_button_press(),
|
||||||
)
|
)
|
||||||
button.grid(column=0, row=2, columnspan=2, padx=1, pady=2)
|
button.grid(column=0, row=2, columnspan=2, padx=1, pady=2)
|
||||||
@@ -76,23 +76,23 @@ class App(tk.Tk):
|
|||||||
|
|
||||||
def on_slider_move(self, *args):
|
def on_slider_move(self, *args):
|
||||||
val = round(self.slider_var.get(), 1)
|
val = round(self.slider_var.get(), 1)
|
||||||
self.vm.strip[self.INDEX].gain = val
|
self._vm.strip[self.INDEX].gain = val
|
||||||
self.gainlabel_var.set(val)
|
self.gainlabel_var.set(val)
|
||||||
|
|
||||||
def on_button_press(self):
|
def on_button_press(self):
|
||||||
self.button_var.set(not self.button_var.get())
|
self.button_var.set(not self.button_var.get())
|
||||||
self.vm.strip[self.INDEX].mute = self.button_var.get()
|
self._vm.strip[self.INDEX].mute = self.button_var.get()
|
||||||
self.style.configure(
|
self.style.configure(
|
||||||
"Mute.TButton", foreground="#cd5c5c" if self.button_var.get() else "#5a5a5a"
|
'Mute.TButton', foreground='#cd5c5c' if self.button_var.get() else '#5a5a5a'
|
||||||
)
|
)
|
||||||
|
|
||||||
def on_button_double_click(self, e):
|
def on_button_double_click(self, e):
|
||||||
self.slider_var.set(0)
|
self.slider_var.set(0)
|
||||||
self.gainlabel_var.set(0)
|
self.gainlabel_var.set(0)
|
||||||
self.vm.strip[self.INDEX].gain = 0
|
self._vm.strip[self.INDEX].gain = 0
|
||||||
|
|
||||||
def _get_level(self):
|
def _get_level(self):
|
||||||
val = max(self.vm.strip[self.INDEX].levels.postfader)
|
val = max(self._vm.strip[self.INDEX].levels.postfader)
|
||||||
return 0 if self.button_var.get() else 72 + val - 12
|
return 0 if self.button_var.get() else 72 + val - 12
|
||||||
|
|
||||||
def on_ldirty(self):
|
def on_ldirty(self):
|
||||||
@@ -100,10 +100,10 @@ class App(tk.Tk):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
with voicemeeterlib.api("banana", ldirty=True) as vm:
|
with voicemeeterlib.api('banana', ldirty=True) as vm:
|
||||||
app = App(vm)
|
app = App(vm)
|
||||||
app.mainloop()
|
app.mainloop()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -7,16 +7,16 @@ logging.basicConfig(level=logging.INFO)
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
KIND_ID = "potato"
|
KIND_ID = 'potato'
|
||||||
|
|
||||||
vm = voicemeeterlib.api(KIND_ID)
|
vm = voicemeeterlib.api(KIND_ID)
|
||||||
vm.login()
|
vm.login()
|
||||||
for _ in range(500):
|
for _ in range(500):
|
||||||
print(
|
print(
|
||||||
"\n".join(
|
'\n'.join(
|
||||||
[
|
[
|
||||||
f"{vm.strip[5]}: {vm.strip[5].levels.postmute}",
|
f'{vm.strip[5]}: {vm.strip[5].levels.postmute}',
|
||||||
f"{vm.bus[0]}: {vm.bus[0].levels.all}",
|
f'{vm.bus[0]}: {vm.bus[0].levels.all}',
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -24,5 +24,5 @@ def main():
|
|||||||
vm.logout()
|
vm.logout()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -10,42 +10,42 @@ class App:
|
|||||||
MACROBUTTON = 0
|
MACROBUTTON = 0
|
||||||
|
|
||||||
def __init__(self, vm):
|
def __init__(self, vm):
|
||||||
self.vm = vm
|
self._vm = vm
|
||||||
self.vm.observer.add(self.on_midi)
|
self._vm.observer.add(self.on_midi)
|
||||||
|
|
||||||
def on_midi(self):
|
def on_midi(self):
|
||||||
if self.get_info() == self.MIDI_BUTTON:
|
if self.get_info() == self.MIDI_BUTTON:
|
||||||
self.on_midi_press()
|
self.on_midi_press()
|
||||||
|
|
||||||
def get_info(self):
|
def get_info(self):
|
||||||
current = self.vm.midi.current
|
current = self._vm.midi.current
|
||||||
print(f"Value of midi button {current} is {self.vm.midi.get(current)}")
|
print(f'Value of midi button {current} is {self._vm.midi.get(current)}')
|
||||||
return current
|
return current
|
||||||
|
|
||||||
def on_midi_press(self):
|
def on_midi_press(self):
|
||||||
"""if midi button 48 is pressed and strip 3 level max > -40, then set trigger for macrobutton 0"""
|
"""if midi button 48 is pressed and strip 3 level max > -40, then set trigger for macrobutton 0"""
|
||||||
|
|
||||||
if (
|
if (
|
||||||
self.vm.midi.get(self.MIDI_BUTTON) == 127
|
self._vm.midi.get(self.MIDI_BUTTON) == 127
|
||||||
and max(self.vm.strip[3].levels.postfader) > -40
|
and max(self._vm.strip[3].levels.postfader) > -40
|
||||||
):
|
):
|
||||||
print(
|
print(
|
||||||
f"Strip 3 level max is greater than -40 and midi button {self.MIDI_BUTTON} is pressed"
|
f'Strip 3 level max is greater than -40 and midi button {self.MIDI_BUTTON} is pressed'
|
||||||
)
|
)
|
||||||
self.vm.button[self.MACROBUTTON].trigger = True
|
self._vm.button[self.MACROBUTTON].trigger = True
|
||||||
else:
|
else:
|
||||||
self.vm.button[self.MACROBUTTON].trigger = False
|
self._vm.button[self.MACROBUTTON].trigger = False
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
KIND_ID = "banana"
|
KIND_ID = 'banana'
|
||||||
|
|
||||||
with voicemeeterlib.api(KIND_ID, midi=True) as vm:
|
with voicemeeterlib.api(KIND_ID, midi=True) as vm:
|
||||||
App(vm)
|
App(vm)
|
||||||
|
|
||||||
while cmd := input("Press <Enter> to exit\n"):
|
while _ := input('Press <Enter> to exit\n'):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import time
|
import threading
|
||||||
from logging import config
|
from logging import config
|
||||||
|
|
||||||
import obsws_python as obsws
|
import obsws_python as obsws
|
||||||
@@ -7,91 +7,100 @@ import voicemeeterlib
|
|||||||
|
|
||||||
config.dictConfig(
|
config.dictConfig(
|
||||||
{
|
{
|
||||||
"version": 1,
|
'version': 1,
|
||||||
"formatters": {
|
'formatters': {
|
||||||
"standard": {
|
'standard': {
|
||||||
"format": "%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s"
|
'format': '%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"handlers": {
|
'handlers': {
|
||||||
"stream": {
|
'stream': {
|
||||||
"level": "DEBUG",
|
'level': 'DEBUG',
|
||||||
"class": "logging.StreamHandler",
|
'class': 'logging.StreamHandler',
|
||||||
"formatter": "standard",
|
'formatter': 'standard',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"loggers": {
|
'loggers': {
|
||||||
"voicemeeterlib.iremote": {"handlers": ["stream"], "level": "DEBUG"}
|
'voicemeeterlib.iremote': {
|
||||||
|
'handlers': ['stream'],
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'propagate': False,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
'root': {'handlers': ['stream'], 'level': 'WARNING'},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class MyClient:
|
class MyClient:
|
||||||
def __init__(self, vm):
|
def __init__(self, vm, stop_event):
|
||||||
self.vm = vm
|
self._vm = vm
|
||||||
self.client = obsws.EventClient()
|
self._stop_event = stop_event
|
||||||
self.client.callback.register(
|
self._client = obsws.EventClient()
|
||||||
|
self._client.callback.register(
|
||||||
(
|
(
|
||||||
self.on_current_program_scene_changed,
|
self.on_current_program_scene_changed,
|
||||||
self.on_exit_started,
|
self.on_exit_started,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.is_running = True
|
|
||||||
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, exc_traceback):
|
||||||
|
self._client.disconnect()
|
||||||
|
|
||||||
def on_start(self):
|
def on_start(self):
|
||||||
self.vm.strip[0].mute = True
|
self._vm.strip[0].mute = True
|
||||||
self.vm.strip[1].B1 = True
|
self._vm.strip[1].B1 = True
|
||||||
self.vm.strip[2].B2 = True
|
self._vm.strip[2].B2 = True
|
||||||
|
|
||||||
def on_brb(self):
|
def on_brb(self):
|
||||||
self.vm.strip[7].fadeto(0, 500)
|
self._vm.strip[7].fadeto(0, 500)
|
||||||
self.vm.bus[0].mute = True
|
self._vm.bus[0].mute = True
|
||||||
|
|
||||||
def on_end(self):
|
def on_end(self):
|
||||||
self.vm.apply(
|
self._vm.apply(
|
||||||
{
|
{
|
||||||
"strip-0": {"mute": True, "comp": {"ratio": 4.3}},
|
'strip-0': {'mute': True, 'comp': {'ratio': 4.3}},
|
||||||
"strip-1": {"mute": True, "B1": False, "gate": {"attack": 2.3}},
|
'strip-1': {'mute': True, 'B1': False, 'gate': {'attack': 2.3}},
|
||||||
"strip-2": {"mute": True, "B1": False},
|
'strip-2': {'mute': True, 'B1': False},
|
||||||
"vban-in-0": {"on": False},
|
'vban-in-0': {'on': False},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def on_live(self):
|
def on_live(self):
|
||||||
self.vm.strip[0].mute = False
|
self._vm.strip[0].mute = False
|
||||||
self.vm.strip[7].fadeto(-6, 500)
|
self._vm.strip[7].fadeto(-6, 500)
|
||||||
self.vm.strip[7].A3 = True
|
self._vm.strip[7].A3 = True
|
||||||
self.vm.vban.instream[0].on = True
|
self._vm.vban.instream[0].on = True
|
||||||
|
|
||||||
def on_current_program_scene_changed(self, data):
|
def on_current_program_scene_changed(self, data):
|
||||||
def fget(scene):
|
|
||||||
run = {
|
|
||||||
"START": self.on_start,
|
|
||||||
"BRB": self.on_brb,
|
|
||||||
"END": self.on_end,
|
|
||||||
"LIVE": self.on_live,
|
|
||||||
}
|
|
||||||
return run.get(scene)
|
|
||||||
|
|
||||||
scene = data.scene_name
|
scene = data.scene_name
|
||||||
print(f"Switched to scene {scene}")
|
print(f'Switched to scene {scene}')
|
||||||
if fn := fget(scene):
|
match scene:
|
||||||
fn()
|
case 'START':
|
||||||
|
self.on_start()
|
||||||
|
case 'BRB':
|
||||||
|
self.on_brb()
|
||||||
|
case 'END':
|
||||||
|
self.on_end()
|
||||||
|
case 'LIVE':
|
||||||
|
self.on_live()
|
||||||
|
|
||||||
def on_exit_started(self, _):
|
def on_exit_started(self, _):
|
||||||
self.client.unsubscribe()
|
self._stop_event.set()
|
||||||
self.is_running = False
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
KIND_ID = "potato"
|
KIND_ID = 'potato'
|
||||||
|
|
||||||
with voicemeeterlib.api(KIND_ID) as vm:
|
with voicemeeterlib.api(KIND_ID) as vm:
|
||||||
client = MyClient(vm)
|
stop_event = threading.Event()
|
||||||
while client.is_running:
|
|
||||||
time.sleep(0.1)
|
with MyClient(vm, stop_event):
|
||||||
|
stop_event.wait()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
import logging
|
|
||||||
|
|
||||||
import voicemeeterlib
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
|
||||||
|
|
||||||
|
|
||||||
class App:
|
|
||||||
def __init__(self, vm):
|
|
||||||
self.vm = vm
|
|
||||||
# register your app as event observer
|
|
||||||
self.vm.observer.add(self)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return type(self).__name__
|
|
||||||
|
|
||||||
# define an 'on_update' callback function to receive event updates
|
|
||||||
def on_update(self, event):
|
|
||||||
if event == "pdirty":
|
|
||||||
print("pdirty!")
|
|
||||||
elif event == "mdirty":
|
|
||||||
print("mdirty!")
|
|
||||||
elif event == "ldirty":
|
|
||||||
for bus in self.vm.bus:
|
|
||||||
if bus.levels.isdirty:
|
|
||||||
print(bus, bus.levels.all)
|
|
||||||
elif event == "midi":
|
|
||||||
current = self.vm.midi.current
|
|
||||||
print(f"Value of midi button {current} is {self.vm.midi.get(current)}")
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
KIND_ID = "banana"
|
|
||||||
|
|
||||||
with voicemeeterlib.api(
|
|
||||||
KIND_ID, **{k: True for k in ("pdirty", "mdirty", "ldirty", "midi")}
|
|
||||||
) as vm:
|
|
||||||
App(vm)
|
|
||||||
|
|
||||||
while cmd := input("Press <Enter> to exit\n"):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
407
poetry.lock
generated
407
poetry.lock
generated
@@ -1,93 +1,36 @@
|
|||||||
# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
|
# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand.
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "black"
|
|
||||||
version = "24.3.0"
|
|
||||||
description = "The uncompromising code formatter."
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.8"
|
|
||||||
files = [
|
|
||||||
{file = "black-24.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7d5e026f8da0322b5662fa7a8e752b3fa2dac1c1cbc213c3d7ff9bdd0ab12395"},
|
|
||||||
{file = "black-24.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9f50ea1132e2189d8dff0115ab75b65590a3e97de1e143795adb4ce317934995"},
|
|
||||||
{file = "black-24.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2af80566f43c85f5797365077fb64a393861a3730bd110971ab7a0c94e873e7"},
|
|
||||||
{file = "black-24.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:4be5bb28e090456adfc1255e03967fb67ca846a03be7aadf6249096100ee32d0"},
|
|
||||||
{file = "black-24.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4f1373a7808a8f135b774039f61d59e4be7eb56b2513d3d2f02a8b9365b8a8a9"},
|
|
||||||
{file = "black-24.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:aadf7a02d947936ee418777e0247ea114f78aff0d0959461057cae8a04f20597"},
|
|
||||||
{file = "black-24.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65c02e4ea2ae09d16314d30912a58ada9a5c4fdfedf9512d23326128ac08ac3d"},
|
|
||||||
{file = "black-24.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:bf21b7b230718a5f08bd32d5e4f1db7fc8788345c8aea1d155fc17852b3410f5"},
|
|
||||||
{file = "black-24.3.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:2818cf72dfd5d289e48f37ccfa08b460bf469e67fb7c4abb07edc2e9f16fb63f"},
|
|
||||||
{file = "black-24.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4acf672def7eb1725f41f38bf6bf425c8237248bb0804faa3965c036f7672d11"},
|
|
||||||
{file = "black-24.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c7ed6668cbbfcd231fa0dc1b137d3e40c04c7f786e626b405c62bcd5db5857e4"},
|
|
||||||
{file = "black-24.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:56f52cfbd3dabe2798d76dbdd299faa046a901041faf2cf33288bc4e6dae57b5"},
|
|
||||||
{file = "black-24.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:79dcf34b33e38ed1b17434693763301d7ccbd1c5860674a8f871bd15139e7837"},
|
|
||||||
{file = "black-24.3.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e19cb1c6365fd6dc38a6eae2dcb691d7d83935c10215aef8e6c38edee3f77abd"},
|
|
||||||
{file = "black-24.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65b76c275e4c1c5ce6e9870911384bff5ca31ab63d19c76811cb1fb162678213"},
|
|
||||||
{file = "black-24.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:b5991d523eee14756f3c8d5df5231550ae8993e2286b8014e2fdea7156ed0959"},
|
|
||||||
{file = "black-24.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c45f8dff244b3c431b36e3224b6be4a127c6aca780853574c00faf99258041eb"},
|
|
||||||
{file = "black-24.3.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6905238a754ceb7788a73f02b45637d820b2f5478b20fec82ea865e4f5d4d9f7"},
|
|
||||||
{file = "black-24.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7de8d330763c66663661a1ffd432274a2f92f07feeddd89ffd085b5744f85e7"},
|
|
||||||
{file = "black-24.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:7bb041dca0d784697af4646d3b62ba4a6b028276ae878e53f6b4f74ddd6db99f"},
|
|
||||||
{file = "black-24.3.0-py3-none-any.whl", hash = "sha256:41622020d7120e01d377f74249e677039d20e6344ff5851de8a10f11f513bf93"},
|
|
||||||
{file = "black-24.3.0.tar.gz", hash = "sha256:a0c9c4a0771afc6919578cec71ce82a3e31e054904e7197deacbc9382671c41f"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[package.dependencies]
|
|
||||||
click = ">=8.0.0"
|
|
||||||
mypy-extensions = ">=0.4.3"
|
|
||||||
packaging = ">=22.0"
|
|
||||||
pathspec = ">=0.9.0"
|
|
||||||
platformdirs = ">=2"
|
|
||||||
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
|
|
||||||
typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""}
|
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
colorama = ["colorama (>=0.4.3)"]
|
|
||||||
d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"]
|
|
||||||
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
|
|
||||||
uvloop = ["uvloop (>=0.15.2)"]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cachetools"
|
name = "cachetools"
|
||||||
version = "5.3.1"
|
version = "5.5.0"
|
||||||
description = "Extensible memoizing collections and decorators"
|
description = "Extensible memoizing collections and decorators"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "cachetools-5.3.1-py3-none-any.whl", hash = "sha256:95ef631eeaea14ba2e36f06437f36463aac3a096799e876ee55e5cdccb102590"},
|
{file = "cachetools-5.5.0-py3-none-any.whl", hash = "sha256:02134e8439cdc2ffb62023ce1debca2944c3f289d66bb17ead3ab3dede74b292"},
|
||||||
{file = "cachetools-5.3.1.tar.gz", hash = "sha256:dce83f2d9b4e1f732a8cd44af8e8fab2dbe46201467fc98b3ef8f269092bf62b"},
|
{file = "cachetools-5.5.0.tar.gz", hash = "sha256:2cc24fb4cbe39633fb7badd9db9ca6295d766d9c2995f245725a46715d050f2a"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chardet"
|
name = "chardet"
|
||||||
version = "5.1.0"
|
version = "5.2.0"
|
||||||
description = "Universal encoding detector for Python 3"
|
description = "Universal encoding detector for Python 3"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "chardet-5.1.0-py3-none-any.whl", hash = "sha256:362777fb014af596ad31334fde1e8c327dfdb076e1960d1694662d46a6917ab9"},
|
{file = "chardet-5.2.0-py3-none-any.whl", hash = "sha256:e1cf59446890a00105fe7b7912492ea04b6e6f06d4b742b2c788469e34c82970"},
|
||||||
{file = "chardet-5.1.0.tar.gz", hash = "sha256:0d62712b956bc154f85fb0a266e2a3c5913c2967e00348701b32411d6def31e5"},
|
{file = "chardet-5.2.0.tar.gz", hash = "sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "click"
|
|
||||||
version = "8.1.3"
|
|
||||||
description = "Composable command line interface toolkit"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.7"
|
|
||||||
files = [
|
|
||||||
{file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"},
|
|
||||||
{file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[package.dependencies]
|
|
||||||
colorama = {version = "*", markers = "platform_system == \"Windows\""}
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "colorama"
|
name = "colorama"
|
||||||
version = "0.4.6"
|
version = "0.4.6"
|
||||||
description = "Cross-platform colored terminal text."
|
description = "Cross-platform colored terminal text."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
|
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
|
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
|
||||||
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
|
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
|
||||||
@@ -95,24 +38,27 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "distlib"
|
name = "distlib"
|
||||||
version = "0.3.6"
|
version = "0.3.9"
|
||||||
description = "Distribution utilities"
|
description = "Distribution utilities"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "*"
|
python-versions = "*"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "distlib-0.3.6-py2.py3-none-any.whl", hash = "sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e"},
|
{file = "distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87"},
|
||||||
{file = "distlib-0.3.6.tar.gz", hash = "sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46"},
|
{file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "exceptiongroup"
|
name = "exceptiongroup"
|
||||||
version = "1.1.1"
|
version = "1.2.2"
|
||||||
description = "Backport of PEP 654 (exception groups)"
|
description = "Backport of PEP 654 (exception groups)"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
|
groups = ["dev"]
|
||||||
|
markers = "python_version == \"3.10\""
|
||||||
files = [
|
files = [
|
||||||
{file = "exceptiongroup-1.1.1-py3-none-any.whl", hash = "sha256:232c37c63e4f682982c8b6459f33a8981039e5fb8756b2074364e5055c498c9e"},
|
{file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"},
|
||||||
{file = "exceptiongroup-1.1.1.tar.gz", hash = "sha256:d484c3090ba2889ae2928419117447a14daf3c1231d5e30d0aae34f354f01785"},
|
{file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
@@ -120,138 +66,115 @@ test = ["pytest (>=6)"]
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "filelock"
|
name = "filelock"
|
||||||
version = "3.12.2"
|
version = "3.20.3"
|
||||||
description = "A platform independent file lock."
|
description = "A platform independent file lock."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.10"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "filelock-3.12.2-py3-none-any.whl", hash = "sha256:cbb791cdea2a72f23da6ac5b5269ab0a0d161e9ef0100e653b69049a7706d1ec"},
|
{file = "filelock-3.20.3-py3-none-any.whl", hash = "sha256:4b0dda527ee31078689fc205ec4f1c1bf7d56cf88b6dc9426c4f230e46c2dce1"},
|
||||||
{file = "filelock-3.12.2.tar.gz", hash = "sha256:002740518d8aa59a26b0c76e10fb8c6e15eae825d34b6fdf670333fd7b938d81"},
|
{file = "filelock-3.20.3.tar.gz", hash = "sha256:18c57ee915c7ec61cff0ecf7f0f869936c7c30191bb0cf406f1341778d0834e1"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
docs = ["furo (>=2023.5.20)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"]
|
|
||||||
testing = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iniconfig"
|
name = "iniconfig"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
description = "brain-dead simple config-ini parsing"
|
description = "brain-dead simple config-ini parsing"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},
|
{file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},
|
||||||
{file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
|
{file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "isort"
|
|
||||||
version = "5.12.0"
|
|
||||||
description = "A Python utility / library to sort Python imports."
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.8.0"
|
|
||||||
files = [
|
|
||||||
{file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"},
|
|
||||||
{file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
colors = ["colorama (>=0.4.3)"]
|
|
||||||
pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", "requirementslib"]
|
|
||||||
plugins = ["setuptools"]
|
|
||||||
requirements-deprecated-finder = ["pip-api", "pipreqs"]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mypy-extensions"
|
|
||||||
version = "1.0.0"
|
|
||||||
description = "Type system extensions for programs checked with the mypy type checker."
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.5"
|
|
||||||
files = [
|
|
||||||
{file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"},
|
|
||||||
{file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "packaging"
|
name = "packaging"
|
||||||
version = "23.1"
|
version = "24.2"
|
||||||
description = "Core utilities for Python packages"
|
description = "Core utilities for Python packages"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.8"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "packaging-23.1-py3-none-any.whl", hash = "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61"},
|
{file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"},
|
||||||
{file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"},
|
{file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"},
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pathspec"
|
|
||||||
version = "0.11.1"
|
|
||||||
description = "Utility library for gitignore style pattern matching of file paths."
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.7"
|
|
||||||
files = [
|
|
||||||
{file = "pathspec-0.11.1-py3-none-any.whl", hash = "sha256:d8af70af76652554bd134c22b3e8a1cc46ed7d91edcdd721ef1a0c51a84a5293"},
|
|
||||||
{file = "pathspec-0.11.1.tar.gz", hash = "sha256:2798de800fa92780e33acca925945e9a19a133b715067cf165b8866c15a31687"},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "platformdirs"
|
name = "platformdirs"
|
||||||
version = "3.6.0"
|
version = "4.3.6"
|
||||||
description = "A small Python package 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"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "platformdirs-3.6.0-py3-none-any.whl", hash = "sha256:ffa199e3fbab8365778c4a10e1fbf1b9cd50707de826eb304b50e57ec0cc8d38"},
|
{file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"},
|
||||||
{file = "platformdirs-3.6.0.tar.gz", hash = "sha256:57e28820ca8094678b807ff529196506d7a21e17156cb1cddb3e74cebce54640"},
|
{file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
docs = ["furo (>=2023.5.20)", "proselint (>=0.13)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"]
|
docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"]
|
||||||
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)"]
|
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"]
|
||||||
|
type = ["mypy (>=1.11.2)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pluggy"
|
name = "pluggy"
|
||||||
version = "1.1.0"
|
version = "1.5.0"
|
||||||
description = "plugin and hook calling mechanisms for python"
|
description = "plugin and hook calling mechanisms for python"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.8"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "pluggy-1.1.0-py3-none-any.whl", hash = "sha256:d81d19a3a88d82ed06998353ce5d5c02587ef07ee2d808ae63904ab0ccef0087"},
|
{file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"},
|
||||||
{file = "pluggy-1.1.0.tar.gz", hash = "sha256:c500b592c5512df35622e4faf2135aa0b7e989c7d31344194b4afb9d5e47b1bf"},
|
{file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
dev = ["pre-commit", "tox"]
|
dev = ["pre-commit", "tox"]
|
||||||
testing = ["pytest", "pytest-benchmark"]
|
testing = ["pytest", "pytest-benchmark"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pyenv-inspect"
|
||||||
|
version = "0.4.0"
|
||||||
|
description = "An auxiliary library for the virtualenv-pyenv and tox-pyenv-redux plugins"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.8"
|
||||||
|
groups = ["dev"]
|
||||||
|
files = [
|
||||||
|
{file = "pyenv-inspect-0.4.0.tar.gz", hash = "sha256:ec429d1d81b67ab0b08a0408414722a79d24fd1845a5b264267e44e19d8d60f0"},
|
||||||
|
{file = "pyenv_inspect-0.4.0-py3-none-any.whl", hash = "sha256:618683ae7d3e6db14778d58aa0fc6b3170180d944669b5d35a8aa4fb7db550d2"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyproject-api"
|
name = "pyproject-api"
|
||||||
version = "1.5.2"
|
version = "1.8.0"
|
||||||
description = "API to interact with the python pyproject.toml based projects"
|
description = "API to interact with the python pyproject.toml based projects"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.8"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "pyproject_api-1.5.2-py3-none-any.whl", hash = "sha256:9cffcbfb64190f207444d7579d315f3278f2c04ba46d685fad93197b5326d348"},
|
{file = "pyproject_api-1.8.0-py3-none-any.whl", hash = "sha256:3d7d347a047afe796fd5d1885b1e391ba29be7169bd2f102fcd378f04273d228"},
|
||||||
{file = "pyproject_api-1.5.2.tar.gz", hash = "sha256:999f58fa3c92b23ebd31a6bad5d1f87d456744d75e05391be7f5c729015d3d91"},
|
{file = "pyproject_api-1.8.0.tar.gz", hash = "sha256:77b8049f2feb5d33eefcc21b57f1e279636277a8ac8ad6b5871037b243778496"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
packaging = ">=23.1"
|
packaging = ">=24.1"
|
||||||
tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""}
|
tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""}
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
docs = ["furo (>=2023.5.20)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"]
|
docs = ["furo (>=2024.8.6)", "sphinx-autodoc-typehints (>=2.4.1)"]
|
||||||
testing = ["covdefaults (>=2.3)", "importlib-metadata (>=6.6)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)", "setuptools (>=67.8)", "wheel (>=0.40)"]
|
testing = ["covdefaults (>=2.3)", "pytest (>=8.3.3)", "pytest-cov (>=5)", "pytest-mock (>=3.14)", "setuptools (>=75.1)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pytest"
|
name = "pytest"
|
||||||
version = "7.4.4"
|
version = "8.3.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.8"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"},
|
{file = "pytest-8.3.4-py3-none-any.whl", hash = "sha256:50e16d954148559c9a74109af1eaf0c945ba2d8f30f0a3d3335edde19788b6f6"},
|
||||||
{file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"},
|
{file = "pytest-8.3.4.tar.gz", hash = "sha256:965370d062bce11e73868e0335abac31b4d3de0e82f4007408d242b4f8610761"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
@@ -259,136 +182,178 @@ colorama = {version = "*", markers = "sys_platform == \"win32\""}
|
|||||||
exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
|
exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
|
||||||
iniconfig = "*"
|
iniconfig = "*"
|
||||||
packaging = "*"
|
packaging = "*"
|
||||||
pluggy = ">=0.12,<2.0"
|
pluggy = ">=1.5,<2"
|
||||||
tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
|
tomli = {version = ">=1", markers = "python_version < \"3.11\""}
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
|
dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pytest-randomly"
|
name = "pytest-randomly"
|
||||||
version = "3.12.0"
|
version = "3.16.0"
|
||||||
description = "Pytest plugin to randomly order tests and control random.seed."
|
description = "Pytest plugin to randomly order tests and control random.seed."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.9"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "pytest-randomly-3.12.0.tar.gz", hash = "sha256:d60c2db71ac319aee0fc6c4110a7597d611a8b94a5590918bfa8583f00caccb2"},
|
{file = "pytest_randomly-3.16.0-py3-none-any.whl", hash = "sha256:8633d332635a1a0983d3bba19342196807f6afb17c3eef78e02c2f85dade45d6"},
|
||||||
{file = "pytest_randomly-3.12.0-py3-none-any.whl", hash = "sha256:f4f2e803daf5d1ba036cc22bf4fe9dbbf99389ec56b00e5cba732fb5c1d07fdd"},
|
{file = "pytest_randomly-3.16.0.tar.gz", hash = "sha256:11bf4d23a26484de7860d82f726c0629837cf4064b79157bd18ec9d41d7feb26"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
pytest = "*"
|
pytest = "*"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pytest-repeat"
|
|
||||||
version = "0.9.1"
|
|
||||||
description = "pytest plugin for repeating tests"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
|
||||||
files = [
|
|
||||||
{file = "pytest-repeat-0.9.1.tar.gz", hash = "sha256:5cd3289745ab3156d43eb9c8e7f7d00a926f3ae5c9cf425bec649b2fe15bad5b"},
|
|
||||||
{file = "pytest_repeat-0.9.1-py2.py3-none-any.whl", hash = "sha256:4474a7d9e9137f6d8cc8ae297f8c4168d33c56dd740aa78cfffe562557e6b96e"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[package.dependencies]
|
|
||||||
pytest = ">=3.6"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruff"
|
name = "ruff"
|
||||||
version = "0.1.3"
|
version = "0.8.6"
|
||||||
description = "An extremely fast Python linter, written in Rust."
|
description = "An extremely fast Python linter and code formatter, written in Rust."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "ruff-0.1.3-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:b46d43d51f7061652eeadb426a9e3caa1e0002470229ab2fc19de8a7b0766901"},
|
{file = "ruff-0.8.6-py3-none-linux_armv6l.whl", hash = "sha256:defed167955d42c68b407e8f2e6f56ba52520e790aba4ca707a9c88619e580e3"},
|
||||||
{file = "ruff-0.1.3-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:b8afeb9abd26b4029c72adc9921b8363374f4e7edb78385ffaa80278313a15f9"},
|
{file = "ruff-0.8.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:54799ca3d67ae5e0b7a7ac234baa657a9c1784b48ec954a094da7c206e0365b1"},
|
||||||
{file = "ruff-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca3cf365bf32e9ba7e6db3f48a4d3e2c446cd19ebee04f05338bc3910114528b"},
|
{file = "ruff-0.8.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e88b8f6d901477c41559ba540beeb5a671e14cd29ebd5683903572f4b40a9807"},
|
||||||
{file = "ruff-0.1.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4874c165f96c14a00590dcc727a04dca0cfd110334c24b039458c06cf78a672e"},
|
{file = "ruff-0.8.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0509e8da430228236a18a677fcdb0c1f102dd26d5520f71f79b094963322ed25"},
|
||||||
{file = "ruff-0.1.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eec2dd31eed114e48ea42dbffc443e9b7221976554a504767ceaee3dd38edeb8"},
|
{file = "ruff-0.8.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:91a7ddb221779871cf226100e677b5ea38c2d54e9e2c8ed847450ebbdf99b32d"},
|
||||||
{file = "ruff-0.1.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:dc3ec4edb3b73f21b4aa51337e16674c752f1d76a4a543af56d7d04e97769613"},
|
{file = "ruff-0.8.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:248b1fb3f739d01d528cc50b35ee9c4812aa58cc5935998e776bf8ed5b251e75"},
|
||||||
{file = "ruff-0.1.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2e3de9ed2e39160800281848ff4670e1698037ca039bda7b9274f849258d26ce"},
|
{file = "ruff-0.8.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:bc3c083c50390cf69e7e1b5a5a7303898966be973664ec0c4a4acea82c1d4315"},
|
||||||
{file = "ruff-0.1.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1c595193881922cc0556a90f3af99b1c5681f0c552e7a2a189956141d8666fe8"},
|
{file = "ruff-0.8.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:52d587092ab8df308635762386f45f4638badb0866355b2b86760f6d3c076188"},
|
||||||
{file = "ruff-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f75e670d529aa2288cd00fc0e9b9287603d95e1536d7a7e0cafe00f75e0dd9d"},
|
{file = "ruff-0.8.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:61323159cf21bc3897674e5adb27cd9e7700bab6b84de40d7be28c3d46dc67cf"},
|
||||||
{file = "ruff-0.1.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:76dd49f6cd945d82d9d4a9a6622c54a994689d8d7b22fa1322983389b4892e20"},
|
{file = "ruff-0.8.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7ae4478b1471fc0c44ed52a6fb787e641a2ac58b1c1f91763bafbc2faddc5117"},
|
||||||
{file = "ruff-0.1.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:918b454bc4f8874a616f0d725590277c42949431ceb303950e87fef7a7d94cb3"},
|
{file = "ruff-0.8.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:0c000a471d519b3e6cfc9c6680025d923b4ca140ce3e4612d1a2ef58e11f11fe"},
|
||||||
{file = "ruff-0.1.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d8859605e729cd5e53aa38275568dbbdb4fe882d2ea2714c5453b678dca83784"},
|
{file = "ruff-0.8.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:9257aa841e9e8d9b727423086f0fa9a86b6b420fbf4bf9e1465d1250ce8e4d8d"},
|
||||||
{file = "ruff-0.1.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:0b6c55f5ef8d9dd05b230bb6ab80bc4381ecb60ae56db0330f660ea240cb0d4a"},
|
{file = "ruff-0.8.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:45a56f61b24682f6f6709636949ae8cc82ae229d8d773b4c76c09ec83964a95a"},
|
||||||
{file = "ruff-0.1.3-py3-none-win32.whl", hash = "sha256:3e7afcbdcfbe3399c34e0f6370c30f6e529193c731b885316c5a09c9e4317eef"},
|
{file = "ruff-0.8.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:496dd38a53aa173481a7d8866bcd6451bd934d06976a2505028a50583e001b76"},
|
||||||
{file = "ruff-0.1.3-py3-none-win_amd64.whl", hash = "sha256:7a18df6638cec4a5bd75350639b2bb2a2366e01222825562c7346674bdceb7ea"},
|
{file = "ruff-0.8.6-py3-none-win32.whl", hash = "sha256:e169ea1b9eae61c99b257dc83b9ee6c76f89042752cb2d83486a7d6e48e8f764"},
|
||||||
{file = "ruff-0.1.3-py3-none-win_arm64.whl", hash = "sha256:12fd53696c83a194a2db7f9a46337ce06445fb9aa7d25ea6f293cf75b21aca9f"},
|
{file = "ruff-0.8.6-py3-none-win_amd64.whl", hash = "sha256:f1d70bef3d16fdc897ee290d7d20da3cbe4e26349f62e8a0274e7a3f4ce7a905"},
|
||||||
{file = "ruff-0.1.3.tar.gz", hash = "sha256:3ba6145369a151401d5db79f0a47d50e470384d0d89d0d6f7fab0b589ad07c34"},
|
{file = "ruff-0.8.6-py3-none-win_arm64.whl", hash = "sha256:7d7fc2377a04b6e04ffe588caad613d0c460eb2ecba4c0ccbbfe2bc973cbc162"},
|
||||||
|
{file = "ruff-0.8.6.tar.gz", hash = "sha256:dcad24b81b62650b0eb8814f576fc65cfee8674772a6e24c9b747911801eeaa5"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tomli"
|
name = "tomli"
|
||||||
version = "2.0.1"
|
version = "2.2.1"
|
||||||
description = "A lil' TOML parser"
|
description = "A lil' TOML parser"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.8"
|
||||||
|
groups = ["main", "dev"]
|
||||||
|
markers = "python_version == \"3.10\""
|
||||||
files = [
|
files = [
|
||||||
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
|
{file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"},
|
||||||
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
|
{file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"},
|
||||||
|
{file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"},
|
||||||
|
{file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tox"
|
name = "tox"
|
||||||
version = "4.6.3"
|
version = "4.23.2"
|
||||||
description = "tox is a generic virtualenv management and test command line tool"
|
description = "tox is a generic virtualenv management and test command line tool"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.8"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "tox-4.6.3-py3-none-any.whl", hash = "sha256:2946a0bb38924c3a9f9575c7fb4ca1f4c11a7c69c61592f176778892155cb50c"},
|
{file = "tox-4.23.2-py3-none-any.whl", hash = "sha256:452bc32bb031f2282881a2118923176445bac783ab97c874b8770ab4c3b76c38"},
|
||||||
{file = "tox-4.6.3.tar.gz", hash = "sha256:9e2c5091a117d03b583c57c4c40aecd068099c17d40520e7b165e85c19334534"},
|
{file = "tox-4.23.2.tar.gz", hash = "sha256:86075e00e555df6e82e74cfc333917f91ecb47ffbc868dcafbd2672e332f4a2c"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
cachetools = ">=5.3.1"
|
cachetools = ">=5.5"
|
||||||
chardet = ">=5.1"
|
chardet = ">=5.2"
|
||||||
colorama = ">=0.4.6"
|
colorama = ">=0.4.6"
|
||||||
filelock = ">=3.12.2"
|
filelock = ">=3.16.1"
|
||||||
packaging = ">=23.1"
|
packaging = ">=24.1"
|
||||||
platformdirs = ">=3.5.3"
|
platformdirs = ">=4.3.6"
|
||||||
pluggy = ">=1"
|
pluggy = ">=1.5"
|
||||||
pyproject-api = ">=1.5.2"
|
pyproject-api = ">=1.8"
|
||||||
tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""}
|
tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""}
|
||||||
virtualenv = ">=20.23.1"
|
typing-extensions = {version = ">=4.12.2", markers = "python_version < \"3.11\""}
|
||||||
|
virtualenv = ">=20.26.6"
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
docs = ["furo (>=2023.5.20)", "sphinx (>=7.0.1)", "sphinx-argparse-cli (>=1.11.1)", "sphinx-autodoc-typehints (>=1.23.2,!=1.23.4)", "sphinx-copybutton (>=0.5.2)", "sphinx-inline-tabs (>=2023.4.21)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"]
|
test = ["devpi-process (>=1.0.2)", "pytest (>=8.3.3)", "pytest-mock (>=3.14)"]
|
||||||
testing = ["build[virtualenv] (>=0.10)", "covdefaults (>=2.3)", "detect-test-pollution (>=1.1.1)", "devpi-process (>=0.3.1)", "diff-cover (>=7.6)", "distlib (>=0.3.6)", "flaky (>=3.7)", "hatch-vcs (>=0.3)", "hatchling (>=1.17.1)", "psutil (>=5.9.5)", "pytest (>=7.3.2)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)", "pytest-xdist (>=3.3.1)", "re-assert (>=1.1)", "time-machine (>=2.10)", "wheel (>=0.40)"]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typing-extensions"
|
name = "typing-extensions"
|
||||||
version = "4.10.0"
|
version = "4.15.0"
|
||||||
description = "Backported and Experimental Type Hints for Python 3.8+"
|
description = "Backported and Experimental Type Hints for Python 3.9+"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8"
|
python-versions = ">=3.9"
|
||||||
|
groups = ["dev"]
|
||||||
|
markers = "python_version == \"3.10\""
|
||||||
files = [
|
files = [
|
||||||
{file = "typing_extensions-4.10.0-py3-none-any.whl", hash = "sha256:69b1a937c3a517342112fb4c6df7e72fc39a38e7891a5730ed4985b5214b5475"},
|
{file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"},
|
||||||
{file = "typing_extensions-4.10.0.tar.gz", hash = "sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb"},
|
{file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "virtualenv"
|
name = "virtualenv"
|
||||||
version = "20.23.1"
|
version = "20.36.1"
|
||||||
description = "Virtual Python Environment builder"
|
description = "Virtual Python Environment builder"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.8"
|
||||||
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "virtualenv-20.23.1-py3-none-any.whl", hash = "sha256:34da10f14fea9be20e0fd7f04aba9732f84e593dac291b757ce42e3368a39419"},
|
{file = "virtualenv-20.36.1-py3-none-any.whl", hash = "sha256:575a8d6b124ef88f6f51d56d656132389f961062a9177016a50e4f507bbcc19f"},
|
||||||
{file = "virtualenv-20.23.1.tar.gz", hash = "sha256:8ff19a38c1021c742148edc4f81cb43d7f8c6816d2ede2ab72af5b84c749ade1"},
|
{file = "virtualenv-20.36.1.tar.gz", hash = "sha256:8befb5c81842c641f8ee658481e42641c68b5eab3521d8e092d18320902466ba"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
distlib = ">=0.3.6,<1"
|
distlib = ">=0.3.7,<1"
|
||||||
filelock = ">=3.12,<4"
|
filelock = {version = ">=3.20.1,<4", markers = "python_version >= \"3.10\""}
|
||||||
platformdirs = ">=3.5.1,<4"
|
platformdirs = ">=3.9.1,<5"
|
||||||
|
typing-extensions = {version = ">=4.13.2", markers = "python_version < \"3.11\""}
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
docs = ["furo (>=2023.5.20)", "proselint (>=0.13)", "sphinx (>=7.0.1)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"]
|
docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "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.3.1)", "pytest-env (>=0.8.1)", "pytest-freezer (>=0.4.6)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.8)", "time-machine (>=2.9)"]
|
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) ; platform_python_implementation == \"PyPy\" or platform_python_implementation == \"GraalVM\" or platform_python_implementation == \"CPython\" and sys_platform == \"win32\" and python_version >= \"3.13\"", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10) ; platform_python_implementation == \"CPython\""]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "virtualenv-pyenv"
|
||||||
|
version = "0.5.0"
|
||||||
|
description = "A virtualenv Python discovery plugin for pyenv-installed interpreters"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.8"
|
||||||
|
groups = ["dev"]
|
||||||
|
files = [
|
||||||
|
{file = "virtualenv-pyenv-0.5.0.tar.gz", hash = "sha256:7b0e5fe3dfbdf484f4cf9b01e1f98111e398db6942237910f666356e6293597f"},
|
||||||
|
{file = "virtualenv_pyenv-0.5.0-py3-none-any.whl", hash = "sha256:21750247e36c55b3c547cfdeb08f51a3867fe7129922991a4f9c96980c0a4a5d"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
pyenv-inspect = ">=0.4,<0.5"
|
||||||
|
virtualenv = "*"
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.1"
|
||||||
python-versions = "^3.10"
|
python-versions = ">=3.10"
|
||||||
content-hash = "d4193db5ebc240288a21da72fa78788dfb71c08b6ecd25e365ce7fb1b0f27ac4"
|
content-hash = "6339967c3f6cad8e4db7047ef3d12a5b059a279d0f7c98515c961477680bab8f"
|
||||||
|
|||||||
184
pyproject.toml
184
pyproject.toml
@@ -1,114 +1,47 @@
|
|||||||
[tool.poetry]
|
[project]
|
||||||
name = "voicemeeter-api"
|
name = "voicemeeter-api"
|
||||||
version = "2.6.0"
|
version = "2.7.2"
|
||||||
description = "A Python wrapper for the Voiceemeter API"
|
description = "A Python wrapper for the Voiceemeter API"
|
||||||
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
authors = [{ name = "Onyx and Iris", email = "code@onyxandiris.online" }]
|
||||||
license = "MIT"
|
license = { text = "MIT" }
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/onyx-and-iris/voicemeeter-api-python"
|
requires-python = ">=3.10"
|
||||||
|
dependencies = ["tomli (>=2.0.1,<3.0) ; python_version < '3.11'"]
|
||||||
|
|
||||||
|
[tool.poetry]
|
||||||
packages = [{ include = "voicemeeterlib" }]
|
packages = [{ include = "voicemeeterlib" }]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.requires-plugins]
|
||||||
python = "^3.10"
|
poethepoet = ">=0.42.0"
|
||||||
tomli = { version = "^2.0.1", python = "<3.11" }
|
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
pytest = "^7.4.4"
|
pytest = "^8.3.4"
|
||||||
pytest-randomly = "^3.12.0"
|
pytest-randomly = "^3.16.0"
|
||||||
pytest-repeat = "^0.9.1"
|
ruff = "^0.8.6"
|
||||||
black = ">=22.3,<25.0"
|
tox = "^4.23.2"
|
||||||
isort = "^5.10.1"
|
virtualenv-pyenv = "^0.5.0"
|
||||||
tox = "^4.6.3"
|
|
||||||
ruff = "^0.1.3"
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poe.tasks]
|
||||||
dsl = "scripts:ex_dsl"
|
dsl.script = "scripts:ex_dsl"
|
||||||
events = "scripts:ex_events"
|
callbacks.script = "scripts:ex_callbacks"
|
||||||
gui = "scripts:ex_gui"
|
gui.script = "scripts:ex_gui"
|
||||||
levels = "scripts:ex_levels"
|
levels.script = "scripts:ex_levels"
|
||||||
midi = "scripts:ex_midi"
|
midi.script = "scripts:ex_midi"
|
||||||
obs = "scripts:ex_obs"
|
obs.script = "scripts:ex_obs"
|
||||||
observer = "scripts:ex_observer"
|
observer.script = "scripts:ex_observer"
|
||||||
basic = "scripts:test_basic"
|
eqedit.script = "scripts:ex_eqedit"
|
||||||
banana = "scripts:test_banana"
|
test-basic.script = "scripts:test_basic"
|
||||||
potato = "scripts:test_potato"
|
test-banana.script = "scripts:test_banana"
|
||||||
all = "scripts:test_all"
|
test-potato.script = "scripts:test_potato"
|
||||||
|
test-all.script = "scripts:test_all"
|
||||||
|
generate-badges.script = "scripts:generate_badges"
|
||||||
|
|
||||||
[tool.tox]
|
|
||||||
legacy_tox_ini = """
|
|
||||||
[tox]
|
|
||||||
envlist = py310,py311,py312
|
|
||||||
|
|
||||||
[testenv]
|
|
||||||
allowlist_externals = poetry
|
|
||||||
commands =
|
|
||||||
poetry install -v
|
|
||||||
poetry run pytest tests/
|
|
||||||
"""
|
|
||||||
|
|
||||||
[tool.black]
|
|
||||||
line-length = 88
|
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
select = [
|
|
||||||
"E",
|
|
||||||
"F",
|
|
||||||
]
|
|
||||||
ignore = [
|
|
||||||
"E501",
|
|
||||||
]
|
|
||||||
fixable = [
|
|
||||||
"A",
|
|
||||||
"B",
|
|
||||||
"C",
|
|
||||||
"D",
|
|
||||||
"E",
|
|
||||||
"F",
|
|
||||||
"G",
|
|
||||||
"I",
|
|
||||||
"N",
|
|
||||||
"Q",
|
|
||||||
"S",
|
|
||||||
"T",
|
|
||||||
"W",
|
|
||||||
"ANN",
|
|
||||||
"ARG",
|
|
||||||
"BLE",
|
|
||||||
"COM",
|
|
||||||
"DJ",
|
|
||||||
"DTZ",
|
|
||||||
"EM",
|
|
||||||
"ERA",
|
|
||||||
"EXE",
|
|
||||||
"FBT",
|
|
||||||
"ICN",
|
|
||||||
"INP",
|
|
||||||
"ISC",
|
|
||||||
"NPY",
|
|
||||||
"PD",
|
|
||||||
"PGH",
|
|
||||||
"PIE",
|
|
||||||
"PL",
|
|
||||||
"PT",
|
|
||||||
"PTH",
|
|
||||||
"PYI",
|
|
||||||
"RET",
|
|
||||||
"RSE",
|
|
||||||
"RUF",
|
|
||||||
"SIM",
|
|
||||||
"SLF",
|
|
||||||
"TCH",
|
|
||||||
"TID",
|
|
||||||
"TRY",
|
|
||||||
"UP",
|
|
||||||
"YTT",
|
|
||||||
]
|
|
||||||
unfixable = []
|
|
||||||
exclude = [
|
exclude = [
|
||||||
".bzr",
|
".bzr",
|
||||||
".direnv",
|
".direnv",
|
||||||
@@ -132,15 +65,60 @@ exclude = [
|
|||||||
"node_modules",
|
"node_modules",
|
||||||
"venv",
|
"venv",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Same as Black.
|
||||||
line-length = 88
|
line-length = 88
|
||||||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
indent-width = 4
|
||||||
|
|
||||||
|
# Assume Python 3.10
|
||||||
target-version = "py310"
|
target-version = "py310"
|
||||||
|
|
||||||
[tool.ruff.mccabe]
|
[tool.ruff.lint]
|
||||||
|
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
||||||
|
# Enable flake8-errmsg (EM) warnings.
|
||||||
|
# Enable flake8-bugbear (B) warnings.
|
||||||
|
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
||||||
|
# McCabe complexity (`C901`) by default.
|
||||||
|
select = ["E4", "E7", "E9", "EM", "F", "B"]
|
||||||
|
ignore = []
|
||||||
|
|
||||||
|
# Allow fix for all enabled rules (when `--fix`) is provided.
|
||||||
|
fixable = ["ALL"]
|
||||||
|
unfixable = ["B"]
|
||||||
|
|
||||||
|
# Allow unused variables when underscore-prefixed.
|
||||||
|
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
||||||
|
|
||||||
|
|
||||||
|
[tool.ruff.format]
|
||||||
|
# Unlike Black, use single quotes for strings.
|
||||||
|
quote-style = "single"
|
||||||
|
|
||||||
|
# Like Black, indent with spaces, rather than tabs.
|
||||||
|
indent-style = "space"
|
||||||
|
|
||||||
|
# Like Black, respect magic trailing commas.
|
||||||
|
skip-magic-trailing-comma = false
|
||||||
|
|
||||||
|
# Like Black, automatically detect the appropriate line ending.
|
||||||
|
line-ending = "auto"
|
||||||
|
|
||||||
|
# Enable auto-formatting of code examples in docstrings. Markdown,
|
||||||
|
# reStructuredText code/literal blocks and doctests are all supported.
|
||||||
|
#
|
||||||
|
# This is currently disabled by default, but it is planned for this
|
||||||
|
# to be opt-out in the future.
|
||||||
|
docstring-code-format = false
|
||||||
|
|
||||||
|
# Set the line length limit used when formatting code snippets in
|
||||||
|
# docstrings.
|
||||||
|
#
|
||||||
|
# This only has an effect when the `docstring-code-format` setting is
|
||||||
|
# enabled.
|
||||||
|
docstring-code-line-length = "dynamic"
|
||||||
|
|
||||||
|
[tool.ruff.lint.mccabe]
|
||||||
max-complexity = 10
|
max-complexity = 10
|
||||||
|
|
||||||
[tool.ruff.per-file-ignores]
|
[tool.ruff.lint.per-file-ignores]
|
||||||
"__init__.py" = [
|
"__init__.py" = ["E402", "F401"]
|
||||||
"E402",
|
|
||||||
"F401",
|
|
||||||
]
|
|
||||||
|
|||||||
42
scripts.py
42
scripts.py
@@ -5,55 +5,63 @@ from pathlib import Path
|
|||||||
|
|
||||||
|
|
||||||
def ex_dsl():
|
def ex_dsl():
|
||||||
scriptpath = Path.cwd() / "examples" / "dsl" / "."
|
subprocess.run(['tox', 'r', '-e', 'dsl'])
|
||||||
subprocess.run([sys.executable, str(scriptpath)])
|
|
||||||
|
|
||||||
|
|
||||||
def ex_events():
|
def ex_callbacks():
|
||||||
scriptpath = Path.cwd() / "examples" / "events" / "."
|
scriptpath = Path.cwd() / 'examples' / 'events' / 'callbacks' / '.'
|
||||||
subprocess.run([sys.executable, str(scriptpath)])
|
subprocess.run([sys.executable, str(scriptpath)])
|
||||||
|
|
||||||
|
|
||||||
def ex_gui():
|
def ex_gui():
|
||||||
scriptpath = Path.cwd() / "examples" / "gui" / "."
|
scriptpath = Path.cwd() / 'examples' / 'gui' / '.'
|
||||||
subprocess.run([sys.executable, str(scriptpath)])
|
subprocess.run([sys.executable, str(scriptpath)])
|
||||||
|
|
||||||
|
|
||||||
def ex_levels():
|
def ex_levels():
|
||||||
scriptpath = Path.cwd() / "examples" / "levels" / "."
|
scriptpath = Path.cwd() / 'examples' / 'levels' / '.'
|
||||||
subprocess.run([sys.executable, str(scriptpath)])
|
subprocess.run([sys.executable, str(scriptpath)])
|
||||||
|
|
||||||
|
|
||||||
def ex_midi():
|
def ex_midi():
|
||||||
scriptpath = Path.cwd() / "examples" / "midi" / "."
|
scriptpath = Path.cwd() / 'examples' / 'midi' / '.'
|
||||||
subprocess.run([sys.executable, str(scriptpath)])
|
subprocess.run([sys.executable, str(scriptpath)])
|
||||||
|
|
||||||
|
|
||||||
def ex_obs():
|
def ex_obs():
|
||||||
scriptpath = Path.cwd() / "examples" / "obs" / "."
|
subprocess.run(['tox', 'r', '-e', 'obs'])
|
||||||
subprocess.run([sys.executable, str(scriptpath)])
|
|
||||||
|
|
||||||
|
|
||||||
def ex_observer():
|
def ex_observer():
|
||||||
scriptpath = Path.cwd() / "examples" / "observer" / "."
|
scriptpath = Path.cwd() / 'examples' / 'events' / 'observer' / '.'
|
||||||
|
subprocess.run([sys.executable, str(scriptpath)])
|
||||||
|
|
||||||
|
|
||||||
|
def ex_eqedit():
|
||||||
|
scriptpath = Path.cwd() / 'examples' / 'eq_edit' / '.'
|
||||||
subprocess.run([sys.executable, str(scriptpath)])
|
subprocess.run([sys.executable, str(scriptpath)])
|
||||||
|
|
||||||
|
|
||||||
def test_basic():
|
def test_basic():
|
||||||
os.environ["KIND"] = "basic"
|
subprocess.run(['tox'], env=os.environ.copy() | {'KIND': 'basic'})
|
||||||
subprocess.run(["tox"])
|
|
||||||
|
|
||||||
|
|
||||||
def test_banana():
|
def test_banana():
|
||||||
os.environ["KIND"] = "banana"
|
subprocess.run(['tox'], env=os.environ.copy() | {'KIND': 'banana'})
|
||||||
subprocess.run(["tox"])
|
|
||||||
|
|
||||||
|
|
||||||
def test_potato():
|
def test_potato():
|
||||||
os.environ["KIND"] = "potato"
|
subprocess.run(['tox'], env=os.environ.copy() | {'KIND': 'potato'})
|
||||||
subprocess.run(["tox"])
|
|
||||||
|
|
||||||
|
|
||||||
def test_all():
|
def test_all():
|
||||||
steps = [test_basic, test_banana, test_potato]
|
steps = [test_basic, test_banana, test_potato]
|
||||||
[step() for step in steps]
|
for step in steps:
|
||||||
|
step()
|
||||||
|
|
||||||
|
|
||||||
|
def generate_badges():
|
||||||
|
for kind in ['basic', 'banana', 'potato']:
|
||||||
|
subprocess.run(
|
||||||
|
['tox', 'r', '-e', 'genbadge'], env=os.environ.copy() | {'KIND': kind}
|
||||||
|
)
|
||||||
|
|||||||
@@ -31,10 +31,8 @@ class Data:
|
|||||||
return (2 * self.phys_in) + (8 * self.virt_in)
|
return (2 * self.phys_in) + (8 * self.virt_in)
|
||||||
|
|
||||||
|
|
||||||
# get KIND_ID from env var, otherwise set to random
|
# get KIND from environment, if not set default to potato
|
||||||
KIND_ID = os.environ.get(
|
KIND_ID = os.environ.get('KIND', 'potato')
|
||||||
"KIND", random.choice(tuple(kind_id.name.lower() for kind_id in KindId))
|
|
||||||
)
|
|
||||||
vm = voicemeeterlib.api(KIND_ID)
|
vm = voicemeeterlib.api(KIND_ID)
|
||||||
kind = kindmap(KIND_ID)
|
kind = kindmap(KIND_ID)
|
||||||
|
|
||||||
@@ -56,7 +54,7 @@ data = Data(
|
|||||||
|
|
||||||
|
|
||||||
def setup_module():
|
def setup_module():
|
||||||
print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout)
|
print(f'\nRunning tests for kind [{data.name}]\n', file=sys.stdout)
|
||||||
vm.login()
|
vm.login()
|
||||||
vm.command.reset()
|
vm.command.reset()
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
parser.addoption(
|
parser.addoption(
|
||||||
"--run-slow",
|
'--run-slow',
|
||||||
action="store_true",
|
action='store_true',
|
||||||
default=False,
|
default=False,
|
||||||
help="Run slow tests",
|
help='Run slow tests',
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
Function RunTests {
|
|
||||||
$coverage = "./tests/pytest_coverage.log"
|
|
||||||
$run_tests = "pytest --run-slow -v --capture=tee-sys --junitxml=./tests/.coverage.xml"
|
|
||||||
$match_pattern = "^=|^\s*$|^Running|^Using|^plugins|^collecting|^tests"
|
|
||||||
|
|
||||||
if ( Test-Path $coverage ) { Clear-Content $coverage }
|
|
||||||
|
|
||||||
ForEach ($line in $(Invoke-Expression $run_tests)) {
|
|
||||||
If ( $line -Match $match_pattern ) {
|
|
||||||
if ( $line -Match "^Running tests for kind \[(\w+)\]" ) { $kind = $Matches[1] }
|
|
||||||
$line | Tee-Object -FilePath $coverage -Append
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Write-Output "$(Get-TimeStamp)" | Out-File $coverage -Append
|
|
||||||
|
|
||||||
Invoke-Expression "genbadge tests -t 90 -i ./tests/.coverage.xml -o ./tests/$kind.svg"
|
|
||||||
}
|
|
||||||
|
|
||||||
Function Get-TimeStamp {
|
|
||||||
|
|
||||||
return "[{0:MM/dd/yy} {0:HH:mm:ss}]" -f (Get-Date)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($MyInvocation.InvocationName -ne ".") {
|
|
||||||
Invoke-Expression ".\.venv\Scripts\Activate.ps1"
|
|
||||||
|
|
||||||
@("potato") | ForEach-Object {
|
|
||||||
$env:KIND = $_
|
|
||||||
RunTests
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Invoke-Expression "deactivate"
|
|
||||||
}
|
|
||||||
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 184"><title>tests: 184</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">184</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">184</text></g></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 158"><title>tests: 158</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">158</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">158</text></g></svg>
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 159"><title>tests: 159</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">159</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">159</text></g></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 115"><title>tests: 115</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">115</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">115</text></g></svg>
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 116"><title>tests: 116</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">116</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">116</text></g></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="68" height="20" role="img" aria-label="tests: 183"><title>tests: 183</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="68" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="31" height="20" fill="#4c1"/><rect width="68" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="515" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">183</text><text x="515" y="140" transform="scale(.1)" fill="#fff" textLength="210">183</text></g></svg>
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -10,37 +10,37 @@ class TestUserConfigs:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_class(cls):
|
def setup_class(cls):
|
||||||
vm.apply_config("example")
|
vm.apply_config('example')
|
||||||
|
|
||||||
def test_it_tests_vm_config_string(self):
|
def test_it_tests_vm_config_string(self):
|
||||||
assert "PhysStrip" in vm.strip[data.phys_in].label
|
assert 'PhysStrip' in vm.strip[data.phys_in].label
|
||||||
assert "VirtStrip" in vm.strip[data.virt_in].label
|
assert 'VirtStrip' in vm.strip[data.virt_in].label
|
||||||
assert "PhysBus" in vm.bus[data.phys_out].label
|
assert 'PhysBus' in vm.bus[data.phys_out].label
|
||||||
assert "VirtBus" in vm.bus[data.virt_out].label
|
assert 'VirtBus' in vm.bus[data.virt_out].label
|
||||||
|
|
||||||
def test_it_tests_vm_config_bool(self):
|
def test_it_tests_vm_config_bool(self):
|
||||||
assert vm.strip[0].A1 == True
|
assert vm.strip[0].A1 == True
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "potato",
|
data.name != 'potato',
|
||||||
reason="Skip test if kind is not potato",
|
reason='Skip test if kind is not potato',
|
||||||
)
|
)
|
||||||
def test_it_tests_vm_config_bool_strip_eq_on(self):
|
def test_it_tests_vm_config_bool_strip_eq_on(self):
|
||||||
assert vm.strip[data.phys_in].eq.on == True
|
assert vm.strip[data.phys_in].eq.on == True
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "banana",
|
data.name != 'banana',
|
||||||
reason="Skip test if kind is not banana",
|
reason='Skip test if kind is not banana',
|
||||||
)
|
)
|
||||||
def test_it_tests_vm_config_bool_bus_eq_ab(self):
|
def test_it_tests_vm_config_bool_bus_eq_ab(self):
|
||||||
assert vm.bus[data.phys_out].eq.ab == True
|
assert vm.bus[data.phys_out].eq.ab == True
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
"not config.getoption('--run-slow')",
|
"not config.getoption('--run-slow')",
|
||||||
reason="Only run when --run-slow is given",
|
reason='Only run when --run-slow is given',
|
||||||
)
|
)
|
||||||
def test_it_tests_vm_config_busmode(self):
|
def test_it_tests_vm_config_busmode(self):
|
||||||
assert vm.bus[data.phys_out].mode.get() == "composite"
|
assert vm.bus[data.phys_out].mode.get() == 'composite'
|
||||||
|
|
||||||
def test_it_tests_vm_config_bass_med_high(self):
|
def test_it_tests_vm_config_bass_med_high(self):
|
||||||
assert vm.strip[data.virt_in].bass == -3.2
|
assert vm.strip[data.virt_in].bass == -3.2
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import re
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import voicemeeterlib
|
import voicemeeterlib
|
||||||
from tests import data, vm
|
from tests import vm
|
||||||
|
|
||||||
|
|
||||||
class TestErrors:
|
class TestErrors:
|
||||||
@@ -14,36 +14,36 @@ class TestErrors:
|
|||||||
voicemeeterlib.error.VMError,
|
voicemeeterlib.error.VMError,
|
||||||
match="Unknown Voicemeeter kind 'unknown_kind'",
|
match="Unknown Voicemeeter kind 'unknown_kind'",
|
||||||
):
|
):
|
||||||
voicemeeterlib.api("unknown_kind")
|
voicemeeterlib.api('unknown_kind')
|
||||||
|
|
||||||
def test_it_tests_an_unknown_parameter(self):
|
def test_it_tests_an_unknown_parameter(self):
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
voicemeeterlib.error.CAPIError,
|
voicemeeterlib.error.CAPIError,
|
||||||
match="VBVMR_SetParameterFloat returned -3",
|
match='VBVMR_SetParameterFloat returned -3',
|
||||||
) as exc_info:
|
) as exc_info:
|
||||||
vm.set("unknown.parameter", 1)
|
vm.set('unknown.parameter', 1)
|
||||||
|
|
||||||
e = exc_info.value
|
e = exc_info.value
|
||||||
assert e.code == -3
|
assert e.code == -3
|
||||||
assert e.fn_name == "VBVMR_SetParameterFloat"
|
assert e.fn_name == 'VBVMR_SetParameterFloat'
|
||||||
|
|
||||||
def test_it_tests_an_unknown_config_name(self):
|
def test_it_tests_an_unknown_config_name(self):
|
||||||
EXPECTED_MSG = (
|
EXPECTED_MSG = (
|
||||||
"No config with name 'unknown' is loaded into memory",
|
"No config with name 'unknown' is loaded into memory",
|
||||||
f"Known configs: {list(vm.configs.keys())}",
|
f'Known configs: {list(vm.configs.keys())}',
|
||||||
)
|
)
|
||||||
|
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
voicemeeterlib.error.VMError, match=re.escape("\n".join(EXPECTED_MSG))
|
voicemeeterlib.error.VMError, match=re.escape('\n'.join(EXPECTED_MSG))
|
||||||
):
|
):
|
||||||
vm.apply_config("unknown")
|
vm.apply_config('unknown')
|
||||||
|
|
||||||
def test_it_tests_an_invalid_config_key(self):
|
def test_it_tests_an_invalid_config_key(self):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"strip-0": {"A1": True, "B1": True, "gain": -6.0},
|
'strip-0': {'A1': True, 'B1': True, 'gain': -6.0},
|
||||||
"bus-0": {"mute": True, "eq": {"on": True}},
|
'bus-0': {'mute': True, 'eq': {'on': True}},
|
||||||
"unknown-0": {"state": True},
|
'unknown-0': {'state': True},
|
||||||
"vban-out-1": {"name": "streamname"},
|
'vban-out-1': {'name': 'streamname'},
|
||||||
}
|
}
|
||||||
with pytest.raises(ValueError, match="invalid config key 'unknown-0'"):
|
with pytest.raises(ValueError, match="invalid config key 'unknown-0'"):
|
||||||
vm.apply(CONFIG)
|
vm.apply(CONFIG)
|
||||||
|
|||||||
@@ -7,17 +7,17 @@ class TestRemoteFactories:
|
|||||||
__test__ = True
|
__test__ = True
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "basic",
|
data.name != 'basic',
|
||||||
reason="Skip test if kind is not basic",
|
reason='Skip test if kind is not basic',
|
||||||
)
|
)
|
||||||
def test_it_tests_vm_remote_attrs_for_basic(self):
|
def test_it_tests_vm_remote_attrs_for_basic(self):
|
||||||
assert hasattr(vm, "strip")
|
assert hasattr(vm, 'strip')
|
||||||
assert hasattr(vm, "bus")
|
assert hasattr(vm, 'bus')
|
||||||
assert hasattr(vm, "command")
|
assert hasattr(vm, 'command')
|
||||||
assert hasattr(vm, "button")
|
assert hasattr(vm, 'button')
|
||||||
assert hasattr(vm, "vban")
|
assert hasattr(vm, 'vban')
|
||||||
assert hasattr(vm, "device")
|
assert hasattr(vm, 'device')
|
||||||
assert hasattr(vm, "option")
|
assert hasattr(vm, 'option')
|
||||||
|
|
||||||
assert len(vm.strip) == 3
|
assert len(vm.strip) == 3
|
||||||
assert len(vm.bus) == 2
|
assert len(vm.bus) == 2
|
||||||
@@ -25,19 +25,19 @@ class TestRemoteFactories:
|
|||||||
assert len(vm.vban.instream) == 6 and len(vm.vban.outstream) == 5
|
assert len(vm.vban.instream) == 6 and len(vm.vban.outstream) == 5
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "banana",
|
data.name != 'banana',
|
||||||
reason="Skip test if kind is not banana",
|
reason='Skip test if kind is not banana',
|
||||||
)
|
)
|
||||||
def test_it_tests_vm_remote_attrs_for_banana(self):
|
def test_it_tests_vm_remote_attrs_for_banana(self):
|
||||||
assert hasattr(vm, "strip")
|
assert hasattr(vm, 'strip')
|
||||||
assert hasattr(vm, "bus")
|
assert hasattr(vm, 'bus')
|
||||||
assert hasattr(vm, "command")
|
assert hasattr(vm, 'command')
|
||||||
assert hasattr(vm, "button")
|
assert hasattr(vm, 'button')
|
||||||
assert hasattr(vm, "vban")
|
assert hasattr(vm, 'vban')
|
||||||
assert hasattr(vm, "device")
|
assert hasattr(vm, 'device')
|
||||||
assert hasattr(vm, "option")
|
assert hasattr(vm, 'option')
|
||||||
assert hasattr(vm, "recorder")
|
assert hasattr(vm, 'recorder')
|
||||||
assert hasattr(vm, "patch")
|
assert hasattr(vm, 'patch')
|
||||||
|
|
||||||
assert len(vm.strip) == 5
|
assert len(vm.strip) == 5
|
||||||
assert len(vm.bus) == 5
|
assert len(vm.bus) == 5
|
||||||
@@ -45,20 +45,20 @@ class TestRemoteFactories:
|
|||||||
assert len(vm.vban.instream) == 10 and len(vm.vban.outstream) == 9
|
assert len(vm.vban.instream) == 10 and len(vm.vban.outstream) == 9
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "potato",
|
data.name != 'potato',
|
||||||
reason="Skip test if kind is not potato",
|
reason='Skip test if kind is not potato',
|
||||||
)
|
)
|
||||||
def test_it_tests_vm_remote_attrs_for_potato(self):
|
def test_it_tests_vm_remote_attrs_for_potato(self):
|
||||||
assert hasattr(vm, "strip")
|
assert hasattr(vm, 'strip')
|
||||||
assert hasattr(vm, "bus")
|
assert hasattr(vm, 'bus')
|
||||||
assert hasattr(vm, "command")
|
assert hasattr(vm, 'command')
|
||||||
assert hasattr(vm, "button")
|
assert hasattr(vm, 'button')
|
||||||
assert hasattr(vm, "vban")
|
assert hasattr(vm, 'vban')
|
||||||
assert hasattr(vm, "device")
|
assert hasattr(vm, 'device')
|
||||||
assert hasattr(vm, "option")
|
assert hasattr(vm, 'option')
|
||||||
assert hasattr(vm, "recorder")
|
assert hasattr(vm, 'recorder')
|
||||||
assert hasattr(vm, "patch")
|
assert hasattr(vm, 'patch')
|
||||||
assert hasattr(vm, "fx")
|
assert hasattr(vm, 'fx')
|
||||||
|
|
||||||
assert len(vm.strip) == 8
|
assert len(vm.strip) == 8
|
||||||
assert len(vm.bus) == 8
|
assert len(vm.bus) == 8
|
||||||
|
|||||||
@@ -3,19 +3,18 @@ import pytest
|
|||||||
from tests import data, vm
|
from tests import data, vm
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("value", [False, True])
|
@pytest.mark.parametrize('value', [False, True])
|
||||||
class TestSetAndGetBoolHigher:
|
class TestSetAndGetBoolHigher:
|
||||||
__test__ = True
|
__test__ = True
|
||||||
|
|
||||||
"""strip tests, physical and virtual"""
|
"""strip tests, physical and virtual"""
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param",
|
'index,param',
|
||||||
[
|
[
|
||||||
(data.phys_in, "mute"),
|
(data.phys_in, 'mute'),
|
||||||
(data.phys_in, "mono"),
|
(data.phys_in, 'mono'),
|
||||||
(data.virt_in, "mc"),
|
(data.virt_in, 'mc'),
|
||||||
(data.virt_in, "mono"),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_bool_params(self, index, param, value):
|
||||||
@@ -25,14 +24,14 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" strip EQ tests, physical """
|
""" strip EQ tests, physical """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "potato",
|
data.name != 'potato',
|
||||||
reason="Skip test if kind is not potato",
|
reason='Skip test if kind is not potato',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param",
|
'index,param',
|
||||||
[
|
[
|
||||||
(data.phys_in, "on"),
|
(data.phys_in, 'on'),
|
||||||
(data.phys_in, "ab"),
|
(data.phys_in, 'ab'),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_eq_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_eq_bool_params(self, index, param, value):
|
||||||
@@ -43,10 +42,10 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" bus tests, physical and virtual """
|
""" bus tests, physical and virtual """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param",
|
'index,param',
|
||||||
[
|
[
|
||||||
(data.phys_out, "mute"),
|
(data.phys_out, 'mute'),
|
||||||
(data.virt_out, "sel"),
|
(data.virt_out, 'sel'),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_bus_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_bus_bool_params(self, index, param, value):
|
||||||
@@ -57,10 +56,10 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" bus EQ tests, physical and virtual """
|
""" bus EQ tests, physical and virtual """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param",
|
'index,param',
|
||||||
[
|
[
|
||||||
(data.phys_out, "on"),
|
(data.phys_out, 'on'),
|
||||||
(data.virt_out, "ab"),
|
(data.virt_out, 'ab'),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_bus_eq_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_bus_eq_bool_params(self, index, param, value):
|
||||||
@@ -71,16 +70,16 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" bus modes tests, physical and virtual """
|
""" bus modes tests, physical and virtual """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "basic",
|
data.name != 'basic',
|
||||||
reason="Skip test if kind is not basic",
|
reason='Skip test if kind is not basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param",
|
'index,param',
|
||||||
[
|
[
|
||||||
(data.phys_out, "normal"),
|
(data.phys_out, 'normal'),
|
||||||
(data.phys_out, "amix"),
|
(data.phys_out, 'amix'),
|
||||||
(data.virt_out, "normal"),
|
(data.virt_out, 'normal'),
|
||||||
(data.virt_out, "composite"),
|
(data.virt_out, 'composite'),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_busmode_basic_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_busmode_basic_bool_params(self, index, param, value):
|
||||||
@@ -88,18 +87,18 @@ class TestSetAndGetBoolHigher:
|
|||||||
assert getattr(vm.bus[index].mode, param) == value
|
assert getattr(vm.bus[index].mode, param) == value
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param",
|
'index,param',
|
||||||
[
|
[
|
||||||
(data.phys_out, "normal"),
|
(data.phys_out, 'normal'),
|
||||||
(data.phys_out, "amix"),
|
(data.phys_out, 'amix'),
|
||||||
(data.phys_out, "rearonly"),
|
(data.phys_out, 'rearonly'),
|
||||||
(data.virt_out, "normal"),
|
(data.virt_out, 'normal'),
|
||||||
(data.virt_out, "upmix41"),
|
(data.virt_out, 'upmix41'),
|
||||||
(data.virt_out, "composite"),
|
(data.virt_out, 'composite'),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_busmode_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_busmode_bool_params(self, index, param, value):
|
||||||
@@ -109,8 +108,8 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" macrobutton tests """
|
""" macrobutton tests """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param",
|
'index,param',
|
||||||
[(data.button_lower, "state"), (data.button_upper, "trigger")],
|
[(data.button_lower, 'state'), (data.button_upper, 'trigger')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_macrobutton_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_macrobutton_bool_params(self, index, param, value):
|
||||||
setattr(vm.button[index], param, value)
|
setattr(vm.button[index], param, value)
|
||||||
@@ -119,8 +118,8 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" vban instream tests """
|
""" vban instream tests """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param",
|
'index,param',
|
||||||
[(data.vban_in, "on")],
|
[(data.vban_in, 'on')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_vban_instream_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_vban_instream_bool_params(self, index, param, value):
|
||||||
setattr(vm.vban.instream[index], param, value)
|
setattr(vm.vban.instream[index], param, value)
|
||||||
@@ -129,8 +128,8 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" vban outstream tests """
|
""" vban outstream tests """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param",
|
'index,param',
|
||||||
[(data.vban_out, "on")],
|
[(data.vban_out, 'on')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_vban_outstream_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_vban_outstream_bool_params(self, index, param, value):
|
||||||
setattr(vm.vban.outstream[index], param, value)
|
setattr(vm.vban.outstream[index], param, value)
|
||||||
@@ -139,8 +138,8 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" command tests """
|
""" command tests """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"param",
|
'param',
|
||||||
[("lock")],
|
[('lock')],
|
||||||
)
|
)
|
||||||
def test_it_sets_command_bool_params(self, param, value):
|
def test_it_sets_command_bool_params(self, param, value):
|
||||||
setattr(vm.command, param, value)
|
setattr(vm.command, param, value)
|
||||||
@@ -148,12 +147,12 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" recorder tests """
|
""" recorder tests """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"param",
|
'param',
|
||||||
[("A1"), ("B2")],
|
[('A1'), ('B2')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_recorder_bool_params(self, param, value):
|
def test_it_sets_and_gets_recorder_bool_params(self, param, value):
|
||||||
assert hasattr(vm.recorder, param)
|
assert hasattr(vm.recorder, param)
|
||||||
@@ -161,12 +160,12 @@ class TestSetAndGetBoolHigher:
|
|||||||
assert getattr(vm.recorder, param) == value
|
assert getattr(vm.recorder, param) == value
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"param",
|
'param',
|
||||||
[("loop")],
|
[('loop')],
|
||||||
)
|
)
|
||||||
def test_it_sets_recorder_bool_params(self, param, value):
|
def test_it_sets_recorder_bool_params(self, param, value):
|
||||||
assert hasattr(vm.recorder, param)
|
assert hasattr(vm.recorder, param)
|
||||||
@@ -176,12 +175,12 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" recoder.mode tests """
|
""" recoder.mode tests """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"param",
|
'param',
|
||||||
[("loop"), ("recbus")],
|
[('loop'), ('recbus')],
|
||||||
)
|
)
|
||||||
def test_it_sets_recorder_mode_bool_params(self, param, value):
|
def test_it_sets_recorder_mode_bool_params(self, param, value):
|
||||||
assert hasattr(vm.recorder.mode, param)
|
assert hasattr(vm.recorder.mode, param)
|
||||||
@@ -191,11 +190,11 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" recorder.armstrip """
|
""" recorder.armstrip """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index",
|
'index',
|
||||||
[
|
[
|
||||||
(data.phys_out),
|
(data.phys_out),
|
||||||
(data.virt_out),
|
(data.virt_out),
|
||||||
@@ -207,11 +206,11 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" recorder.armbus """
|
""" recorder.armbus """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index",
|
'index',
|
||||||
[
|
[
|
||||||
(data.phys_out),
|
(data.phys_out),
|
||||||
(data.virt_out),
|
(data.virt_out),
|
||||||
@@ -223,12 +222,12 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" fx tests """
|
""" fx tests """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "potato",
|
data.name != 'potato',
|
||||||
reason="Skip test if kind is not potato",
|
reason='Skip test if kind is not potato',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"param",
|
'param',
|
||||||
[("reverb"), ("reverb_ab"), ("delay"), ("delay_ab")],
|
[('reverb'), ('reverb_ab'), ('delay'), ('delay_ab')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_fx_bool_params(self, param, value):
|
def test_it_sets_and_gets_fx_bool_params(self, param, value):
|
||||||
setattr(vm.fx, param, value)
|
setattr(vm.fx, param, value)
|
||||||
@@ -237,12 +236,12 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" patch tests """
|
""" patch tests """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"param",
|
'param',
|
||||||
[("postfadercomposite")],
|
[('postfadercomposite')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_patch_bool_params(self, param, value):
|
def test_it_sets_and_gets_patch_bool_params(self, param, value):
|
||||||
setattr(vm.patch, param, value)
|
setattr(vm.patch, param, value)
|
||||||
@@ -251,12 +250,12 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" patch.insert tests """
|
""" patch.insert tests """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param",
|
'index, param',
|
||||||
[(data.insert_lower, "on"), (data.insert_higher, "on")],
|
[(data.insert_lower, 'on'), (data.insert_higher, 'on')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_patch_insert_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_patch_insert_bool_params(self, index, param, value):
|
||||||
setattr(vm.patch.insert[index], param, value)
|
setattr(vm.patch.insert[index], param, value)
|
||||||
@@ -265,8 +264,8 @@ class TestSetAndGetBoolHigher:
|
|||||||
""" option tests """
|
""" option tests """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"param",
|
'param',
|
||||||
[("monitoronsel")],
|
[('monitoronsel')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_option_bool_params(self, param, value):
|
def test_it_sets_and_gets_option_bool_params(self, param, value):
|
||||||
setattr(vm.option, param, value)
|
setattr(vm.option, param, value)
|
||||||
@@ -279,36 +278,49 @@ class TestSetAndGetIntHigher:
|
|||||||
"""strip tests, physical and virtual"""
|
"""strip tests, physical and virtual"""
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param,value",
|
'index,param,value',
|
||||||
[
|
[
|
||||||
(data.phys_in, "limit", -40),
|
(data.phys_in, 'limit', -40),
|
||||||
(data.phys_in, "limit", 12),
|
(data.phys_in, 'limit', 12),
|
||||||
(data.virt_in, "k", 0),
|
(data.virt_in - 1, 'k', 0),
|
||||||
(data.virt_in, "k", 4),
|
(data.virt_in - 1, 'k', 4),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_int_params(self, index, param, value):
|
||||||
setattr(vm.strip[index], param, value)
|
setattr(vm.strip[index], param, value)
|
||||||
assert getattr(vm.strip[index], param) == value
|
assert getattr(vm.strip[index], param) == value
|
||||||
|
|
||||||
|
""" bus tests, physical """
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'index,param,value',
|
||||||
|
[
|
||||||
|
(data.phys_out, 'mono', 0),
|
||||||
|
(data.phys_out, 'mono', 2),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_it_sets_and_gets_bus_int_params(self, index, param, value):
|
||||||
|
setattr(vm.bus[index], param, value)
|
||||||
|
assert getattr(vm.bus[index], param) == value
|
||||||
|
|
||||||
""" vban outstream tests """
|
""" vban outstream tests """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param,value",
|
'index,param,value',
|
||||||
[(data.vban_out, "sr", 48000)],
|
[(data.vban_out, 'sr', 48000)],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_vban_outstream_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_vban_outstream_int_params(self, index, param, value):
|
||||||
setattr(vm.vban.outstream[index], param, value)
|
setattr(vm.vban.outstream[index], param, value)
|
||||||
assert getattr(vm.vban.outstream[index], param) == value
|
assert getattr(vm.vban.outstream[index], param) == value
|
||||||
|
|
||||||
""" patch.asio tests """
|
""" patch.asio tests """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,value",
|
'index,value',
|
||||||
[
|
[
|
||||||
(0, 1),
|
(0, 1),
|
||||||
(data.asio_in, 4),
|
(data.asio_in, 4),
|
||||||
@@ -321,11 +333,11 @@ class TestSetAndGetIntHigher:
|
|||||||
""" patch.A2[i]-A5[i] tests """
|
""" patch.A2[i]-A5[i] tests """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,value",
|
'index,value',
|
||||||
[
|
[
|
||||||
(0, 1),
|
(0, 1),
|
||||||
(data.asio_out, 4),
|
(data.asio_out, 4),
|
||||||
@@ -340,11 +352,11 @@ class TestSetAndGetIntHigher:
|
|||||||
""" patch.composite tests """
|
""" patch.composite tests """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,value",
|
'index,value',
|
||||||
[
|
[
|
||||||
(0, 3),
|
(0, 3),
|
||||||
(0, data.channels),
|
(0, data.channels),
|
||||||
@@ -359,11 +371,11 @@ class TestSetAndGetIntHigher:
|
|||||||
""" option tests """
|
""" option tests """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,value",
|
'index,value',
|
||||||
[
|
[
|
||||||
(data.phys_out, 30),
|
(data.phys_out, 30),
|
||||||
(data.phys_out, 500),
|
(data.phys_out, 500),
|
||||||
@@ -376,16 +388,16 @@ class TestSetAndGetIntHigher:
|
|||||||
""" recorder tests """
|
""" recorder tests """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "basic",
|
data.name == 'basic',
|
||||||
reason="Skip test if kind is basic",
|
reason='Skip test if kind is basic',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"param,value",
|
'param,value',
|
||||||
[
|
[
|
||||||
("samplerate", 32000),
|
('samplerate', 32000),
|
||||||
("samplerate", 96000),
|
('samplerate', 96000),
|
||||||
("bitresolution", 16),
|
('bitresolution', 16),
|
||||||
("bitresolution", 32),
|
('bitresolution', 32),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_recorder_int_params(self, param, value):
|
def test_it_sets_and_gets_recorder_int_params(self, param, value):
|
||||||
@@ -400,10 +412,10 @@ class TestSetAndGetFloatHigher:
|
|||||||
"""strip tests, physical and virtual"""
|
"""strip tests, physical and virtual"""
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param,value",
|
'index,param,value',
|
||||||
[
|
[
|
||||||
(data.phys_in, "gain", -3.6),
|
(data.phys_in, 'gain', -3.6),
|
||||||
(data.virt_in, "gain", 5.8),
|
(data.virt_in, 'gain', 5.8),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_float_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_float_params(self, index, param, value):
|
||||||
@@ -411,25 +423,25 @@ class TestSetAndGetFloatHigher:
|
|||||||
assert getattr(vm.strip[index], param) == value
|
assert getattr(vm.strip[index], param) == value
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,value",
|
'index,value',
|
||||||
[(data.phys_in, 2), (data.phys_in, 2), (data.virt_in, 8), (data.virt_in, 8)],
|
[(data.phys_in, 2), (data.phys_in, 2), (data.virt_in, 8), (data.virt_in, 8)],
|
||||||
)
|
)
|
||||||
def test_it_gets_prefader_levels_and_compares_length_of_array(self, index, value):
|
def test_it_gets_prefader_levels_and_compares_length_of_array(self, index, value):
|
||||||
assert len(vm.strip[index].levels.prefader) == value
|
assert len(vm.strip[index].levels.prefader) == value
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,value",
|
'index,value',
|
||||||
[(data.phys_in, 2), (data.phys_in, 2), (data.virt_in, 8), (data.virt_in, 8)],
|
[(data.phys_in, 2), (data.phys_in, 2), (data.virt_in, 8), (data.virt_in, 8)],
|
||||||
)
|
)
|
||||||
def test_it_gets_postmute_levels_and_compares_length_of_array(self, index, value):
|
def test_it_gets_postmute_levels_and_compares_length_of_array(self, index, value):
|
||||||
assert len(vm.strip[index].levels.postmute) == value
|
assert len(vm.strip[index].levels.postmute) == value
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "potato",
|
data.name != 'potato',
|
||||||
reason="Only test if logged into Potato version",
|
reason='Only test if logged into Potato version',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, j, value",
|
'index, j, value',
|
||||||
[
|
[
|
||||||
(data.phys_in, 0, -20.7),
|
(data.phys_in, 0, -20.7),
|
||||||
(data.virt_in, 3, -60),
|
(data.virt_in, 3, -60),
|
||||||
@@ -444,12 +456,12 @@ class TestSetAndGetFloatHigher:
|
|||||||
""" strip tests, physical """
|
""" strip tests, physical """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param, value",
|
'index, param, value',
|
||||||
[
|
[
|
||||||
(data.phys_in, "pan_x", -0.6),
|
(data.phys_in, 'pan_x', -0.6),
|
||||||
(data.phys_in, "pan_x", 0.6),
|
(data.phys_in, 'pan_x', 0.6),
|
||||||
(data.phys_in, "color_y", 0.8),
|
(data.phys_in, 'color_y', 0.8),
|
||||||
(data.phys_in, "fx_x", -0.6),
|
(data.phys_in, 'fx_x', -0.6),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_xy_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_xy_params(self, index, param, value):
|
||||||
@@ -458,14 +470,14 @@ class TestSetAndGetFloatHigher:
|
|||||||
assert getattr(vm.strip[index], param) == value
|
assert getattr(vm.strip[index], param) == value
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "potato",
|
data.name != 'potato',
|
||||||
reason="Only test if logged into Potato version",
|
reason='Only test if logged into Potato version',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param, value",
|
'index, param, value',
|
||||||
[
|
[
|
||||||
(data.phys_in, "reverb", -1.6),
|
(data.phys_in, 'reverb', -1.6),
|
||||||
(data.phys_in, "postfx1", True),
|
(data.phys_in, 'postfx1', True),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_effects_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_effects_params(self, index, param, value):
|
||||||
@@ -474,14 +486,14 @@ class TestSetAndGetFloatHigher:
|
|||||||
assert getattr(vm.strip[index], param) == value
|
assert getattr(vm.strip[index], param) == value
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "potato",
|
data.name != 'potato',
|
||||||
reason="Only test if logged into Potato version",
|
reason='Only test if logged into Potato version',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param, value",
|
'index, param, value',
|
||||||
[
|
[
|
||||||
(data.phys_in, "gainin", -8.6),
|
(data.phys_in, 'gainin', -8.6),
|
||||||
(data.phys_in, "knee", 0.5),
|
(data.phys_in, 'knee', 0.5),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_comp_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_comp_params(self, index, param, value):
|
||||||
@@ -490,14 +502,14 @@ class TestSetAndGetFloatHigher:
|
|||||||
assert getattr(vm.strip[index].comp, param) == value
|
assert getattr(vm.strip[index].comp, param) == value
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "potato",
|
data.name != 'potato',
|
||||||
reason="Only test if logged into Potato version",
|
reason='Only test if logged into Potato version',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param, value",
|
'index, param, value',
|
||||||
[
|
[
|
||||||
(data.phys_in, "bpsidechain", 120),
|
(data.phys_in, 'bpsidechain', 120),
|
||||||
(data.phys_in, "hold", 3000),
|
(data.phys_in, 'hold', 3000),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_gate_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_gate_params(self, index, param, value):
|
||||||
@@ -506,13 +518,13 @@ class TestSetAndGetFloatHigher:
|
|||||||
assert getattr(vm.strip[index].gate, param) == value
|
assert getattr(vm.strip[index].gate, param) == value
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "potato",
|
data.name != 'potato',
|
||||||
reason="Only test if logged into Potato version",
|
reason='Only test if logged into Potato version',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param, value",
|
'index, param, value',
|
||||||
[
|
[
|
||||||
(data.phys_in, "knob", -8.6),
|
(data.phys_in, 'knob', -8.6),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_denoiser_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_denoiser_params(self, index, param, value):
|
||||||
@@ -522,13 +534,13 @@ class TestSetAndGetFloatHigher:
|
|||||||
""" strip tests, virtual """
|
""" strip tests, virtual """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param, value",
|
'index, param, value',
|
||||||
[
|
[
|
||||||
(data.virt_in, "pan_x", -0.6),
|
(data.virt_in, 'pan_x', -0.6),
|
||||||
(data.virt_in, "pan_x", 0.6),
|
(data.virt_in, 'pan_x', 0.6),
|
||||||
(data.virt_in, "treble", -1.6),
|
(data.virt_in, 'treble', -1.6),
|
||||||
(data.virt_in, "mid", 5.8),
|
(data.virt_in, 'mid', 5.8),
|
||||||
(data.virt_in, "bass", -8.1),
|
(data.virt_in, 'bass', -8.1),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_eq_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_eq_params(self, index, param, value):
|
||||||
@@ -538,12 +550,12 @@ class TestSetAndGetFloatHigher:
|
|||||||
""" bus tests, physical and virtual """
|
""" bus tests, physical and virtual """
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "potato",
|
data.name != 'potato',
|
||||||
reason="Only test if logged into Potato version",
|
reason='Only test if logged into Potato version',
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param, value",
|
'index, param, value',
|
||||||
[(data.phys_out, "returnreverb", 3.6), (data.virt_out, "returnfx1", 5.8)],
|
[(data.phys_out, 'returnreverb', 3.6), (data.virt_out, 'returnfx1', 5.8)],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_bus_effects_float_params(self, index, param, value):
|
def test_it_sets_and_gets_bus_effects_float_params(self, index, param, value):
|
||||||
assert hasattr(vm.bus[index], param)
|
assert hasattr(vm.bus[index], param)
|
||||||
@@ -551,30 +563,30 @@ class TestSetAndGetFloatHigher:
|
|||||||
assert getattr(vm.bus[index], param) == value
|
assert getattr(vm.bus[index], param) == value
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param, value",
|
'index, param, value',
|
||||||
[(data.phys_out, "gain", -3.6), (data.virt_out, "gain", 5.8)],
|
[(data.phys_out, 'gain', -3.6), (data.virt_out, 'gain', 5.8)],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_bus_float_params(self, index, param, value):
|
def test_it_sets_and_gets_bus_float_params(self, index, param, value):
|
||||||
setattr(vm.bus[index], param, value)
|
setattr(vm.bus[index], param, value)
|
||||||
assert getattr(vm.bus[index], param) == value
|
assert getattr(vm.bus[index], param) == value
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,value",
|
'index,value',
|
||||||
[(data.phys_out, 8), (data.virt_out, 8)],
|
[(data.phys_out, 8), (data.virt_out, 8)],
|
||||||
)
|
)
|
||||||
def test_it_gets_prefader_levels_and_compares_length_of_array(self, index, value):
|
def test_it_gets_bus_levels_and_compares_length_of_array(self, index, value):
|
||||||
assert len(vm.bus[index].levels.all) == value
|
assert len(vm.bus[index].levels.all) == value
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("value", ["test0", "test1"])
|
@pytest.mark.parametrize('value', ['test0', 'test1'])
|
||||||
class TestSetAndGetStringHigher:
|
class TestSetAndGetStringHigher:
|
||||||
__test__ = True
|
__test__ = True
|
||||||
|
|
||||||
"""strip tests, physical and virtual"""
|
"""strip tests, physical and virtual"""
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param",
|
'index, param',
|
||||||
[(data.phys_in, "label"), (data.virt_in, "label")],
|
[(data.phys_in, 'label'), (data.virt_in, 'label')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_string_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_string_params(self, index, param, value):
|
||||||
setattr(vm.strip[index], param, value)
|
setattr(vm.strip[index], param, value)
|
||||||
@@ -583,8 +595,8 @@ class TestSetAndGetStringHigher:
|
|||||||
""" bus tests, physical and virtual """
|
""" bus tests, physical and virtual """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param",
|
'index, param',
|
||||||
[(data.phys_out, "label"), (data.virt_out, "label")],
|
[(data.phys_out, 'label'), (data.virt_out, 'label')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_bus_string_params(self, index, param, value):
|
def test_it_sets_and_gets_bus_string_params(self, index, param, value):
|
||||||
setattr(vm.bus[index], param, value)
|
setattr(vm.bus[index], param, value)
|
||||||
@@ -593,8 +605,8 @@ class TestSetAndGetStringHigher:
|
|||||||
""" vban instream tests """
|
""" vban instream tests """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param",
|
'index, param',
|
||||||
[(data.vban_in, "name")],
|
[(data.vban_in, 'name')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_vban_instream_string_params(self, index, param, value):
|
def test_it_sets_and_gets_vban_instream_string_params(self, index, param, value):
|
||||||
setattr(vm.vban.instream[index], param, value)
|
setattr(vm.vban.instream[index], param, value)
|
||||||
@@ -603,29 +615,29 @@ class TestSetAndGetStringHigher:
|
|||||||
""" vban outstream tests """
|
""" vban outstream tests """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param",
|
'index, param',
|
||||||
[(data.vban_out, "name")],
|
[(data.vban_out, 'name')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_vban_outstream_string_params(self, index, param, value):
|
def test_it_sets_and_gets_vban_outstream_string_params(self, index, param, value):
|
||||||
setattr(vm.vban.outstream[index], param, value)
|
setattr(vm.vban.outstream[index], param, value)
|
||||||
assert getattr(vm.vban.outstream[index], param) == value
|
assert getattr(vm.vban.outstream[index], param) == value
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("value", [False, True])
|
@pytest.mark.parametrize('value', [False, True])
|
||||||
class TestSetAndGetMacroButtonHigher:
|
class TestSetAndGetMacroButtonHigher:
|
||||||
__test__ = True
|
__test__ = True
|
||||||
|
|
||||||
"""macrobutton tests"""
|
"""macrobutton tests"""
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, param",
|
'index, param',
|
||||||
[
|
[
|
||||||
(0, "state"),
|
(0, 'state'),
|
||||||
(39, "stateonly"),
|
(39, 'stateonly'),
|
||||||
(69, "trigger"),
|
(69, 'trigger'),
|
||||||
(22, "stateonly"),
|
(22, 'stateonly'),
|
||||||
(45, "state"),
|
(45, 'state'),
|
||||||
(65, "trigger"),
|
(65, 'trigger'),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_macrobutton_params(self, index, param, value):
|
def test_it_sets_and_gets_macrobutton_params(self, index, param, value):
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ class TestSetAndGetFloatLower:
|
|||||||
"""VBVMR_SetParameterFloat, VBVMR_GetParameterFloat"""
|
"""VBVMR_SetParameterFloat, VBVMR_GetParameterFloat"""
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"param,value",
|
'param,value',
|
||||||
[
|
[
|
||||||
(f"Strip[{data.phys_in}].Mute", 1),
|
(f'Strip[{data.phys_in}].Mute', 1),
|
||||||
(f"Bus[{data.virt_out}].Eq.on", 1),
|
(f'Bus[{data.virt_out}].Eq.on', 1),
|
||||||
(f"Strip[{data.phys_in}].Mute", 0),
|
(f'Strip[{data.phys_in}].Mute', 0),
|
||||||
(f"Bus[{data.virt_out}].Eq.on", 0),
|
(f'Bus[{data.virt_out}].Eq.on', 0),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_mute_eq_float_params(self, param, value):
|
def test_it_sets_and_gets_mute_eq_float_params(self, param, value):
|
||||||
@@ -22,11 +22,11 @@ class TestSetAndGetFloatLower:
|
|||||||
assert (round(vm.get(param))) == value
|
assert (round(vm.get(param))) == value
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"param,value",
|
'param,value',
|
||||||
[
|
[
|
||||||
(f"Strip[{data.phys_in}].Comp", 5.3),
|
(f'Strip[{data.phys_in}].Comp', 5.3),
|
||||||
(f"Strip[{data.virt_in}].Gain", -37.5),
|
(f'Strip[{data.virt_in}].Gain', -37.5),
|
||||||
(f"Bus[{data.virt_out}].Gain", -22.7),
|
(f'Bus[{data.virt_out}].Gain', -22.7),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_comp_gain_float_params(self, param, value):
|
def test_it_sets_and_gets_comp_gain_float_params(self, param, value):
|
||||||
@@ -34,29 +34,29 @@ class TestSetAndGetFloatLower:
|
|||||||
assert (round(vm.get(param), 1)) == value
|
assert (round(vm.get(param), 1)) == value
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("value", ["test0", "test1"])
|
@pytest.mark.parametrize('value', ['test0', 'test1'])
|
||||||
class TestSetAndGetStringLower:
|
class TestSetAndGetStringLower:
|
||||||
__test__ = True
|
__test__ = True
|
||||||
|
|
||||||
"""VBVMR_SetParameterStringW, VBVMR_GetParameterStringW"""
|
"""VBVMR_SetParameterStringW, VBVMR_GetParameterStringW"""
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"param",
|
'param',
|
||||||
[(f"Strip[{data.phys_out}].label"), (f"Bus[{data.virt_out}].label")],
|
[(f'Strip[{data.phys_out}].label'), (f'Bus[{data.virt_out}].label')],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_string_params(self, param, value):
|
def test_it_sets_and_gets_string_params(self, param, value):
|
||||||
vm.set(param, value)
|
vm.set(param, value)
|
||||||
assert vm.get(param, string=True) == value
|
assert vm.get(param, string=True) == value
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("value", [0, 1])
|
@pytest.mark.parametrize('value', [0, 1])
|
||||||
class TestMacroButtonsLower:
|
class TestMacroButtonsLower:
|
||||||
__test__ = True
|
__test__ = True
|
||||||
|
|
||||||
"""VBVMR_MacroButton_SetStatus, VBVMR_MacroButton_GetStatus"""
|
"""VBVMR_MacroButton_SetStatus, VBVMR_MacroButton_GetStatus"""
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, mode",
|
'index, mode',
|
||||||
[(33, 1), (49, 1)],
|
[(33, 1), (49, 1)],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_macrobuttons_state(self, index, mode, value):
|
def test_it_sets_and_gets_macrobuttons_state(self, index, mode, value):
|
||||||
@@ -64,7 +64,7 @@ class TestMacroButtonsLower:
|
|||||||
assert vm.get_buttonstatus(index, mode) == value
|
assert vm.get_buttonstatus(index, mode) == value
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, mode",
|
'index, mode',
|
||||||
[(14, 2), (12, 2)],
|
[(14, 2), (12, 2)],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_macrobuttons_stateonly(self, index, mode, value):
|
def test_it_sets_and_gets_macrobuttons_stateonly(self, index, mode, value):
|
||||||
@@ -72,7 +72,7 @@ class TestMacroButtonsLower:
|
|||||||
assert vm.get_buttonstatus(index, mode) == value
|
assert vm.get_buttonstatus(index, mode) == value
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index, mode",
|
'index, mode',
|
||||||
[(50, 3), (65, 3)],
|
[(50, 3), (65, 3)],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_macrobuttons_trigger(self, index, mode, value):
|
def test_it_sets_and_gets_macrobuttons_trigger(self, index, mode, value):
|
||||||
|
|||||||
42
tox.ini
Normal file
42
tox.ini
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
[tox]
|
||||||
|
envlist = py310,py311,py312,py313
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
passenv = *
|
||||||
|
setenv = VIRTUALENV_DISCOVERY=pyenv
|
||||||
|
allowlist_externals = poetry
|
||||||
|
commands_pre =
|
||||||
|
poetry install --no-interaction --no-root
|
||||||
|
commands =
|
||||||
|
poetry run pytest tests
|
||||||
|
|
||||||
|
[testenv:genbadge]
|
||||||
|
passenv = *
|
||||||
|
setenv = VIRTUALENV_DISCOVERY=pyenv
|
||||||
|
allowlist_externals = poetry
|
||||||
|
deps =
|
||||||
|
genbadge[all]
|
||||||
|
pytest-html
|
||||||
|
commands_pre =
|
||||||
|
poetry install --no-interaction --no-root
|
||||||
|
commands =
|
||||||
|
poetry run pytest --capture=tee-sys --junitxml=./tests/reports/junit-${KIND}.xml --html=./tests/reports/${KIND}.html tests
|
||||||
|
poetry run genbadge tests -t 90 -i ./tests/reports/junit-${KIND}.xml -o ./tests/reports/badge-${KIND}.svg
|
||||||
|
|
||||||
|
[testenv:dsl]
|
||||||
|
setenv = VIRTUALENV_DISCOVERY=pyenv
|
||||||
|
allowlist_externals = poetry
|
||||||
|
deps = pyparsing
|
||||||
|
commands_pre =
|
||||||
|
poetry install --no-interaction --no-root --without dev
|
||||||
|
commands =
|
||||||
|
poetry run python examples/dsl
|
||||||
|
|
||||||
|
[testenv:obs]
|
||||||
|
setenv = VIRTUALENV_DISCOVERY=pyenv
|
||||||
|
allowlist_externals = poetry
|
||||||
|
deps = obsws-python
|
||||||
|
commands_pre =
|
||||||
|
poetry install --no-interaction --no-root --without dev
|
||||||
|
commands =
|
||||||
|
poetry run python examples/obs
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
from .factory import request_remote_obj as api
|
from .factory import request_remote_obj as api
|
||||||
|
|
||||||
__ALL__ = ["api"]
|
__ALL__ = ['api']
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
|
import abc
|
||||||
import time
|
import time
|
||||||
from abc import abstractmethod
|
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
from math import log
|
from math import log
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
from . import kinds
|
||||||
from .iremote import IRemote
|
from .iremote import IRemote
|
||||||
from .kinds import kinds_all
|
|
||||||
from .meta import bus_mode_prop, device_prop, float_prop
|
from .meta import bus_mode_prop, device_prop, float_prop
|
||||||
|
|
||||||
BusModes = IntEnum(
|
BusModes = IntEnum(
|
||||||
"BusModes",
|
'BusModes',
|
||||||
"normal amix bmix repeat composite tvmix upmix21 upmix41 upmix61 centeronly lfeonly rearonly",
|
'normal amix bmix repeat composite tvmix upmix21 upmix41 upmix61 centeronly lfeonly rearonly',
|
||||||
start=0,
|
start=0,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,91 +22,188 @@ class Bus(IRemote):
|
|||||||
Defines concrete implementation for bus
|
Defines concrete implementation for bus
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@abstractmethod
|
@abc.abstractmethod
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"bus[{self.index}]"
|
return f'bus[{self.index}]'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mute(self) -> bool:
|
def mute(self) -> bool:
|
||||||
return self.getter("mute") == 1
|
return self.getter('mute') == 1
|
||||||
|
|
||||||
@mute.setter
|
@mute.setter
|
||||||
def mute(self, val: bool):
|
def mute(self, val: bool):
|
||||||
self.setter("mute", 1 if val else 0)
|
self.setter('mute', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mono(self) -> bool:
|
def mono(self) -> int:
|
||||||
return self.getter("mono") == 1
|
return int(self.getter('mono'))
|
||||||
|
|
||||||
@mono.setter
|
@mono.setter
|
||||||
def mono(self, val: bool):
|
def mono(self, val: int):
|
||||||
self.setter("mono", 1 if val else 0)
|
self.setter('mono', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sel(self) -> bool:
|
def sel(self) -> bool:
|
||||||
return self.getter("sel") == 1
|
return self.getter('sel') == 1
|
||||||
|
|
||||||
@sel.setter
|
@sel.setter
|
||||||
def sel(self, val: bool):
|
def sel(self, val: bool):
|
||||||
self.setter("sel", 1 if val else 0)
|
self.setter('sel', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def label(self) -> str:
|
def label(self) -> str:
|
||||||
return self.getter("Label", is_string=True)
|
return self.getter('Label', is_string=True)
|
||||||
|
|
||||||
@label.setter
|
@label.setter
|
||||||
def label(self, val: str):
|
def label(self, val: str):
|
||||||
self.setter("Label", str(val))
|
self.setter('Label', str(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gain(self) -> float:
|
def gain(self) -> float:
|
||||||
return round(self.getter("gain"), 1)
|
return round(self.getter('gain'), 1)
|
||||||
|
|
||||||
@gain.setter
|
@gain.setter
|
||||||
def gain(self, val: float):
|
def gain(self, val: float):
|
||||||
self.setter("gain", val)
|
self.setter('gain', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def monitor(self) -> bool:
|
def monitor(self) -> bool:
|
||||||
return self.getter("monitor") == 1
|
return self.getter('monitor') == 1
|
||||||
|
|
||||||
@monitor.setter
|
@monitor.setter
|
||||||
def monitor(self, val: bool):
|
def monitor(self, val: bool):
|
||||||
self.setter("monitor", 1 if val else 0)
|
self.setter('monitor', 1 if val else 0)
|
||||||
|
|
||||||
def fadeto(self, target: float, time_: int):
|
def fadeto(self, target: float, time_: int):
|
||||||
self.setter("FadeTo", f"({target}, {time_})")
|
self.setter('FadeTo', f'({target}, {time_})')
|
||||||
time.sleep(self._remote.DELAY)
|
time.sleep(self._remote.DELAY)
|
||||||
|
|
||||||
def fadeby(self, change: float, time_: int):
|
def fadeby(self, change: float, time_: int):
|
||||||
self.setter("FadeBy", f"({change}, {time_})")
|
self.setter('FadeBy', f'({change}, {time_})')
|
||||||
time.sleep(self._remote.DELAY)
|
time.sleep(self._remote.DELAY)
|
||||||
|
|
||||||
|
|
||||||
class BusEQ(IRemote):
|
class BusEQ(IRemote):
|
||||||
|
@classmethod
|
||||||
|
def make(cls, remote, i):
|
||||||
|
"""
|
||||||
|
Factory method for BusEQ.
|
||||||
|
|
||||||
|
Returns a BusEQ class.
|
||||||
|
"""
|
||||||
|
BusEQ_cls = type(
|
||||||
|
'BusEQ',
|
||||||
|
(cls,),
|
||||||
|
{
|
||||||
|
'channel': tuple(
|
||||||
|
BusEQCh.make(remote, i, j) for j in range(remote.kind.bus_channels)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return BusEQ_cls(remote, i)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"Bus[{self.index}].eq"
|
return f'Bus[{self.index}].eq'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def on(self) -> bool:
|
def on(self) -> bool:
|
||||||
return self.getter("on") == 1
|
return self.getter('on') == 1
|
||||||
|
|
||||||
@on.setter
|
@on.setter
|
||||||
def on(self, val: bool):
|
def on(self, val: bool):
|
||||||
self.setter("on", 1 if val else 0)
|
self.setter('on', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ab(self) -> bool:
|
def ab(self) -> bool:
|
||||||
return self.getter("ab") == 1
|
return self.getter('ab') == 1
|
||||||
|
|
||||||
@ab.setter
|
@ab.setter
|
||||||
def ab(self, val: bool):
|
def ab(self, val: bool):
|
||||||
self.setter("ab", 1 if val else 0)
|
self.setter('ab', 1 if val else 0)
|
||||||
|
|
||||||
|
|
||||||
|
class BusEQCh(IRemote):
|
||||||
|
@classmethod
|
||||||
|
def make(cls, remote, i, j):
|
||||||
|
"""
|
||||||
|
Factory method for Bus EQ channel.
|
||||||
|
|
||||||
|
Returns a BusEQCh class.
|
||||||
|
"""
|
||||||
|
BusEQCh_cls = type(
|
||||||
|
'BusEQCh',
|
||||||
|
(cls,),
|
||||||
|
{
|
||||||
|
'cell': tuple(
|
||||||
|
BusEQChCell(remote, i, j, k) for k in range(remote.kind.cells)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return BusEQCh_cls(remote, i, j)
|
||||||
|
|
||||||
|
def __init__(self, remote, i, j):
|
||||||
|
super().__init__(remote, i)
|
||||||
|
self.channel_index = j
|
||||||
|
|
||||||
|
@property
|
||||||
|
def identifier(self) -> str:
|
||||||
|
return f'Bus[{self.index}].eq.channel[{self.channel_index}]'
|
||||||
|
|
||||||
|
|
||||||
|
class BusEQChCell(IRemote):
|
||||||
|
def __init__(self, remote, i, j, k):
|
||||||
|
super().__init__(remote, i)
|
||||||
|
self.channel_index = j
|
||||||
|
self.cell_index = k
|
||||||
|
|
||||||
|
@property
|
||||||
|
def identifier(self) -> str:
|
||||||
|
return f'Bus[{self.index}].eq.channel[{self.channel_index}].cell[{self.cell_index}]'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def on(self) -> bool:
|
||||||
|
return self.getter('on') == 1
|
||||||
|
|
||||||
|
@on.setter
|
||||||
|
def on(self, val: bool):
|
||||||
|
self.setter('on', 1 if val else 0)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def type(self) -> int:
|
||||||
|
return int(self.getter('type'))
|
||||||
|
|
||||||
|
@type.setter
|
||||||
|
def type(self, val: int):
|
||||||
|
self.setter('type', val)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def f(self) -> float:
|
||||||
|
return round(self.getter('f'), 1)
|
||||||
|
|
||||||
|
@f.setter
|
||||||
|
def f(self, val: float):
|
||||||
|
self.setter('f', val)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def gain(self) -> float:
|
||||||
|
return round(self.getter('gain'), 1)
|
||||||
|
|
||||||
|
@gain.setter
|
||||||
|
def gain(self, val: float):
|
||||||
|
self.setter('gain', val)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def q(self) -> float:
|
||||||
|
return round(self.getter('q'), 1)
|
||||||
|
|
||||||
|
@q.setter
|
||||||
|
def q(self, val: float):
|
||||||
|
self.setter('q', val)
|
||||||
|
|
||||||
|
|
||||||
class PhysicalBus(Bus):
|
class PhysicalBus(Bus):
|
||||||
@@ -118,19 +215,19 @@ class PhysicalBus(Bus):
|
|||||||
Returns a PhysicalBus class.
|
Returns a PhysicalBus class.
|
||||||
"""
|
"""
|
||||||
kls = (cls,)
|
kls = (cls,)
|
||||||
if kind.name == "potato":
|
if kind.name == 'potato':
|
||||||
EFFECTS_cls = _make_effects_mixin()
|
EFFECTS_cls = _make_effects_mixin()
|
||||||
kls += (EFFECTS_cls,)
|
kls += (EFFECTS_cls,)
|
||||||
return type(
|
return type(
|
||||||
"PhysicalBus",
|
'PhysicalBus',
|
||||||
kls,
|
kls,
|
||||||
{
|
{
|
||||||
"device": BusDevice.make(remote, i),
|
'device': BusDevice.make(remote, i),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}{self.index}"
|
return f'{type(self).__name__}{self.index}'
|
||||||
|
|
||||||
|
|
||||||
class BusDevice(IRemote):
|
class BusDevice(IRemote):
|
||||||
@@ -142,16 +239,16 @@ class BusDevice(IRemote):
|
|||||||
Returns a BusDevice class of a kind.
|
Returns a BusDevice class of a kind.
|
||||||
"""
|
"""
|
||||||
DEVICE_cls = type(
|
DEVICE_cls = type(
|
||||||
f"BusDevice{remote.kind}",
|
f'BusDevice{remote.kind}',
|
||||||
(cls,),
|
(cls,),
|
||||||
{
|
{
|
||||||
**{
|
**{
|
||||||
param: device_prop(param)
|
param: device_prop(param)
|
||||||
for param in [
|
for param in [
|
||||||
"wdm",
|
'wdm',
|
||||||
"ks",
|
'ks',
|
||||||
"mme",
|
'mme',
|
||||||
"asio",
|
'asio',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -160,15 +257,15 @@ class BusDevice(IRemote):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"Bus[{self.index}].device"
|
return f'Bus[{self.index}].device'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
return self.getter("name", is_string=True)
|
return self.getter('name', is_string=True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sr(self) -> int:
|
def sr(self) -> int:
|
||||||
return int(self.getter("sr"))
|
return int(self.getter('sr'))
|
||||||
|
|
||||||
|
|
||||||
class VirtualBus(Bus):
|
class VirtualBus(Bus):
|
||||||
@@ -182,21 +279,21 @@ class VirtualBus(Bus):
|
|||||||
Returns a VirtualBus class.
|
Returns a VirtualBus class.
|
||||||
"""
|
"""
|
||||||
kls = (cls,)
|
kls = (cls,)
|
||||||
if kind.name == "basic":
|
if kind.name == 'basic':
|
||||||
return type(
|
return type(
|
||||||
"VirtualBus",
|
'VirtualBus',
|
||||||
kls,
|
kls,
|
||||||
{
|
{
|
||||||
"device": BusDevice.make(remote, i),
|
'device': BusDevice.make(remote, i),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
elif kind.name == "potato":
|
elif kind.name == 'potato':
|
||||||
EFFECTS_cls = _make_effects_mixin()
|
EFFECTS_cls = _make_effects_mixin()
|
||||||
kls += (EFFECTS_cls,)
|
kls += (EFFECTS_cls,)
|
||||||
return type("VirtualBus", kls, {})
|
return type('VirtualBus', kls, {})
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}{self.index}"
|
return f'{type(self).__name__}{self.index}'
|
||||||
|
|
||||||
|
|
||||||
class BusLevel(IRemote):
|
class BusLevel(IRemote):
|
||||||
@@ -217,7 +314,7 @@ class BusLevel(IRemote):
|
|||||||
return round(20 * log(x, 10), 1) if x > 0 else -200.0
|
return round(20 * log(x, 10), 1) if x > 0 else -200.0
|
||||||
|
|
||||||
if not self._remote.stopped() and self._remote.event.ldirty:
|
if not self._remote.stopped() and self._remote.event.ldirty:
|
||||||
vals = self._remote.cache["bus_level"][self.range[0] : self.range[-1]]
|
vals = self._remote.cache['bus_level'][self.range[0] : self.range[-1]]
|
||||||
else:
|
else:
|
||||||
vals = [self._remote.get_level(mode, i) for i in range(*self.range)]
|
vals = [self._remote.get_level(mode, i) for i in range(*self.range)]
|
||||||
|
|
||||||
@@ -225,7 +322,7 @@ class BusLevel(IRemote):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"Bus[{self.index}]"
|
return f'Bus[{self.index}]'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def all(self) -> tuple:
|
def all(self) -> tuple:
|
||||||
@@ -248,14 +345,14 @@ def make_bus_level_map(kind):
|
|||||||
return tuple((i, i + 8) for i in range(0, (kind.phys_out + kind.virt_out) * 8, 8))
|
return tuple((i, i + 8) for i in range(0, (kind.phys_out + kind.virt_out) * 8, 8))
|
||||||
|
|
||||||
|
|
||||||
_make_bus_level_maps = {kind.name: make_bus_level_map(kind) for kind in kinds_all}
|
_make_bus_level_maps = {kind.name: make_bus_level_map(kind) for kind in kinds.all}
|
||||||
|
|
||||||
|
|
||||||
def _make_bus_mode_mixin():
|
def _make_bus_mode_mixin():
|
||||||
"""Creates a mixin of Bus Modes."""
|
"""Creates a mixin of Bus Modes."""
|
||||||
|
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"Bus[{self.index}].mode"
|
return f'Bus[{self.index}].mode'
|
||||||
|
|
||||||
def get(self) -> str:
|
def get(self) -> str:
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
@@ -276,15 +373,15 @@ def _make_bus_mode_mixin():
|
|||||||
):
|
):
|
||||||
if val:
|
if val:
|
||||||
return BusModes(i + 1).name
|
return BusModes(i + 1).name
|
||||||
return "normal"
|
return 'normal'
|
||||||
|
|
||||||
return type(
|
return type(
|
||||||
"BusModeMixin",
|
'BusModeMixin',
|
||||||
(IRemote,),
|
(IRemote,),
|
||||||
{
|
{
|
||||||
"identifier": property(identifier),
|
'identifier': property(identifier),
|
||||||
**{mode.name: bus_mode_prop(mode.name) for mode in BusModes},
|
**{mode.name: bus_mode_prop(mode.name) for mode in BusModes},
|
||||||
"get": get,
|
'get': get,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -292,12 +389,12 @@ def _make_bus_mode_mixin():
|
|||||||
def _make_effects_mixin():
|
def _make_effects_mixin():
|
||||||
"""creates an fx mixin"""
|
"""creates an fx mixin"""
|
||||||
return type(
|
return type(
|
||||||
"FX",
|
'FX',
|
||||||
(),
|
(),
|
||||||
{
|
{
|
||||||
**{
|
**{
|
||||||
f"return{param}": float_prop(f"return{param}")
|
f'return{param}': float_prop(f'return{param}')
|
||||||
for param in ["reverb", "delay", "fx1", "fx2"]
|
for param in ['reverb', 'delay', 'fx1', 'fx2']
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -316,12 +413,12 @@ def bus_factory(is_phys_bus, remote, i) -> Union[PhysicalBus, VirtualBus]:
|
|||||||
)
|
)
|
||||||
BUSMODEMIXIN_cls = _make_bus_mode_mixin()
|
BUSMODEMIXIN_cls = _make_bus_mode_mixin()
|
||||||
return type(
|
return type(
|
||||||
f"{BUS_cls.__name__}{remote.kind}",
|
f'{BUS_cls.__name__}{remote.kind}',
|
||||||
(BUS_cls,),
|
(BUS_cls,),
|
||||||
{
|
{
|
||||||
"levels": BusLevel(remote, i),
|
'levels': BusLevel(remote, i),
|
||||||
"mode": BUSMODEMIXIN_cls(remote, i),
|
'mode': BUSMODEMIXIN_cls(remote, i),
|
||||||
"eq": BusEQ(remote, i),
|
'eq': BusEQ.make(remote, i),
|
||||||
},
|
},
|
||||||
)(remote, i)
|
)(remote, i)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import ctypes as ct
|
import ctypes as ct
|
||||||
import logging
|
import logging
|
||||||
from abc import ABCMeta
|
|
||||||
from ctypes.wintypes import CHAR, FLOAT, LONG, WCHAR
|
from ctypes.wintypes import CHAR, FLOAT, LONG, WCHAR
|
||||||
|
|
||||||
from .error import CAPIError
|
from .error import CAPIError
|
||||||
@@ -9,14 +8,13 @@ from .inst import libc
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class CBindings(metaclass=ABCMeta):
|
class CBindings:
|
||||||
"""
|
"""Class responsible for defining C function bindings.
|
||||||
C bindings defined here.
|
|
||||||
|
|
||||||
Maps expected ctype argument and res types for each binding.
|
Wrapper methods are provided for each C function to handle error checking and logging.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logger_cbindings = logger.getChild("CBindings")
|
logger_cbindings = logger.getChild('CBindings')
|
||||||
|
|
||||||
bind_login = libc.VBVMR_Login
|
bind_login = libc.VBVMR_Login
|
||||||
bind_login.restype = LONG
|
bind_login.restype = LONG
|
||||||
@@ -38,17 +36,17 @@ class CBindings(metaclass=ABCMeta):
|
|||||||
bind_get_voicemeeter_version.restype = LONG
|
bind_get_voicemeeter_version.restype = LONG
|
||||||
bind_get_voicemeeter_version.argtypes = [ct.POINTER(LONG)]
|
bind_get_voicemeeter_version.argtypes = [ct.POINTER(LONG)]
|
||||||
|
|
||||||
if hasattr(libc, "VBVMR_MacroButton_IsDirty"):
|
if hasattr(libc, 'VBVMR_MacroButton_IsDirty'):
|
||||||
bind_macro_button_is_dirty = libc.VBVMR_MacroButton_IsDirty
|
bind_macro_button_is_dirty = libc.VBVMR_MacroButton_IsDirty
|
||||||
bind_macro_button_is_dirty.restype = LONG
|
bind_macro_button_is_dirty.restype = LONG
|
||||||
bind_macro_button_is_dirty.argtypes = None
|
bind_macro_button_is_dirty.argtypes = None
|
||||||
|
|
||||||
if hasattr(libc, "VBVMR_MacroButton_GetStatus"):
|
if hasattr(libc, 'VBVMR_MacroButton_GetStatus'):
|
||||||
bind_macro_button_get_status = libc.VBVMR_MacroButton_GetStatus
|
bind_macro_button_get_status = libc.VBVMR_MacroButton_GetStatus
|
||||||
bind_macro_button_get_status.restype = LONG
|
bind_macro_button_get_status.restype = LONG
|
||||||
bind_macro_button_get_status.argtypes = [LONG, ct.POINTER(FLOAT), LONG]
|
bind_macro_button_get_status.argtypes = [LONG, ct.POINTER(FLOAT), LONG]
|
||||||
|
|
||||||
if hasattr(libc, "VBVMR_MacroButton_SetStatus"):
|
if hasattr(libc, 'VBVMR_MacroButton_SetStatus'):
|
||||||
bind_macro_button_set_status = libc.VBVMR_MacroButton_SetStatus
|
bind_macro_button_set_status = libc.VBVMR_MacroButton_SetStatus
|
||||||
bind_macro_button_set_status.restype = LONG
|
bind_macro_button_set_status.restype = LONG
|
||||||
bind_macro_button_set_status.argtypes = [LONG, FLOAT, LONG]
|
bind_macro_button_set_status.argtypes = [LONG, FLOAT, LONG]
|
||||||
@@ -111,7 +109,8 @@ class CBindings(metaclass=ABCMeta):
|
|||||||
bind_get_midi_message.restype = LONG
|
bind_get_midi_message.restype = LONG
|
||||||
bind_get_midi_message.argtypes = [ct.POINTER(CHAR * 1024), LONG]
|
bind_get_midi_message.argtypes = [ct.POINTER(CHAR * 1024), LONG]
|
||||||
|
|
||||||
def call(self, func, *args, ok=(0,), ok_exp=None):
|
def _call(self, func, *args, ok=(0,), ok_exp=None):
|
||||||
|
"""Call a C function and handle errors."""
|
||||||
try:
|
try:
|
||||||
res = func(*args)
|
res = func(*args)
|
||||||
if ok_exp is None:
|
if ok_exp is None:
|
||||||
@@ -121,5 +120,95 @@ class CBindings(metaclass=ABCMeta):
|
|||||||
raise CAPIError(func.__name__, res)
|
raise CAPIError(func.__name__, res)
|
||||||
return res
|
return res
|
||||||
except CAPIError as e:
|
except CAPIError as e:
|
||||||
self.logger_cbindings.exception(f"{type(e).__name__}: {e}")
|
self.logger_cbindings.exception(f'{type(e).__name__}: {e}')
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
def login(self, **kwargs):
|
||||||
|
"""Login to Voicemeeter API"""
|
||||||
|
return self._call(self.bind_login, **kwargs)
|
||||||
|
|
||||||
|
def logout(self):
|
||||||
|
"""Logout from Voicemeeter API"""
|
||||||
|
return self._call(self.bind_logout)
|
||||||
|
|
||||||
|
def run_voicemeeter(self, value):
|
||||||
|
"""Run Voicemeeter with specified type"""
|
||||||
|
return self._call(self.bind_run_voicemeeter, value)
|
||||||
|
|
||||||
|
def get_voicemeeter_type(self, type_ref):
|
||||||
|
"""Get Voicemeeter type"""
|
||||||
|
return self._call(self.bind_get_voicemeeter_type, type_ref)
|
||||||
|
|
||||||
|
def get_voicemeeter_version(self, version_ref):
|
||||||
|
"""Get Voicemeeter version"""
|
||||||
|
return self._call(self.bind_get_voicemeeter_version, version_ref)
|
||||||
|
|
||||||
|
def is_parameters_dirty(self, **kwargs):
|
||||||
|
"""Check if parameters are dirty"""
|
||||||
|
return self._call(self.bind_is_parameters_dirty, **kwargs)
|
||||||
|
|
||||||
|
def macro_button_is_dirty(self, **kwargs):
|
||||||
|
"""Check if macro button parameters are dirty"""
|
||||||
|
if hasattr(self, 'bind_macro_button_is_dirty'):
|
||||||
|
return self._call(self.bind_macro_button_is_dirty, **kwargs)
|
||||||
|
raise AttributeError('macro_button_is_dirty not available')
|
||||||
|
|
||||||
|
def get_parameter_float(self, param_name, value_ref):
|
||||||
|
"""Get float parameter value"""
|
||||||
|
return self._call(self.bind_get_parameter_float, param_name, value_ref)
|
||||||
|
|
||||||
|
def set_parameter_float(self, param_name, value):
|
||||||
|
"""Set float parameter value"""
|
||||||
|
return self._call(self.bind_set_parameter_float, param_name, value)
|
||||||
|
|
||||||
|
def get_parameter_string_w(self, param_name, buffer_ref):
|
||||||
|
"""Get string parameter value (Unicode)"""
|
||||||
|
return self._call(self.bind_get_parameter_string_w, param_name, buffer_ref)
|
||||||
|
|
||||||
|
def set_parameter_string_w(self, param_name, value):
|
||||||
|
"""Set string parameter value (Unicode)"""
|
||||||
|
return self._call(self.bind_set_parameter_string_w, param_name, value)
|
||||||
|
|
||||||
|
def macro_button_get_status(self, id_, state_ref, mode):
|
||||||
|
"""Get macro button status"""
|
||||||
|
if hasattr(self, 'bind_macro_button_get_status'):
|
||||||
|
return self._call(self.bind_macro_button_get_status, id_, state_ref, mode)
|
||||||
|
raise AttributeError('macro_button_get_status not available')
|
||||||
|
|
||||||
|
def macro_button_set_status(self, id_, state, mode):
|
||||||
|
"""Set macro button status"""
|
||||||
|
if hasattr(self, 'bind_macro_button_set_status'):
|
||||||
|
return self._call(self.bind_macro_button_set_status, id_, state, mode)
|
||||||
|
raise AttributeError('macro_button_set_status not available')
|
||||||
|
|
||||||
|
def get_level(self, type_, index, value_ref):
|
||||||
|
"""Get audio level"""
|
||||||
|
return self._call(self.bind_get_level, type_, index, value_ref)
|
||||||
|
|
||||||
|
def input_get_device_number(self, **kwargs):
|
||||||
|
"""Get number of input devices"""
|
||||||
|
return self._call(self.bind_input_get_device_number, **kwargs)
|
||||||
|
|
||||||
|
def output_get_device_number(self, **kwargs):
|
||||||
|
"""Get number of output devices"""
|
||||||
|
return self._call(self.bind_output_get_device_number, **kwargs)
|
||||||
|
|
||||||
|
def input_get_device_desc_w(self, index, type_ref, name_ref, hwid_ref):
|
||||||
|
"""Get input device description"""
|
||||||
|
return self._call(
|
||||||
|
self.bind_input_get_device_desc_w, index, type_ref, name_ref, hwid_ref
|
||||||
|
)
|
||||||
|
|
||||||
|
def output_get_device_desc_w(self, index, type_ref, name_ref, hwid_ref):
|
||||||
|
"""Get output device description"""
|
||||||
|
return self._call(
|
||||||
|
self.bind_output_get_device_desc_w, index, type_ref, name_ref, hwid_ref
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_midi_message(self, buffer_ref, length, **kwargs):
|
||||||
|
"""Get MIDI message"""
|
||||||
|
return self._call(self.bind_get_midi_message, buffer_ref, length, **kwargs)
|
||||||
|
|
||||||
|
def set_parameters(self, script):
|
||||||
|
"""Set multiple parameters via script"""
|
||||||
|
return self._call(self.bind_set_parameters, script)
|
||||||
|
|||||||
@@ -17,33 +17,33 @@ class Command(IRemote):
|
|||||||
Returns a Command class of a kind.
|
Returns a Command class of a kind.
|
||||||
"""
|
"""
|
||||||
CMD_cls = type(
|
CMD_cls = type(
|
||||||
f"Command{remote.kind}",
|
f'Command{remote.kind}',
|
||||||
(cls,),
|
(cls,),
|
||||||
{
|
{
|
||||||
**{
|
**{
|
||||||
param: action_fn(param) for param in ["show", "shutdown", "restart"]
|
param: action_fn(param) for param in ['show', 'shutdown', 'restart']
|
||||||
},
|
},
|
||||||
"hide": action_fn("show", val=0),
|
'hide': action_fn('show', val=0),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return CMD_cls(remote)
|
return CMD_cls(remote)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}"
|
return f'{type(self).__name__}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return "Command"
|
return 'Command'
|
||||||
|
|
||||||
def set_showvbanchat(self, val: bool):
|
def set_showvbanchat(self, val: bool):
|
||||||
self.setter("DialogShow.VBANCHAT", 1 if val else 0)
|
self.setter('DialogShow.VBANCHAT', 1 if val else 0)
|
||||||
|
|
||||||
showvbanchat = property(fset=set_showvbanchat)
|
showvbanchat = property(fset=set_showvbanchat)
|
||||||
|
|
||||||
def set_lock(self, val: bool):
|
def set_lock(self, val: bool):
|
||||||
self.setter("lock", 1 if val else 0)
|
self.setter('lock', 1 if val else 0)
|
||||||
|
|
||||||
lock = property(fset=set_lock)
|
lock = property(fset=set_lock)
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
self._remote.apply_config("reset")
|
self._remote.apply_config('reset')
|
||||||
|
|||||||
@@ -20,72 +20,72 @@ class TOMLStrBuilder:
|
|||||||
def __init__(self, kind):
|
def __init__(self, kind):
|
||||||
self.kind = kind
|
self.kind = kind
|
||||||
self.higher = itertools.chain(
|
self.higher = itertools.chain(
|
||||||
[f"strip-{i}" for i in range(kind.num_strip)],
|
[f'strip-{i}' for i in range(kind.num_strip)],
|
||||||
[f"bus-{i}" for i in range(kind.num_bus)],
|
[f'bus-{i}' for i in range(kind.num_bus)],
|
||||||
)
|
)
|
||||||
|
|
||||||
def init_config(self, profile=None):
|
def init_config(self, profile=None):
|
||||||
self.virt_strip_params = (
|
self.virt_strip_params = (
|
||||||
[
|
[
|
||||||
"mute = false",
|
'mute = false',
|
||||||
"mono = false",
|
'mono = false',
|
||||||
"solo = false",
|
'solo = false',
|
||||||
"gain = 0.0",
|
'gain = 0.0',
|
||||||
]
|
]
|
||||||
+ [f"A{i} = false" for i in range(1, self.kind.phys_out + 1)]
|
+ [f'A{i} = false' for i in range(1, self.kind.phys_out + 1)]
|
||||||
+ [f"B{i} = false" for i in range(1, self.kind.virt_out + 1)]
|
+ [f'B{i} = false' for i in range(1, self.kind.virt_out + 1)]
|
||||||
)
|
)
|
||||||
self.phys_strip_params = self.virt_strip_params + [
|
self.phys_strip_params = self.virt_strip_params + [
|
||||||
"comp.knob = 0.0",
|
'comp.knob = 0.0',
|
||||||
"gate.knob = 0.0",
|
'gate.knob = 0.0',
|
||||||
"denoiser.knob = 0.0",
|
'denoiser.knob = 0.0',
|
||||||
"eq.on = false",
|
'eq.on = false',
|
||||||
]
|
]
|
||||||
self.bus_params = [
|
self.bus_params = [
|
||||||
"mono = false",
|
'mono = false',
|
||||||
"eq.on = false",
|
'eq.on = false',
|
||||||
"mute = false",
|
'mute = false',
|
||||||
"gain = 0.0",
|
'gain = 0.0',
|
||||||
]
|
]
|
||||||
|
|
||||||
if profile == "reset":
|
if profile == 'reset':
|
||||||
self.reset_config()
|
self.reset_config()
|
||||||
|
|
||||||
def reset_config(self):
|
def reset_config(self):
|
||||||
self.phys_strip_params = list(
|
self.phys_strip_params = list(
|
||||||
map(lambda x: x.replace("B1 = false", "B1 = true"), self.phys_strip_params)
|
map(lambda x: x.replace('B1 = false', 'B1 = true'), self.phys_strip_params)
|
||||||
)
|
)
|
||||||
self.virt_strip_params = list(
|
self.virt_strip_params = list(
|
||||||
map(lambda x: x.replace("A1 = false", "A1 = true"), self.virt_strip_params)
|
map(lambda x: x.replace('A1 = false', 'A1 = true'), self.virt_strip_params)
|
||||||
)
|
)
|
||||||
|
|
||||||
def build(self, profile="reset"):
|
def build(self, profile='reset'):
|
||||||
self.init_config(profile)
|
self.init_config(profile)
|
||||||
toml_str = str()
|
toml_str = str()
|
||||||
for eachclass in self.higher:
|
for eachclass in self.higher:
|
||||||
toml_str += f"[{eachclass}]\n"
|
toml_str += f'[{eachclass}]\n'
|
||||||
toml_str = self.join(eachclass, toml_str)
|
toml_str = self.join(eachclass, toml_str)
|
||||||
return toml_str
|
return toml_str
|
||||||
|
|
||||||
def join(self, eachclass, toml_str):
|
def join(self, eachclass, toml_str):
|
||||||
kls, index = eachclass.split("-")
|
kls, index = eachclass.split('-')
|
||||||
match kls:
|
match kls:
|
||||||
case "strip":
|
case 'strip':
|
||||||
toml_str += ("\n").join(
|
toml_str += ('\n').join(
|
||||||
self.phys_strip_params
|
self.phys_strip_params
|
||||||
if int(index) < self.kind.phys_in
|
if int(index) < self.kind.phys_in
|
||||||
else self.virt_strip_params
|
else self.virt_strip_params
|
||||||
)
|
)
|
||||||
case "bus":
|
case 'bus':
|
||||||
toml_str += ("\n").join(self.bus_params)
|
toml_str += ('\n').join(self.bus_params)
|
||||||
case _:
|
case _:
|
||||||
pass
|
pass
|
||||||
return toml_str + "\n"
|
return toml_str + '\n'
|
||||||
|
|
||||||
|
|
||||||
class TOMLDataExtractor:
|
class TOMLDataExtractor:
|
||||||
def __init__(self, file):
|
def __init__(self, file):
|
||||||
with open(file, "rb") as f:
|
with open(file, 'rb') as f:
|
||||||
self._data = tomllib.load(f)
|
self._data = tomllib.load(f)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -103,10 +103,10 @@ def dataextraction_factory(file):
|
|||||||
|
|
||||||
this opens the possibility for other parsers to be added
|
this opens the possibility for other parsers to be added
|
||||||
"""
|
"""
|
||||||
if file.suffix == ".toml":
|
if file.suffix == '.toml':
|
||||||
extractor = TOMLDataExtractor
|
extractor = TOMLDataExtractor
|
||||||
else:
|
else:
|
||||||
raise ValueError("Cannot extract data from {}".format(file))
|
raise ValueError('Cannot extract data from {}'.format(file))
|
||||||
return extractor(file)
|
return extractor(file)
|
||||||
|
|
||||||
|
|
||||||
@@ -140,25 +140,25 @@ class Loader(metaclass=SingletonType):
|
|||||||
def defaults(self, kind):
|
def defaults(self, kind):
|
||||||
self.builder = TOMLStrBuilder(kind)
|
self.builder = TOMLStrBuilder(kind)
|
||||||
toml_str = self.builder.build()
|
toml_str = self.builder.build()
|
||||||
self.register("reset", tomllib.loads(toml_str))
|
self.register('reset', tomllib.loads(toml_str))
|
||||||
|
|
||||||
def parse(self, identifier, data):
|
def parse(self, identifier, data):
|
||||||
if identifier in self._configs:
|
if identifier in self._configs:
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
f"config file with name {identifier} already in memory, skipping.."
|
f'config file with name {identifier} already in memory, skipping..'
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
self.parser = dataextraction_factory(data)
|
self.parser = dataextraction_factory(data)
|
||||||
except tomllib.TOMLDecodeError as e:
|
except tomllib.TOMLDecodeError as e:
|
||||||
ERR_MSG = (str(e), f"When attempting to load {identifier}.toml")
|
ERR_MSG = (str(e), f'When attempting to load {identifier}.toml')
|
||||||
self.logger.error(f"{type(e).__name__}: {' '.join(ERR_MSG)}")
|
self.logger.error(f"{type(e).__name__}: {' '.join(ERR_MSG)}")
|
||||||
return
|
return
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def register(self, identifier, data=None):
|
def register(self, identifier, data=None):
|
||||||
self._configs[identifier] = data if data else self.parser.data
|
self._configs[identifier] = data if data else self.parser.data
|
||||||
self.logger.info(f"config {self.name}/{identifier} loaded into memory")
|
self.logger.info(f'config {self.name}/{identifier} loaded into memory')
|
||||||
|
|
||||||
def deregister(self):
|
def deregister(self):
|
||||||
self._configs.clear()
|
self._configs.clear()
|
||||||
@@ -181,18 +181,18 @@ def loader(kind):
|
|||||||
|
|
||||||
returns configs loaded into memory
|
returns configs loaded into memory
|
||||||
"""
|
"""
|
||||||
logger_loader = logger.getChild("loader")
|
logger_loader = logger.getChild('loader')
|
||||||
loader = Loader(kind)
|
loader = Loader(kind)
|
||||||
|
|
||||||
for path in (
|
for path in (
|
||||||
Path.cwd() / "configs" / kind.name,
|
Path.cwd() / 'configs' / kind.name,
|
||||||
Path.home() / ".config" / "voicemeeter" / kind.name,
|
Path.home() / '.config' / 'voicemeeter' / kind.name,
|
||||||
Path.home() / "Documents" / "Voicemeeter" / "configs" / kind.name,
|
Path.home() / 'Documents' / 'Voicemeeter' / 'configs' / kind.name,
|
||||||
):
|
):
|
||||||
if path.is_dir():
|
if path.is_dir():
|
||||||
logger_loader.info(f"Checking [{path}] for TOML config files:")
|
logger_loader.info(f'Checking [{path}] for TOML config files:')
|
||||||
for file in path.glob("*.toml"):
|
for file in path.glob('*.toml'):
|
||||||
identifier = file.with_suffix("").stem
|
identifier = file.with_suffix('').stem
|
||||||
if loader.parse(identifier, file):
|
if loader.parse(identifier, file):
|
||||||
loader.register(identifier)
|
loader.register(identifier)
|
||||||
return loader.configs
|
return loader.configs
|
||||||
@@ -207,5 +207,5 @@ def request_config(kind_id: str):
|
|||||||
try:
|
try:
|
||||||
configs = loader(kindmap(kind_id))
|
configs = loader(kindmap(kind_id))
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
raise VMError(f"Unknown Voicemeeter kind {kind_id}") from e
|
raise VMError(f'Unknown Voicemeeter kind {kind_id}') from e
|
||||||
return configs
|
return configs
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from abc import abstractmethod
|
import abc
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from .iremote import IRemote
|
from .iremote import IRemote
|
||||||
@@ -7,19 +7,19 @@ from .iremote import IRemote
|
|||||||
class Adapter(IRemote):
|
class Adapter(IRemote):
|
||||||
"""Adapter to the common interface."""
|
"""Adapter to the common interface."""
|
||||||
|
|
||||||
@abstractmethod
|
@abc.abstractmethod
|
||||||
def ins(self):
|
def ins(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abc.abstractmethod
|
||||||
def outs(self):
|
def outs(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abc.abstractmethod
|
||||||
def input(self):
|
def input(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abc.abstractmethod
|
||||||
def output(self):
|
def output(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -31,8 +31,8 @@ class Adapter(IRemote):
|
|||||||
return self._remote.get_num_devices(direction)
|
return self._remote.get_num_devices(direction)
|
||||||
|
|
||||||
vals = self._remote.get_device_description(index, direction)
|
vals = self._remote.get_device_description(index, direction)
|
||||||
types = {1: "mme", 3: "wdm", 4: "ks", 5: "asio"}
|
types = {1: 'mme', 3: 'wdm', 4: 'ks', 5: 'asio'}
|
||||||
return {"name": vals[0], "type": types[vals[1]], "id": vals[2]}
|
return {'name': vals[0], 'type': types[vals[1]], 'id': vals[2]}
|
||||||
|
|
||||||
|
|
||||||
class Device(Adapter):
|
class Device(Adapter):
|
||||||
@@ -47,26 +47,26 @@ class Device(Adapter):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def num_ins(cls) -> int:
|
def num_ins(cls) -> int:
|
||||||
return cls.getter(direction="in")
|
return cls.getter(direction='in')
|
||||||
|
|
||||||
def num_outs(cls) -> int:
|
def num_outs(cls) -> int:
|
||||||
return cls.getter(direction="out")
|
return cls.getter(direction='out')
|
||||||
|
|
||||||
DEVICE_cls = type(
|
DEVICE_cls = type(
|
||||||
f"Device{remote.kind}",
|
f'Device{remote.kind}',
|
||||||
(cls,),
|
(cls,),
|
||||||
{
|
{
|
||||||
"ins": property(num_ins),
|
'ins': property(num_ins),
|
||||||
"outs": property(num_outs),
|
'outs': property(num_outs),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return DEVICE_cls(remote)
|
return DEVICE_cls(remote)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}"
|
return f'{type(self).__name__}'
|
||||||
|
|
||||||
def input(self, index: int) -> dict:
|
def input(self, index: int) -> dict:
|
||||||
return self.getter(index=index, direction="in")
|
return self.getter(index=index, direction='in')
|
||||||
|
|
||||||
def output(self, index: int) -> dict:
|
def output(self, index: int) -> dict:
|
||||||
return self.getter(index=index, direction="out")
|
return self.getter(index=index, direction='out')
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ class CAPIError(VMError):
|
|||||||
self.fn_name = fn_name
|
self.fn_name = fn_name
|
||||||
self.code = code
|
self.code = code
|
||||||
if self.code == -9:
|
if self.code == -9:
|
||||||
message = " ".join(
|
message = ' '.join(
|
||||||
(
|
(
|
||||||
f"no bind for {self.fn_name}.",
|
f'no bind for {self.fn_name}.',
|
||||||
"are you using an old version of the API?",
|
'are you using an old version of the API?',
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
message = f"{self.fn_name} returned {self.code}"
|
message = f'{self.fn_name} returned {self.code}'
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
|
|||||||
@@ -12,47 +12,47 @@ class Event:
|
|||||||
self.logger = logger.getChild(self.__class__.__name__)
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
|
|
||||||
def info(self, msg=None):
|
def info(self, msg=None):
|
||||||
info = (f"{msg} events",) if msg else ()
|
info = (f'{msg} events',) if msg else ()
|
||||||
if self.any():
|
if self.any():
|
||||||
info += (f"now listening for {', '.join(self.get())} events",)
|
info += (f"now listening for {', '.join(self.get())} events",)
|
||||||
else:
|
else:
|
||||||
info += ("not listening for any events",)
|
info += ('not listening for any events',)
|
||||||
self.logger.info(", ".join(info))
|
self.logger.info(', '.join(info))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pdirty(self) -> bool:
|
def pdirty(self) -> bool:
|
||||||
return self.subs["pdirty"]
|
return self.subs['pdirty']
|
||||||
|
|
||||||
@pdirty.setter
|
@pdirty.setter
|
||||||
def pdirty(self, val: bool):
|
def pdirty(self, val: bool):
|
||||||
self.subs["pdirty"] = val
|
self.subs['pdirty'] = val
|
||||||
self.info(f"pdirty {'added to' if val else 'removed from'}")
|
self.info(f"pdirty {'added to' if val else 'removed from'}")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mdirty(self) -> bool:
|
def mdirty(self) -> bool:
|
||||||
return self.subs["mdirty"]
|
return self.subs['mdirty']
|
||||||
|
|
||||||
@mdirty.setter
|
@mdirty.setter
|
||||||
def mdirty(self, val: bool):
|
def mdirty(self, val: bool):
|
||||||
self.subs["mdirty"] = val
|
self.subs['mdirty'] = val
|
||||||
self.info(f"mdirty {'added to' if val else 'removed from'}")
|
self.info(f"mdirty {'added to' if val else 'removed from'}")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def midi(self) -> bool:
|
def midi(self) -> bool:
|
||||||
return self.subs["midi"]
|
return self.subs['midi']
|
||||||
|
|
||||||
@midi.setter
|
@midi.setter
|
||||||
def midi(self, val: bool):
|
def midi(self, val: bool):
|
||||||
self.subs["midi"] = val
|
self.subs['midi'] = val
|
||||||
self.info(f"midi {'added to' if val else 'removed from'}")
|
self.info(f"midi {'added to' if val else 'removed from'}")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ldirty(self) -> bool:
|
def ldirty(self) -> bool:
|
||||||
return self.subs["ldirty"]
|
return self.subs['ldirty']
|
||||||
|
|
||||||
@ldirty.setter
|
@ldirty.setter
|
||||||
def ldirty(self, val: bool):
|
def ldirty(self, val: bool):
|
||||||
self.subs["ldirty"] = val
|
self.subs['ldirty'] = val
|
||||||
self.info(f"ldirty {'added to' if val else 'removed from'}")
|
self.info(f"ldirty {'added to' if val else 'removed from'}")
|
||||||
|
|
||||||
def get(self) -> list:
|
def get(self) -> list:
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import logging
|
import logging
|
||||||
from abc import abstractmethod
|
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
@@ -29,8 +28,8 @@ class FactoryBuilder:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
BuilderProgress = IntEnum(
|
BuilderProgress = IntEnum(
|
||||||
"BuilderProgress",
|
'BuilderProgress',
|
||||||
"strip bus command macrobutton vban device option recorder patch fx",
|
'strip bus command macrobutton vban device option recorder patch fx',
|
||||||
start=0,
|
start=0,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -38,22 +37,22 @@ class FactoryBuilder:
|
|||||||
self._factory = factory
|
self._factory = factory
|
||||||
self.kind = kind
|
self.kind = kind
|
||||||
self._info = (
|
self._info = (
|
||||||
f"Finished building strips for {self._factory}",
|
f'Finished building strips for {self._factory}',
|
||||||
f"Finished building buses for {self._factory}",
|
f'Finished building buses for {self._factory}',
|
||||||
f"Finished building commands for {self._factory}",
|
f'Finished building commands for {self._factory}',
|
||||||
f"Finished building macrobuttons for {self._factory}",
|
f'Finished building macrobuttons for {self._factory}',
|
||||||
f"Finished building vban in/out streams for {self._factory}",
|
f'Finished building vban in/out streams for {self._factory}',
|
||||||
f"Finished building device for {self._factory}",
|
f'Finished building device for {self._factory}',
|
||||||
f"Finished building option for {self._factory}",
|
f'Finished building option for {self._factory}',
|
||||||
f"Finished building recorder for {self._factory}",
|
f'Finished building recorder for {self._factory}',
|
||||||
f"Finished building patch for {self._factory}",
|
f'Finished building patch for {self._factory}',
|
||||||
f"Finished building fx for {self._factory}",
|
f'Finished building fx for {self._factory}',
|
||||||
)
|
)
|
||||||
self.logger = logger.getChild(self.__class__.__name__)
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
|
|
||||||
def _pinfo(self, name: str) -> None:
|
def _pinfo(self, name: str) -> None:
|
||||||
"""prints progress status for each step"""
|
"""prints progress status for each step"""
|
||||||
name = name.split("_")[1]
|
name = name.split('_')[1]
|
||||||
self.logger.debug(self._info[int(getattr(self.BuilderProgress, name))])
|
self.logger.debug(self._info[int(getattr(self.BuilderProgress, name))])
|
||||||
|
|
||||||
def make_strip(self):
|
def make_strip(self):
|
||||||
@@ -108,17 +107,17 @@ class FactoryBase(Remote):
|
|||||||
|
|
||||||
def __init__(self, kind_id: str, **kwargs):
|
def __init__(self, kind_id: str, **kwargs):
|
||||||
defaultkwargs = {
|
defaultkwargs = {
|
||||||
"sync": False,
|
'sync': False,
|
||||||
"ratelimit": 0.033,
|
'ratelimit': 0.033,
|
||||||
"pdirty": False,
|
'pdirty': False,
|
||||||
"mdirty": False,
|
'mdirty': False,
|
||||||
"midi": False,
|
'midi': False,
|
||||||
"ldirty": False,
|
'ldirty': False,
|
||||||
"timeout": 2,
|
'timeout': 2,
|
||||||
"bits": 64,
|
'bits': 64,
|
||||||
}
|
}
|
||||||
if "subs" in kwargs:
|
if 'subs' in kwargs:
|
||||||
defaultkwargs |= kwargs.pop("subs") # for backwards compatibility
|
defaultkwargs |= kwargs.pop('subs') # for backwards compatibility
|
||||||
kwargs = defaultkwargs | kwargs
|
kwargs = defaultkwargs | kwargs
|
||||||
self.kind = kindmap(kind_id)
|
self.kind = kindmap(kind_id)
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
@@ -135,12 +134,7 @@ class FactoryBase(Remote):
|
|||||||
self._configs = None
|
self._configs = None
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return f"Voicemeeter {self.kind}"
|
return f'Voicemeeter {self.kind}'
|
||||||
|
|
||||||
@property
|
|
||||||
@abstractmethod
|
|
||||||
def steps(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def configs(self):
|
def configs(self):
|
||||||
@@ -225,15 +219,15 @@ def remote_factory(kind_id: str, **kwargs) -> Remote:
|
|||||||
Returns a Remote class of a kind
|
Returns a Remote class of a kind
|
||||||
"""
|
"""
|
||||||
match kind_id:
|
match kind_id:
|
||||||
case "basic":
|
case 'basic':
|
||||||
_factory = BasicFactory
|
_factory = BasicFactory
|
||||||
case "banana":
|
case 'banana':
|
||||||
_factory = BananaFactory
|
_factory = BananaFactory
|
||||||
case "potato":
|
case 'potato':
|
||||||
_factory = PotatoFactory
|
_factory = PotatoFactory
|
||||||
case _:
|
case _:
|
||||||
raise ValueError(f"Unknown Voicemeeter kind '{kind_id}'")
|
raise ValueError(f"Unknown Voicemeeter kind '{kind_id}'")
|
||||||
return type(f"Remote{kind_id.capitalize()}", (_factory,), {})(kind_id, **kwargs)
|
return type(f'Remote{kind_id.capitalize()}', (_factory,), {})(kind_id, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def request_remote_obj(kind_id: str, **kwargs) -> Remote:
|
def request_remote_obj(kind_id: str, **kwargs) -> Remote:
|
||||||
@@ -243,12 +237,12 @@ def request_remote_obj(kind_id: str, **kwargs) -> Remote:
|
|||||||
Returns a reference to a Remote class of a kind
|
Returns a reference to a Remote class of a kind
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logger_entry = logger.getChild("request_remote_obj")
|
logger_entry = logger.getChild('request_remote_obj')
|
||||||
|
|
||||||
REMOTE_obj = None
|
REMOTE_obj = None
|
||||||
try:
|
try:
|
||||||
REMOTE_obj = remote_factory(kind_id, **kwargs)
|
REMOTE_obj = remote_factory(kind_id, **kwargs)
|
||||||
except (ValueError, TypeError) as e:
|
except (ValueError, TypeError) as e:
|
||||||
logger_entry.exception(f"{type(e).__name__}: {e}")
|
logger_entry.exception(f'{type(e).__name__}: {e}')
|
||||||
raise VMError(str(e)) from e
|
raise VMError(str(e)) from e
|
||||||
return REMOTE_obj
|
return REMOTE_obj
|
||||||
|
|||||||
@@ -7,21 +7,21 @@ from .error import InstallError
|
|||||||
|
|
||||||
BITS = 64 if ct.sizeof(ct.c_void_p) == 8 else 32
|
BITS = 64 if ct.sizeof(ct.c_void_p) == 8 else 32
|
||||||
|
|
||||||
if platform.system() != "Windows":
|
if platform.system() != 'Windows':
|
||||||
raise InstallError("Only Windows OS supported")
|
raise InstallError('Only Windows OS supported')
|
||||||
|
|
||||||
|
|
||||||
VM_KEY = "VB:Voicemeeter {17359A74-1236-5467}"
|
VM_KEY = 'VB:Voicemeeter {17359A74-1236-5467}'
|
||||||
REG_KEY = "\\".join(
|
REG_KEY = '\\'.join(
|
||||||
filter(
|
filter(
|
||||||
None,
|
None,
|
||||||
(
|
(
|
||||||
"SOFTWARE",
|
'SOFTWARE',
|
||||||
"WOW6432Node" if BITS == 64 else "",
|
'WOW6432Node' if BITS == 64 else '',
|
||||||
"Microsoft",
|
'Microsoft',
|
||||||
"Windows",
|
'Windows',
|
||||||
"CurrentVersion",
|
'CurrentVersion',
|
||||||
"Uninstall",
|
'Uninstall',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -29,20 +29,20 @@ REG_KEY = "\\".join(
|
|||||||
|
|
||||||
def get_vmpath():
|
def get_vmpath():
|
||||||
with winreg.OpenKey(
|
with winreg.OpenKey(
|
||||||
winreg.HKEY_LOCAL_MACHINE, r"{}".format("\\".join((REG_KEY, VM_KEY)))
|
winreg.HKEY_LOCAL_MACHINE, r'{}'.format('\\'.join((REG_KEY, VM_KEY)))
|
||||||
) as vm_key:
|
) as vm_key:
|
||||||
return winreg.QueryValueEx(vm_key, r"UninstallString")[0].strip('"')
|
return winreg.QueryValueEx(vm_key, r'UninstallString')[0].strip('"')
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
vm_parent = Path(get_vmpath()).parent
|
vm_parent = Path(get_vmpath()).parent
|
||||||
except FileNotFoundError as e:
|
except FileNotFoundError as e:
|
||||||
raise InstallError("Unable to fetch DLL path from the registry") from e
|
raise InstallError('Unable to fetch DLL path from the registry') from e
|
||||||
|
|
||||||
DLL_NAME = f'VoicemeeterRemote{"64" if BITS == 64 else ""}.dll'
|
DLL_NAME = f'VoicemeeterRemote{"64" if BITS == 64 else ""}.dll'
|
||||||
|
|
||||||
dll_path = vm_parent.joinpath(DLL_NAME)
|
dll_path = vm_parent.joinpath(DLL_NAME)
|
||||||
if not dll_path.is_file():
|
if not dll_path.is_file():
|
||||||
raise InstallError(f"Could not find {dll_path}")
|
raise InstallError(f'Could not find {dll_path}')
|
||||||
|
|
||||||
libc = ct.CDLL(str(dll_path))
|
libc = ct.CDLL(str(dll_path))
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
|
import abc
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from abc import ABCMeta, abstractmethod
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class IRemote(metaclass=ABCMeta):
|
class IRemote(abc.ABC):
|
||||||
"""
|
"""
|
||||||
Common interface between base class and extended (higher) classes
|
Common interface between base class and extended (higher) classes
|
||||||
|
|
||||||
@@ -19,27 +19,27 @@ class IRemote(metaclass=ABCMeta):
|
|||||||
|
|
||||||
def getter(self, param, **kwargs):
|
def getter(self, param, **kwargs):
|
||||||
"""Gets a parameter value"""
|
"""Gets a parameter value"""
|
||||||
self.logger.debug(f"getter: {self._cmd(param)}")
|
self.logger.debug(f'getter: {self._cmd(param)}')
|
||||||
return self._remote.get(self._cmd(param), **kwargs)
|
return self._remote.get(self._cmd(param), **kwargs)
|
||||||
|
|
||||||
def setter(self, param, val):
|
def setter(self, param, val):
|
||||||
"""Sets a parameter value"""
|
"""Sets a parameter value"""
|
||||||
self.logger.debug(f"setter: {self._cmd(param)}={val}")
|
self.logger.debug(f'setter: {self._cmd(param)}={val}')
|
||||||
self._remote.set(self._cmd(param), val)
|
self._remote.set(self._cmd(param), val)
|
||||||
|
|
||||||
def _cmd(self, param):
|
def _cmd(self, param):
|
||||||
cmd = (self.identifier,)
|
cmd = (self.identifier,)
|
||||||
if param:
|
if param:
|
||||||
cmd += (f".{param}",)
|
cmd += (f'.{param}',)
|
||||||
return "".join(cmd)
|
return ''.join(cmd)
|
||||||
|
|
||||||
@abstractmethod
|
@abc.abstractmethod
|
||||||
def identifier(self):
|
def identifier(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def apply(self, data: dict):
|
def apply(self, data: dict):
|
||||||
def fget(attr, val):
|
def fget(attr, val):
|
||||||
if attr == "mode":
|
if attr == 'mode':
|
||||||
return (getattr(self, attr), val, 1)
|
return (getattr(self, attr), val, 1)
|
||||||
return (self, attr, val)
|
return (self, attr, val)
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ class IRemote(metaclass=ABCMeta):
|
|||||||
target, attr, val = fget(attr, val)
|
target, attr, val = fget(attr, val)
|
||||||
setattr(target, attr, val)
|
setattr(target, attr, val)
|
||||||
else:
|
else:
|
||||||
self.logger.error(f"invalid attribute {attr} for {self}")
|
self.logger.error(f'invalid attribute {attr} for {self}')
|
||||||
else:
|
else:
|
||||||
target = getattr(self, attr)
|
target = getattr(self, attr)
|
||||||
target.apply(val)
|
target.apply(val)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class SingletonType(type):
|
|||||||
return cls._instances[cls]
|
return cls._instances[cls]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(frozen=True)
|
||||||
class KindMapClass(metaclass=SingletonType):
|
class KindMapClass(metaclass=SingletonType):
|
||||||
name: str
|
name: str
|
||||||
ins: tuple
|
ins: tuple
|
||||||
@@ -31,6 +31,9 @@ class KindMapClass(metaclass=SingletonType):
|
|||||||
asio: tuple
|
asio: tuple
|
||||||
insert: int
|
insert: int
|
||||||
composite: int
|
composite: int
|
||||||
|
strip_channels: int
|
||||||
|
bus_channels: int
|
||||||
|
cells: int
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def phys_in(self) -> int:
|
def phys_in(self) -> int:
|
||||||
@@ -68,49 +71,55 @@ class KindMapClass(metaclass=SingletonType):
|
|||||||
return self.name.capitalize()
|
return self.name.capitalize()
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(frozen=True)
|
||||||
class BasicMap(KindMapClass):
|
class BasicMap(KindMapClass):
|
||||||
name: str
|
|
||||||
ins: tuple = (2, 1)
|
ins: tuple = (2, 1)
|
||||||
outs: tuple = (1, 1)
|
outs: tuple = (1, 1)
|
||||||
vban: tuple = (4, 4, 1, 1)
|
vban: tuple = (4, 4, 1, 1)
|
||||||
asio: tuple = (0, 0)
|
asio: tuple = (0, 0)
|
||||||
insert: int = 0
|
insert: int = 0
|
||||||
composite: int = 0
|
composite: int = 0
|
||||||
|
strip_channels: int = 0
|
||||||
|
bus_channels: int = 0
|
||||||
|
cells: int = 0
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(frozen=True)
|
||||||
class BananaMap(KindMapClass):
|
class BananaMap(KindMapClass):
|
||||||
name: str
|
|
||||||
ins: tuple = (3, 2)
|
ins: tuple = (3, 2)
|
||||||
outs: tuple = (3, 2)
|
outs: tuple = (3, 2)
|
||||||
vban: tuple = (8, 8, 1, 1)
|
vban: tuple = (8, 8, 1, 1)
|
||||||
asio: tuple = (6, 8)
|
asio: tuple = (6, 8)
|
||||||
insert: int = 22
|
insert: int = 22
|
||||||
composite: int = 8
|
composite: int = 8
|
||||||
|
strip_channels: int = 0
|
||||||
|
bus_channels: int = 8
|
||||||
|
cells: int = 6
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(frozen=True)
|
||||||
class PotatoMap(KindMapClass):
|
class PotatoMap(KindMapClass):
|
||||||
name: str
|
|
||||||
ins: tuple = (5, 3)
|
ins: tuple = (5, 3)
|
||||||
outs: tuple = (5, 3)
|
outs: tuple = (5, 3)
|
||||||
vban: tuple = (8, 8, 1, 1)
|
vban: tuple = (8, 8, 1, 1)
|
||||||
asio: tuple = (10, 8)
|
asio: tuple = (10, 8)
|
||||||
insert: int = 34
|
insert: int = 34
|
||||||
composite: int = 8
|
composite: int = 8
|
||||||
|
strip_channels: int = 2
|
||||||
|
bus_channels: int = 8
|
||||||
|
cells: int = 6
|
||||||
|
|
||||||
|
|
||||||
def kind_factory(kind_id):
|
def kind_factory(kind_id):
|
||||||
match kind_id:
|
match kind_id:
|
||||||
case "basic":
|
case 'basic':
|
||||||
_kind_map = BasicMap
|
_kind_map = BasicMap
|
||||||
case "banana":
|
case 'banana':
|
||||||
_kind_map = BananaMap
|
_kind_map = BananaMap
|
||||||
case "potato":
|
case 'potato':
|
||||||
_kind_map = PotatoMap
|
_kind_map = PotatoMap
|
||||||
case _:
|
case _:
|
||||||
raise ValueError(f"Unknown Voicemeeter kind {kind_id}")
|
raise ValueError(f'Unknown Voicemeeter kind {kind_id}')
|
||||||
return _kind_map(name=kind_id)
|
return _kind_map(name=kind_id)
|
||||||
|
|
||||||
|
|
||||||
@@ -123,4 +132,4 @@ def request_kind_map(kind_id):
|
|||||||
return KIND_obj
|
return KIND_obj
|
||||||
|
|
||||||
|
|
||||||
kinds_all = list(request_kind_map(kind_id.name.lower()) for kind_id in KindId)
|
all = kinds_all = [request_kind_map(kind_id.name.lower()) for kind_id in KindId]
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ from enum import IntEnum
|
|||||||
from .iremote import IRemote
|
from .iremote import IRemote
|
||||||
|
|
||||||
ButtonModes = IntEnum(
|
ButtonModes = IntEnum(
|
||||||
"ButtonModes",
|
'ButtonModes',
|
||||||
"state stateonly trigger",
|
'state stateonly trigger',
|
||||||
start=1,
|
start=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16,12 +16,12 @@ class Adapter(IRemote):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def getter(self, mode):
|
def getter(self, mode):
|
||||||
self.logger.debug(f"getter: button[{self.index}].{ButtonModes(mode).name}")
|
self.logger.debug(f'getter: button[{self.index}].{ButtonModes(mode).name}')
|
||||||
return self._remote.get_buttonstatus(self.index, mode)
|
return self._remote.get_buttonstatus(self.index, mode)
|
||||||
|
|
||||||
def setter(self, mode, val):
|
def setter(self, mode, val):
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
f"setter: button[{self.index}].{ButtonModes(mode).name}={val}"
|
f'setter: button[{self.index}].{ButtonModes(mode).name}={val}'
|
||||||
)
|
)
|
||||||
self._remote.set_buttonstatus(self.index, val, mode)
|
self._remote.set_buttonstatus(self.index, val, mode)
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ class MacroButton(Adapter):
|
|||||||
"""Defines concrete implementation for macrobutton"""
|
"""Defines concrete implementation for macrobutton"""
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}{self._remote.kind}{self.index}"
|
return f'{type(self).__name__}{self._remote.kind}{self.index}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self) -> bool:
|
def state(self) -> bool:
|
||||||
|
|||||||
@@ -1,48 +1,48 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
from . import kinds
|
||||||
from .iremote import IRemote
|
from .iremote import IRemote
|
||||||
from .kinds import kinds_all
|
|
||||||
|
|
||||||
|
|
||||||
class FX(IRemote):
|
class FX(IRemote):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}"
|
return f'{type(self).__name__}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return "FX"
|
return 'FX'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def reverb(self) -> bool:
|
def reverb(self) -> bool:
|
||||||
return self.getter("reverb.On") == 1
|
return self.getter('reverb.On') == 1
|
||||||
|
|
||||||
@reverb.setter
|
@reverb.setter
|
||||||
def reverb(self, val: bool):
|
def reverb(self, val: bool):
|
||||||
self.setter("reverb.On", 1 if val else 0)
|
self.setter('reverb.On', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def reverb_ab(self) -> bool:
|
def reverb_ab(self) -> bool:
|
||||||
return self.getter("reverb.ab") == 1
|
return self.getter('reverb.ab') == 1
|
||||||
|
|
||||||
@reverb_ab.setter
|
@reverb_ab.setter
|
||||||
def reverb_ab(self, val: bool):
|
def reverb_ab(self, val: bool):
|
||||||
self.setter("reverb.ab", 1 if val else 0)
|
self.setter('reverb.ab', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def delay(self) -> bool:
|
def delay(self) -> bool:
|
||||||
return self.getter("delay.On") == 1
|
return self.getter('delay.On') == 1
|
||||||
|
|
||||||
@delay.setter
|
@delay.setter
|
||||||
def delay(self, val: bool):
|
def delay(self, val: bool):
|
||||||
self.setter("delay.On", 1 if val else 0)
|
self.setter('delay.On', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def delay_ab(self) -> bool:
|
def delay_ab(self) -> bool:
|
||||||
return self.getter("delay.ab") == 1
|
return self.getter('delay.ab') == 1
|
||||||
|
|
||||||
@delay_ab.setter
|
@delay_ab.setter
|
||||||
def delay_ab(self, val: bool):
|
def delay_ab(self, val: bool):
|
||||||
self.setter("delay.ab", 1 if val else 0)
|
self.setter('delay.ab', 1 if val else 0)
|
||||||
|
|
||||||
|
|
||||||
class Patch(IRemote):
|
class Patch(IRemote):
|
||||||
@@ -57,50 +57,50 @@ class Patch(IRemote):
|
|||||||
"""
|
"""
|
||||||
ASIO_cls = _make_asio_mixins(remote)[remote.kind.name]
|
ASIO_cls = _make_asio_mixins(remote)[remote.kind.name]
|
||||||
return type(
|
return type(
|
||||||
f"Patch{remote.kind}",
|
f'Patch{remote.kind}',
|
||||||
(cls, ASIO_cls),
|
(cls, ASIO_cls),
|
||||||
{
|
{
|
||||||
"composite": tuple(Composite(remote, i) for i in range(8)),
|
'composite': tuple(Composite(remote, i) for i in range(8)),
|
||||||
"insert": tuple(Insert(remote, i) for i in range(remote.kind.insert)),
|
'insert': tuple(Insert(remote, i) for i in range(remote.kind.insert)),
|
||||||
},
|
},
|
||||||
)(remote)
|
)(remote)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}"
|
return f'{type(self).__name__}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return "patch"
|
return 'patch'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def postfadercomp(self) -> bool:
|
def postfadercomp(self) -> bool:
|
||||||
return self.getter("postfadercomposite") == 1
|
return self.getter('postfadercomposite') == 1
|
||||||
|
|
||||||
@postfadercomp.setter
|
@postfadercomp.setter
|
||||||
def postfadercomp(self, val: bool):
|
def postfadercomp(self, val: bool):
|
||||||
self.setter("postfadercomposite", 1 if val else 0)
|
self.setter('postfadercomposite', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def postfxinsert(self) -> bool:
|
def postfxinsert(self) -> bool:
|
||||||
return self.getter("postfxinsert") == 1
|
return self.getter('postfxinsert') == 1
|
||||||
|
|
||||||
@postfxinsert.setter
|
@postfxinsert.setter
|
||||||
def postfxinsert(self, val: bool):
|
def postfxinsert(self, val: bool):
|
||||||
self.setter("postfxinsert", 1 if val else 0)
|
self.setter('postfxinsert', 1 if val else 0)
|
||||||
|
|
||||||
|
|
||||||
class Asio(IRemote):
|
class Asio(IRemote):
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return "patch"
|
return 'patch'
|
||||||
|
|
||||||
|
|
||||||
class AsioIn(Asio):
|
class AsioIn(Asio):
|
||||||
def get(self) -> int:
|
def get(self) -> int:
|
||||||
return int(self.getter(f"asio[{self.index}]"))
|
return int(self.getter(f'asio[{self.index}]'))
|
||||||
|
|
||||||
def set(self, val: int):
|
def set(self, val: int):
|
||||||
self.setter(f"asio[{self.index}]", val)
|
self.setter(f'asio[{self.index}]', val)
|
||||||
|
|
||||||
|
|
||||||
class AsioOut(Asio):
|
class AsioOut(Asio):
|
||||||
@@ -109,10 +109,10 @@ class AsioOut(Asio):
|
|||||||
self._param = param
|
self._param = param
|
||||||
|
|
||||||
def get(self) -> int:
|
def get(self) -> int:
|
||||||
return int(self.getter(f"out{self._param}[{self.index}]"))
|
return int(self.getter(f'out{self._param}[{self.index}]'))
|
||||||
|
|
||||||
def set(self, val: int):
|
def set(self, val: int):
|
||||||
self.setter(f"out{self._param}[{self.index}]", val)
|
self.setter(f'out{self._param}[{self.index}]', val)
|
||||||
|
|
||||||
|
|
||||||
def _make_asio_mixin(remote, kind):
|
def _make_asio_mixin(remote, kind):
|
||||||
@@ -120,46 +120,46 @@ def _make_asio_mixin(remote, kind):
|
|||||||
asio_in, asio_out = kind.asio
|
asio_in, asio_out = kind.asio
|
||||||
|
|
||||||
return type(
|
return type(
|
||||||
f"ASIO{kind}",
|
f'ASIO{kind}',
|
||||||
(IRemote,),
|
(IRemote,),
|
||||||
{
|
{
|
||||||
"asio": tuple(AsioIn(remote, i) for i in range(asio_in)),
|
'asio': tuple(AsioIn(remote, i) for i in range(asio_in)),
|
||||||
**{
|
**{
|
||||||
param: tuple(AsioOut(remote, i, param) for i in range(asio_out))
|
param: tuple(AsioOut(remote, i, param) for i in range(asio_out))
|
||||||
for param in ["A2", "A3", "A4", "A5"]
|
for param in ['A2', 'A3', 'A4', 'A5']
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _make_asio_mixins(remote):
|
def _make_asio_mixins(remote):
|
||||||
return {kind.name: _make_asio_mixin(remote, kind) for kind in kinds_all}
|
return {kind.name: _make_asio_mixin(remote, kind) for kind in kinds.all}
|
||||||
|
|
||||||
|
|
||||||
class Composite(IRemote):
|
class Composite(IRemote):
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return "patch"
|
return 'patch'
|
||||||
|
|
||||||
def get(self) -> int:
|
def get(self) -> int:
|
||||||
return int(self.getter(f"composite[{self.index}]"))
|
return int(self.getter(f'composite[{self.index}]'))
|
||||||
|
|
||||||
def set(self, val: int):
|
def set(self, val: int):
|
||||||
self.setter(f"composite[{self.index}]", val)
|
self.setter(f'composite[{self.index}]', val)
|
||||||
|
|
||||||
|
|
||||||
class Insert(IRemote):
|
class Insert(IRemote):
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return "patch"
|
return 'patch'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def on(self) -> bool:
|
def on(self) -> bool:
|
||||||
return self.getter(f"insert[{self.index}]") == 1
|
return self.getter(f'insert[{self.index}]') == 1
|
||||||
|
|
||||||
@on.setter
|
@on.setter
|
||||||
def on(self, val: bool):
|
def on(self, val: bool):
|
||||||
self.setter(f"insert[{self.index}]", 1 if val else 0)
|
self.setter(f'insert[{self.index}]', 1 if val else 0)
|
||||||
|
|
||||||
|
|
||||||
class Option(IRemote):
|
class Option(IRemote):
|
||||||
@@ -173,61 +173,61 @@ class Option(IRemote):
|
|||||||
Returns a Option class of a kind.
|
Returns a Option class of a kind.
|
||||||
"""
|
"""
|
||||||
return type(
|
return type(
|
||||||
f"Option{remote.kind}",
|
f'Option{remote.kind}',
|
||||||
(cls,),
|
(cls,),
|
||||||
{
|
{
|
||||||
"delay": tuple(Delay(remote, i) for i in range(remote.kind.phys_out)),
|
'delay': tuple(Delay(remote, i) for i in range(remote.kind.phys_out)),
|
||||||
},
|
},
|
||||||
)(remote)
|
)(remote)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}"
|
return f'{type(self).__name__}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return "option"
|
return 'option'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sr(self) -> int:
|
def sr(self) -> int:
|
||||||
return int(self.getter("sr"))
|
return int(self.getter('sr'))
|
||||||
|
|
||||||
@sr.setter
|
@sr.setter
|
||||||
def sr(self, val: int):
|
def sr(self, val: int):
|
||||||
opts = (44100, 48000, 88200, 96000, 176400, 192000)
|
opts = (44100, 48000, 88200, 96000, 176400, 192000)
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
self.logger.warning(f"sr got: {val} but expected a value in {opts}")
|
self.logger.warning(f'sr got: {val} but expected a value in {opts}')
|
||||||
self.setter("sr", val)
|
self.setter('sr', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def asiosr(self) -> bool:
|
def asiosr(self) -> bool:
|
||||||
return self.getter("asiosr") == 1
|
return self.getter('asiosr') == 1
|
||||||
|
|
||||||
@asiosr.setter
|
@asiosr.setter
|
||||||
def asiosr(self, val: bool):
|
def asiosr(self, val: bool):
|
||||||
self.setter("asiosr", 1 if val else 0)
|
self.setter('asiosr', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def monitoronsel(self) -> bool:
|
def monitoronsel(self) -> bool:
|
||||||
return self.getter("monitoronsel") == 1
|
return self.getter('monitoronsel') == 1
|
||||||
|
|
||||||
@monitoronsel.setter
|
@monitoronsel.setter
|
||||||
def monitoronsel(self, val: bool):
|
def monitoronsel(self, val: bool):
|
||||||
self.setter("monitoronsel", 1 if val else 0)
|
self.setter('monitoronsel', 1 if val else 0)
|
||||||
|
|
||||||
def buffer(self, driver, buffer):
|
def buffer(self, driver, buffer):
|
||||||
self.setter(f"buffer.{driver}", buffer)
|
self.setter(f'buffer.{driver}', buffer)
|
||||||
|
|
||||||
|
|
||||||
class Delay(IRemote):
|
class Delay(IRemote):
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return "option"
|
return 'option'
|
||||||
|
|
||||||
def get(self) -> int:
|
def get(self) -> int:
|
||||||
return int(self.getter(f"delay[{self.index}]"))
|
return int(self.getter(f'delay[{self.index}]'))
|
||||||
|
|
||||||
def set(self, val: int):
|
def set(self, val: int):
|
||||||
self.setter(f"delay[{self.index}]", val)
|
self.setter(f'delay[{self.index}]', val)
|
||||||
|
|
||||||
|
|
||||||
class Midi:
|
class Midi:
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
|
from . import kinds
|
||||||
from .error import VMError
|
from .error import VMError
|
||||||
from .iremote import IRemote
|
from .iremote import IRemote
|
||||||
from .kinds import kinds_all
|
|
||||||
from .meta import action_fn, bool_prop
|
from .meta import action_fn, bool_prop
|
||||||
|
|
||||||
|
|
||||||
@@ -23,91 +23,91 @@ class Recorder(IRemote):
|
|||||||
CHANNELOUTMIXIN_cls = _make_channelout_mixins[remote.kind.name]
|
CHANNELOUTMIXIN_cls = _make_channelout_mixins[remote.kind.name]
|
||||||
ARMCHANNELMIXIN_cls = _make_armchannel_mixins(remote)[remote.kind.name]
|
ARMCHANNELMIXIN_cls = _make_armchannel_mixins(remote)[remote.kind.name]
|
||||||
REC_cls = type(
|
REC_cls = type(
|
||||||
f"Recorder{remote.kind}",
|
f'Recorder{remote.kind}',
|
||||||
(cls, CHANNELOUTMIXIN_cls, ARMCHANNELMIXIN_cls),
|
(cls, CHANNELOUTMIXIN_cls, ARMCHANNELMIXIN_cls),
|
||||||
{
|
{
|
||||||
**{
|
**{
|
||||||
param: action_fn(param)
|
param: action_fn(param)
|
||||||
for param in [
|
for param in [
|
||||||
"play",
|
'play',
|
||||||
"stop",
|
'stop',
|
||||||
"pause",
|
'pause',
|
||||||
"replay",
|
'replay',
|
||||||
"record",
|
'record',
|
||||||
"ff",
|
'ff',
|
||||||
"rew",
|
'rew',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mode": RecorderMode(remote),
|
'mode': RecorderMode(remote),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return REC_cls(remote)
|
return REC_cls(remote)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}"
|
return f'{type(self).__name__}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return "recorder"
|
return 'recorder'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def samplerate(self) -> int:
|
def samplerate(self) -> int:
|
||||||
return int(self.getter("samplerate"))
|
return int(self.getter('samplerate'))
|
||||||
|
|
||||||
@samplerate.setter
|
@samplerate.setter
|
||||||
def samplerate(self, val: int):
|
def samplerate(self, val: int):
|
||||||
opts = (22050, 24000, 32000, 44100, 48000, 88200, 96000, 176400, 192000)
|
opts = (22050, 24000, 32000, 44100, 48000, 88200, 96000, 176400, 192000)
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
self.logger.warning(f"samplerate got: {val} but expected a value in {opts}")
|
self.logger.warning(f'samplerate got: {val} but expected a value in {opts}')
|
||||||
self.setter("samplerate", val)
|
self.setter('samplerate', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bitresolution(self) -> int:
|
def bitresolution(self) -> int:
|
||||||
return int(self.getter("bitresolution"))
|
return int(self.getter('bitresolution'))
|
||||||
|
|
||||||
@bitresolution.setter
|
@bitresolution.setter
|
||||||
def bitresolution(self, val: int):
|
def bitresolution(self, val: int):
|
||||||
opts = (8, 16, 24, 32)
|
opts = (8, 16, 24, 32)
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
f"bitresolution got: {val} but expected a value in {opts}"
|
f'bitresolution got: {val} but expected a value in {opts}'
|
||||||
)
|
)
|
||||||
self.setter("bitresolution", val)
|
self.setter('bitresolution', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def channel(self) -> int:
|
def channel(self) -> int:
|
||||||
return int(self.getter("channel"))
|
return int(self.getter('channel'))
|
||||||
|
|
||||||
@channel.setter
|
@channel.setter
|
||||||
def channel(self, val: int):
|
def channel(self, val: int):
|
||||||
if not 1 <= val <= 8:
|
if not 1 <= val <= 8:
|
||||||
self.logger.warning(f"channel got: {val} but expected a value from 1 to 8")
|
self.logger.warning(f'channel got: {val} but expected a value from 1 to 8')
|
||||||
self.setter("channel", val)
|
self.setter('channel', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def kbps(self):
|
def kbps(self):
|
||||||
return int(self.getter("kbps"))
|
return int(self.getter('kbps'))
|
||||||
|
|
||||||
@kbps.setter
|
@kbps.setter
|
||||||
def kbps(self, val: int):
|
def kbps(self, val: int):
|
||||||
opts = (32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320)
|
opts = (32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320)
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
self.logger.warning(f"kbps got: {val} but expected a value in {opts}")
|
self.logger.warning(f'kbps got: {val} but expected a value in {opts}')
|
||||||
self.setter("kbps", val)
|
self.setter('kbps', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gain(self) -> float:
|
def gain(self) -> float:
|
||||||
return round(self.getter("gain"), 1)
|
return round(self.getter('gain'), 1)
|
||||||
|
|
||||||
@gain.setter
|
@gain.setter
|
||||||
def gain(self, val: float):
|
def gain(self, val: float):
|
||||||
self.setter("gain", val)
|
self.setter('gain', val)
|
||||||
|
|
||||||
def load(self, file: str):
|
def load(self, file: str):
|
||||||
try:
|
try:
|
||||||
self.setter("load", file)
|
self.setter('load', file)
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
raise VMError("File full directory must be a raw string")
|
raise VMError('File full directory must be a raw string')
|
||||||
|
|
||||||
# loop forwarder methods, for backwards compatibility
|
# loop forwarder methods, for backwards compatibility
|
||||||
@property
|
@property
|
||||||
@@ -121,69 +121,69 @@ class Recorder(IRemote):
|
|||||||
def goto(self, time_str):
|
def goto(self, time_str):
|
||||||
def get_sec():
|
def get_sec():
|
||||||
"""Get seconds from time string"""
|
"""Get seconds from time string"""
|
||||||
h, m, s = time_str.split(":")
|
h, m, s = time_str.split(':')
|
||||||
return int(h) * 3600 + int(m) * 60 + int(s)
|
return int(h) * 3600 + int(m) * 60 + int(s)
|
||||||
|
|
||||||
time_str = str(time_str) # coerce the type
|
time_str = str(time_str) # coerce the type
|
||||||
if (
|
if (
|
||||||
re.match(
|
re.match(
|
||||||
r"^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$",
|
r'^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$',
|
||||||
time_str,
|
time_str,
|
||||||
)
|
)
|
||||||
is not None
|
is not None
|
||||||
):
|
):
|
||||||
self.setter("goto", get_sec())
|
self.setter('goto', get_sec())
|
||||||
else:
|
else:
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
"goto expects a string that matches the format 'hh:mm:ss'"
|
"goto expects a string that matches the format 'hh:mm:ss'"
|
||||||
)
|
)
|
||||||
|
|
||||||
def filetype(self, val: str):
|
def filetype(self, val: str):
|
||||||
opts = {"wav": 1, "aiff": 2, "bwf": 3, "mp3": 100}
|
opts = {'wav': 1, 'aiff': 2, 'bwf': 3, 'mp3': 100}
|
||||||
try:
|
try:
|
||||||
self.setter("filetype", opts[val.lower()])
|
self.setter('filetype', opts[val.lower()])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
f"filetype got: {val} but expected a value in {list(opts.keys())}"
|
f'filetype got: {val} but expected a value in {list(opts.keys())}'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class RecorderMode(IRemote):
|
class RecorderMode(IRemote):
|
||||||
@property
|
@property
|
||||||
def identifier(self):
|
def identifier(self):
|
||||||
return "recorder.mode"
|
return 'recorder.mode'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def recbus(self) -> bool:
|
def recbus(self) -> bool:
|
||||||
return self.getter("recbus") == 1
|
return self.getter('recbus') == 1
|
||||||
|
|
||||||
@recbus.setter
|
@recbus.setter
|
||||||
def recbus(self, val: bool):
|
def recbus(self, val: bool):
|
||||||
self.setter("recbus", 1 if val else 0)
|
self.setter('recbus', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def playonload(self) -> bool:
|
def playonload(self) -> bool:
|
||||||
return self.getter("playonload") == 1
|
return self.getter('playonload') == 1
|
||||||
|
|
||||||
@playonload.setter
|
@playonload.setter
|
||||||
def playonload(self, val: bool):
|
def playonload(self, val: bool):
|
||||||
self.setter("playonload", 1 if val else 0)
|
self.setter('playonload', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def loop(self) -> bool:
|
def loop(self) -> bool:
|
||||||
return self.getter("loop") == 1
|
return self.getter('loop') == 1
|
||||||
|
|
||||||
@loop.setter
|
@loop.setter
|
||||||
def loop(self, val: bool):
|
def loop(self, val: bool):
|
||||||
self.setter("loop", 1 if val else 0)
|
self.setter('loop', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def multitrack(self) -> bool:
|
def multitrack(self) -> bool:
|
||||||
return self.getter("multitrack") == 1
|
return self.getter('multitrack') == 1
|
||||||
|
|
||||||
@multitrack.setter
|
@multitrack.setter
|
||||||
def multitrack(self, val: bool):
|
def multitrack(self, val: bool):
|
||||||
self.setter("multitrack", 1 if val else 0)
|
self.setter('multitrack', 1 if val else 0)
|
||||||
|
|
||||||
|
|
||||||
class RecorderArmChannel(IRemote):
|
class RecorderArmChannel(IRemote):
|
||||||
@@ -192,51 +192,51 @@ class RecorderArmChannel(IRemote):
|
|||||||
self._i = i
|
self._i = i
|
||||||
|
|
||||||
def set(self, val: bool):
|
def set(self, val: bool):
|
||||||
self.setter("", 1 if val else 0)
|
self.setter('', 1 if val else 0)
|
||||||
|
|
||||||
|
|
||||||
class RecorderArmStrip(RecorderArmChannel):
|
class RecorderArmStrip(RecorderArmChannel):
|
||||||
@property
|
@property
|
||||||
def identifier(self):
|
def identifier(self):
|
||||||
return f"recorder.armstrip[{self._i}]"
|
return f'recorder.armstrip[{self._i}]'
|
||||||
|
|
||||||
|
|
||||||
class RecorderArmBus(RecorderArmChannel):
|
class RecorderArmBus(RecorderArmChannel):
|
||||||
@property
|
@property
|
||||||
def identifier(self):
|
def identifier(self):
|
||||||
return f"recorder.armbus[{self._i}]"
|
return f'recorder.armbus[{self._i}]'
|
||||||
|
|
||||||
|
|
||||||
def _make_armchannel_mixin(remote, kind):
|
def _make_armchannel_mixin(remote, kind):
|
||||||
"""Creates an armchannel out mixin"""
|
"""Creates an armchannel out mixin"""
|
||||||
return type(
|
return type(
|
||||||
f"ArmChannelMixin{kind}",
|
f'ArmChannelMixin{kind}',
|
||||||
(),
|
(),
|
||||||
{
|
{
|
||||||
"armstrip": tuple(
|
'armstrip': tuple(
|
||||||
RecorderArmStrip(remote, i) for i in range(kind.num_strip)
|
RecorderArmStrip(remote, i) for i in range(kind.num_strip)
|
||||||
),
|
),
|
||||||
"armbus": tuple(RecorderArmBus(remote, i) for i in range(kind.num_bus)),
|
'armbus': tuple(RecorderArmBus(remote, i) for i in range(kind.num_bus)),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _make_armchannel_mixins(remote):
|
def _make_armchannel_mixins(remote):
|
||||||
return {kind.name: _make_armchannel_mixin(remote, kind) for kind in kinds_all}
|
return {kind.name: _make_armchannel_mixin(remote, kind) for kind in kinds.all}
|
||||||
|
|
||||||
|
|
||||||
def _make_channelout_mixin(kind):
|
def _make_channelout_mixin(kind):
|
||||||
"""Creates a channel out mixin"""
|
"""Creates a channel out mixin"""
|
||||||
return type(
|
return type(
|
||||||
f"ChannelOutMixin{kind}",
|
f'ChannelOutMixin{kind}',
|
||||||
(),
|
(),
|
||||||
{
|
{
|
||||||
**{f"A{i}": bool_prop(f"A{i}") for i in range(1, kind.phys_out + 1)},
|
**{f'A{i}': bool_prop(f'A{i}') for i in range(1, kind.phys_out + 1)},
|
||||||
**{f"B{i}": bool_prop(f"B{i}") for i in range(1, kind.virt_out + 1)},
|
**{f'B{i}': bool_prop(f'B{i}') for i in range(1, kind.virt_out + 1)},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
_make_channelout_mixins = {
|
_make_channelout_mixins = {
|
||||||
kind.name: _make_channelout_mixin(kind) for kind in kinds_all
|
kind.name: _make_channelout_mixin(kind) for kind in kinds.all
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import abc
|
||||||
import ctypes as ct
|
import ctypes as ct
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from abc import abstractmethod
|
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
from typing import Iterable, Optional, Union
|
from typing import Iterable, Optional, Union
|
||||||
|
|
||||||
@@ -19,18 +19,19 @@ from .util import deep_merge, grouper, polling, script, timeout
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Remote(CBindings):
|
class Remote(abc.ABC):
|
||||||
"""Base class responsible for wrapping the C Remote API"""
|
"""An abstract base class for Voicemeeter Remote API wrappers. Defines common methods and properties."""
|
||||||
|
|
||||||
DELAY = 0.001
|
DELAY = 0.001
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
self._bindings = CBindings()
|
||||||
self.strip_mode = 0
|
self.strip_mode = 0
|
||||||
self.cache = {}
|
self.cache = {}
|
||||||
self.midi = Midi()
|
self.midi = Midi()
|
||||||
self.subject = self.observer = Subject()
|
self.subject = self.observer = Subject()
|
||||||
self.event = Event(
|
self.event = Event(
|
||||||
{k: kwargs.pop(k) for k in ("pdirty", "mdirty", "midi", "ldirty")}
|
{k: kwargs.pop(k) for k in ('pdirty', 'mdirty', 'midi', 'ldirty')}
|
||||||
)
|
)
|
||||||
self.gui = VmGui()
|
self.gui = VmGui()
|
||||||
self.stop_event = None
|
self.stop_event = None
|
||||||
@@ -41,7 +42,7 @@ class Remote(CBindings):
|
|||||||
|
|
||||||
if self.bits not in (32, 64):
|
if self.bits not in (32, 64):
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
f"kwarg bits got {self.bits}, expected either 32 or 64, defaulting to 64"
|
f'kwarg bits got {self.bits}, expected either 32 or 64, defaulting to 64'
|
||||||
)
|
)
|
||||||
self.bits = 64
|
self.bits = 64
|
||||||
|
|
||||||
@@ -52,16 +53,16 @@ class Remote(CBindings):
|
|||||||
self.init_thread()
|
self.init_thread()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@abstractmethod
|
@property
|
||||||
def __str__(self):
|
@abc.abstractmethod
|
||||||
"""Ensure subclasses override str magic method"""
|
def steps(self):
|
||||||
pass
|
"""Steps required to build the interface for this Voicemeeter kind"""
|
||||||
|
|
||||||
def init_thread(self):
|
def init_thread(self):
|
||||||
"""Starts updates thread."""
|
"""Starts updates thread."""
|
||||||
self.event.info()
|
self.event.info()
|
||||||
|
|
||||||
self.logger.debug("initiating events thread")
|
self.logger.debug('initiating events thread')
|
||||||
self.stop_event = threading.Event()
|
self.stop_event = threading.Event()
|
||||||
self.stop_event.clear()
|
self.stop_event.clear()
|
||||||
queue = Queue()
|
queue = Queue()
|
||||||
@@ -76,10 +77,10 @@ class Remote(CBindings):
|
|||||||
@timeout
|
@timeout
|
||||||
def login(self) -> None:
|
def login(self) -> None:
|
||||||
"""Login to the API, initialize dirty parameters"""
|
"""Login to the API, initialize dirty parameters"""
|
||||||
self.gui.launched = self.call(self.bind_login, ok=(0, 1)) == 0
|
self.gui.launched = self._bindings.login(ok=(0, 1)) == 0
|
||||||
if not self.gui.launched:
|
if not self.gui.launched:
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"Voicemeeter engine running but GUI not launched. Launching the GUI now."
|
'Voicemeeter engine running but GUI not launched. Launching the GUI now.'
|
||||||
)
|
)
|
||||||
self.run_voicemeeter(self.kind.name)
|
self.run_voicemeeter(self.kind.name)
|
||||||
|
|
||||||
@@ -89,21 +90,21 @@ class Remote(CBindings):
|
|||||||
value = KindId[kind_id.upper()].value
|
value = KindId[kind_id.upper()].value
|
||||||
if BITS == 64 and self.bits == 64:
|
if BITS == 64 and self.bits == 64:
|
||||||
value += 3
|
value += 3
|
||||||
self.call(self.bind_run_voicemeeter, value)
|
self._bindings.run_voicemeeter(value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self) -> str:
|
def type(self) -> str:
|
||||||
"""Returns the type of Voicemeeter installation (basic, banana, potato)."""
|
"""Returns the type of Voicemeeter installation (basic, banana, potato)."""
|
||||||
type_ = ct.c_long()
|
type_ = ct.c_long()
|
||||||
self.call(self.bind_get_voicemeeter_type, ct.byref(type_))
|
self._bindings.get_voicemeeter_type(ct.byref(type_))
|
||||||
return KindId(type_.value).name.lower()
|
return KindId(type_.value).name.lower()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def version(self) -> str:
|
def version(self) -> str:
|
||||||
"""Returns Voicemeeter's version as a string"""
|
"""Returns Voicemeeter's version as a string"""
|
||||||
ver = ct.c_long()
|
ver = ct.c_long()
|
||||||
self.call(self.bind_get_voicemeeter_version, ct.byref(ver))
|
self._bindings.get_voicemeeter_version(ct.byref(ver))
|
||||||
return "{}.{}.{}.{}".format(
|
return '{}.{}.{}.{}'.format(
|
||||||
(ver.value & 0xFF000000) >> 24,
|
(ver.value & 0xFF000000) >> 24,
|
||||||
(ver.value & 0x00FF0000) >> 16,
|
(ver.value & 0x00FF0000) >> 16,
|
||||||
(ver.value & 0x0000FF00) >> 8,
|
(ver.value & 0x0000FF00) >> 8,
|
||||||
@@ -113,24 +114,24 @@ class Remote(CBindings):
|
|||||||
@property
|
@property
|
||||||
def pdirty(self) -> bool:
|
def pdirty(self) -> bool:
|
||||||
"""True iff UI parameters have been updated."""
|
"""True iff UI parameters have been updated."""
|
||||||
return self.call(self.bind_is_parameters_dirty, ok=(0, 1)) == 1
|
return self._bindings.is_parameters_dirty(ok=(0, 1)) == 1
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mdirty(self) -> bool:
|
def mdirty(self) -> bool:
|
||||||
"""True iff MB parameters have been updated."""
|
"""True iff MB parameters have been updated."""
|
||||||
try:
|
try:
|
||||||
return self.call(self.bind_macro_button_is_dirty, ok=(0, 1)) == 1
|
return self._bindings.macro_button_is_dirty(ok=(0, 1)) == 1
|
||||||
except AttributeError as e:
|
except AttributeError as e:
|
||||||
self.logger.exception(f"{type(e).__name__}: {e}")
|
self.logger.exception(f'{type(e).__name__}: {e}')
|
||||||
raise CAPIError("VBVMR_MacroButton_IsDirty", -9) from e
|
raise CAPIError('VBVMR_MacroButton_IsDirty', -9) from e
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ldirty(self) -> bool:
|
def ldirty(self) -> bool:
|
||||||
"""True iff levels have been updated."""
|
"""True iff levels have been updated."""
|
||||||
self._strip_buf, self._bus_buf = self._get_levels()
|
self._strip_buf, self._bus_buf = self._get_levels()
|
||||||
return not (
|
return not (
|
||||||
self.cache.get("strip_level") == self._strip_buf
|
self.cache.get('strip_level') == self._strip_buf
|
||||||
and self.cache.get("bus_level") == self._bus_buf
|
and self.cache.get('bus_level') == self._bus_buf
|
||||||
)
|
)
|
||||||
|
|
||||||
def clear_dirty(self) -> None:
|
def clear_dirty(self) -> None:
|
||||||
@@ -138,9 +139,9 @@ class Remote(CBindings):
|
|||||||
while self.pdirty or self.mdirty:
|
while self.pdirty or self.mdirty:
|
||||||
pass
|
pass
|
||||||
except CAPIError as e:
|
except CAPIError as e:
|
||||||
if not (e.fn_name == "VBVMR_MacroButton_IsDirty" and e.code == -9):
|
if not (e.fn_name == 'VBVMR_MacroButton_IsDirty' and e.code == -9):
|
||||||
raise
|
raise
|
||||||
self.logger.error(f"{e} clearing pdirty only.")
|
self.logger.error(f'{e} clearing pdirty only.')
|
||||||
while self.pdirty:
|
while self.pdirty:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -149,23 +150,22 @@ class Remote(CBindings):
|
|||||||
"""Gets a string or float parameter"""
|
"""Gets a string or float parameter"""
|
||||||
if is_string:
|
if is_string:
|
||||||
buf = ct.create_unicode_buffer(512)
|
buf = ct.create_unicode_buffer(512)
|
||||||
self.call(self.bind_get_parameter_string_w, param.encode(), ct.byref(buf))
|
self._bindings.get_parameter_string_w(param.encode(), ct.byref(buf))
|
||||||
else:
|
else:
|
||||||
buf = ct.c_float()
|
buf = ct.c_float()
|
||||||
self.call(self.bind_get_parameter_float, param.encode(), ct.byref(buf))
|
self._bindings.get_parameter_float(param.encode(), ct.byref(buf))
|
||||||
return buf.value
|
return buf.value
|
||||||
|
|
||||||
def set(self, param: str, val: Union[str, float]) -> None:
|
def set(self, param: str, val: Union[str, float]) -> None:
|
||||||
"""Sets a string or float parameter. Caches value"""
|
"""Sets a string or float parameter. Caches value"""
|
||||||
if isinstance(val, str):
|
if isinstance(val, str):
|
||||||
if len(val) >= 512:
|
if len(val) >= 512:
|
||||||
raise VMError("String is too long")
|
raise VMError('String is too long')
|
||||||
self.call(
|
self._bindings.set_parameter_string_w(param.encode(), ct.c_wchar_p(val))
|
||||||
self.bind_set_parameter_string_w, param.encode(), ct.c_wchar_p(val)
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
self.call(
|
self._bindings.set_parameter_float(
|
||||||
self.bind_set_parameter_float, param.encode(), ct.c_float(float(val))
|
param.encode(),
|
||||||
|
ct.c_float(float(val)),
|
||||||
)
|
)
|
||||||
self.cache[param] = val
|
self.cache[param] = val
|
||||||
|
|
||||||
@@ -174,50 +174,47 @@ class Remote(CBindings):
|
|||||||
"""Gets a macrobutton parameter"""
|
"""Gets a macrobutton parameter"""
|
||||||
c_state = ct.c_float()
|
c_state = ct.c_float()
|
||||||
try:
|
try:
|
||||||
self.call(
|
self._bindings.macro_button_get_status(
|
||||||
self.bind_macro_button_get_status,
|
|
||||||
ct.c_long(id_),
|
ct.c_long(id_),
|
||||||
ct.byref(c_state),
|
ct.byref(c_state),
|
||||||
ct.c_long(mode),
|
ct.c_long(mode),
|
||||||
)
|
)
|
||||||
except AttributeError as e:
|
except AttributeError as e:
|
||||||
self.logger.exception(f"{type(e).__name__}: {e}")
|
self.logger.exception(f'{type(e).__name__}: {e}')
|
||||||
raise CAPIError("VBVMR_MacroButton_GetStatus", -9) from e
|
raise CAPIError('VBVMR_MacroButton_GetStatus', -9) from e
|
||||||
return int(c_state.value)
|
return int(c_state.value)
|
||||||
|
|
||||||
def set_buttonstatus(self, id_: int, val: int, mode: int) -> None:
|
def set_buttonstatus(self, id_: int, val: int, mode: int) -> None:
|
||||||
"""Sets a macrobutton parameter. Caches value"""
|
"""Sets a macrobutton parameter. Caches value"""
|
||||||
c_state = ct.c_float(float(val))
|
c_state = ct.c_float(float(val))
|
||||||
try:
|
try:
|
||||||
self.call(
|
self._bindings.macro_button_set_status(
|
||||||
self.bind_macro_button_set_status,
|
|
||||||
ct.c_long(id_),
|
ct.c_long(id_),
|
||||||
c_state,
|
c_state,
|
||||||
ct.c_long(mode),
|
ct.c_long(mode),
|
||||||
)
|
)
|
||||||
except AttributeError as e:
|
except AttributeError as e:
|
||||||
self.logger.exception(f"{type(e).__name__}: {e}")
|
self.logger.exception(f'{type(e).__name__}: {e}')
|
||||||
raise CAPIError("VBVMR_MacroButton_SetStatus", -9) from e
|
raise CAPIError('VBVMR_MacroButton_SetStatus', -9) from e
|
||||||
self.cache[f"mb_{id_}_{mode}"] = int(c_state.value)
|
self.cache[f'mb_{id_}_{mode}'] = int(c_state.value)
|
||||||
|
|
||||||
def get_num_devices(self, direction: str = None) -> int:
|
def get_num_devices(self, direction: str = None) -> int:
|
||||||
"""Retrieves number of physical devices connected"""
|
"""Retrieves number of physical devices connected"""
|
||||||
if direction not in ("in", "out"):
|
if direction not in ('in', 'out'):
|
||||||
raise VMError("Expected a direction: in or out")
|
raise VMError('Expected a direction: in or out')
|
||||||
func = getattr(self, f"bind_{direction}put_get_device_number")
|
func = getattr(self._bindings, f'{direction}put_get_device_number')
|
||||||
res = self.call(func, ok_exp=lambda r: r >= 0)
|
res = func(ok_exp=lambda r: r >= 0)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def get_device_description(self, index: int, direction: str = None) -> tuple:
|
def get_device_description(self, index: int, direction: str = None) -> tuple:
|
||||||
"""Returns a tuple of device parameters"""
|
"""Returns a tuple of device parameters"""
|
||||||
if direction not in ("in", "out"):
|
if direction not in ('in', 'out'):
|
||||||
raise VMError("Expected a direction: in or out")
|
raise VMError('Expected a direction: in or out')
|
||||||
type_ = ct.c_long()
|
type_ = ct.c_long()
|
||||||
name = ct.create_unicode_buffer(256)
|
name = ct.create_unicode_buffer(256)
|
||||||
hwid = ct.create_unicode_buffer(256)
|
hwid = ct.create_unicode_buffer(256)
|
||||||
func = getattr(self, f"bind_{direction}put_get_device_desc_w")
|
func = getattr(self._bindings, f'{direction}put_get_device_desc_w')
|
||||||
self.call(
|
func(
|
||||||
func,
|
|
||||||
ct.c_long(index),
|
ct.c_long(index),
|
||||||
ct.byref(type_),
|
ct.byref(type_),
|
||||||
ct.byref(name),
|
ct.byref(name),
|
||||||
@@ -228,9 +225,7 @@ class Remote(CBindings):
|
|||||||
def get_level(self, type_: int, index: int) -> float:
|
def get_level(self, type_: int, index: int) -> float:
|
||||||
"""Retrieves a single level value"""
|
"""Retrieves a single level value"""
|
||||||
val = ct.c_float()
|
val = ct.c_float()
|
||||||
self.call(
|
self._bindings.get_level(ct.c_long(type_), ct.c_long(index), ct.byref(val))
|
||||||
self.bind_get_level, ct.c_long(type_), ct.c_long(index), ct.byref(val)
|
|
||||||
)
|
|
||||||
return val.value
|
return val.value
|
||||||
|
|
||||||
def _get_levels(self) -> Iterable:
|
def _get_levels(self) -> Iterable:
|
||||||
@@ -248,8 +243,7 @@ class Remote(CBindings):
|
|||||||
def get_midi_message(self):
|
def get_midi_message(self):
|
||||||
n = ct.c_long(1024)
|
n = ct.c_long(1024)
|
||||||
buf = ct.create_string_buffer(1024)
|
buf = ct.create_string_buffer(1024)
|
||||||
res = self.call(
|
res = self._bindings.get_midi_message(
|
||||||
self.bind_get_midi_message,
|
|
||||||
ct.byref(buf),
|
ct.byref(buf),
|
||||||
n,
|
n,
|
||||||
ok=(-5, -6), # no data received from midi device
|
ok=(-5, -6), # no data received from midi device
|
||||||
@@ -257,7 +251,7 @@ class Remote(CBindings):
|
|||||||
)
|
)
|
||||||
if res > 0:
|
if res > 0:
|
||||||
vals = tuple(
|
vals = tuple(
|
||||||
grouper(3, (int.from_bytes(buf[i], "little") for i in range(res)))
|
grouper(3, (int.from_bytes(buf[i], 'little') for i in range(res)))
|
||||||
)
|
)
|
||||||
for msg in vals:
|
for msg in vals:
|
||||||
ch, pitch, vel = msg
|
ch, pitch, vel = msg
|
||||||
@@ -271,8 +265,8 @@ class Remote(CBindings):
|
|||||||
def sendtext(self, script: str):
|
def sendtext(self, script: str):
|
||||||
"""Sets many parameters from a script"""
|
"""Sets many parameters from a script"""
|
||||||
if len(script) > 48000:
|
if len(script) > 48000:
|
||||||
raise ValueError("Script too large, max size 48kB")
|
raise ValueError('Script too large, max size 48kB')
|
||||||
self.call(self.bind_set_parameters, script.encode())
|
self._bindings.set_parameters(script.encode())
|
||||||
time.sleep(self.DELAY * 5)
|
time.sleep(self.DELAY * 5)
|
||||||
|
|
||||||
def apply(self, data: dict):
|
def apply(self, data: dict):
|
||||||
@@ -283,12 +277,15 @@ class Remote(CBindings):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def target(key):
|
def target(key):
|
||||||
match key.split("-"):
|
match key.split('-'):
|
||||||
case ["strip" | "bus" | "button" as kls, index] if index.isnumeric():
|
case ['strip' | 'bus' | 'button' as kls, index] if index.isnumeric():
|
||||||
target = getattr(self, kls)
|
target = getattr(self, kls)
|
||||||
case [
|
case [
|
||||||
"vban",
|
'vban',
|
||||||
"in" | "instream" | "out" | "outstream" as direction,
|
'in'
|
||||||
|
| 'instream'
|
||||||
|
| 'out'
|
||||||
|
| 'outstream' as direction,
|
||||||
index,
|
index,
|
||||||
] if index.isnumeric():
|
] if index.isnumeric():
|
||||||
target = getattr(
|
target = getattr(
|
||||||
@@ -306,20 +303,20 @@ class Remote(CBindings):
|
|||||||
"""applies a config from memory"""
|
"""applies a config from memory"""
|
||||||
ERR_MSG = (
|
ERR_MSG = (
|
||||||
f"No config with name '{name}' is loaded into memory",
|
f"No config with name '{name}' is loaded into memory",
|
||||||
f"Known configs: {list(self.configs.keys())}",
|
f'Known configs: {list(self.configs.keys())}',
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
config = self.configs[name]
|
config = self.configs[name]
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
self.logger.error(("\n").join(ERR_MSG))
|
self.logger.error(('\n').join(ERR_MSG))
|
||||||
raise VMError(("\n").join(ERR_MSG)) from e
|
raise VMError(('\n').join(ERR_MSG)) from e
|
||||||
|
|
||||||
if "extends" in config:
|
if 'extends' in config:
|
||||||
extended = config["extends"]
|
extended = config['extends']
|
||||||
config = {
|
config = {
|
||||||
k: v
|
k: v
|
||||||
for k, v in deep_merge(self.configs[extended], config)
|
for k, v in deep_merge(self.configs[extended], config)
|
||||||
if k not in ("extends")
|
if k not in ('extends')
|
||||||
}
|
}
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
f"profile '{name}' extends '{extended}', profiles merged.."
|
f"profile '{name}' extends '{extended}', profiles merged.."
|
||||||
@@ -329,15 +326,15 @@ class Remote(CBindings):
|
|||||||
|
|
||||||
def end_thread(self):
|
def end_thread(self):
|
||||||
if not self.stopped():
|
if not self.stopped():
|
||||||
self.logger.debug("events thread shutdown started")
|
self.logger.debug('events thread shutdown started')
|
||||||
self.stop_event.set()
|
self.stop_event.set()
|
||||||
self.producer.join() # wait for producer thread to complete cycle
|
self.producer.join() # wait for producer thread to complete cycle
|
||||||
|
|
||||||
def logout(self) -> None:
|
def logout(self) -> None:
|
||||||
"""Logout of the API"""
|
"""Logout of the API"""
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
self.call(self.bind_logout)
|
self._bindings.logout()
|
||||||
self.logger.info(f"{type(self).__name__}: Successfully logged out of {self}")
|
self.logger.info(f'{type(self).__name__}: Successfully logged out of {self}')
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, exc_traceback) -> None:
|
def __exit__(self, exc_type, exc_value, exc_traceback) -> None:
|
||||||
"""teardown procedures"""
|
"""teardown procedures"""
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
import abc
|
||||||
import time
|
import time
|
||||||
from abc import abstractmethod
|
|
||||||
from math import log
|
from math import log
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
from . import kinds
|
||||||
from .iremote import IRemote
|
from .iremote import IRemote
|
||||||
from .kinds import kinds_all
|
|
||||||
from .meta import bool_prop, device_prop, float_prop
|
from .meta import bool_prop, device_prop, float_prop
|
||||||
|
|
||||||
|
|
||||||
@@ -15,68 +15,68 @@ class Strip(IRemote):
|
|||||||
Defines concrete implementation for strip
|
Defines concrete implementation for strip
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@abstractmethod
|
@abc.abstractmethod
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"strip[{self.index}]"
|
return f'strip[{self.index}]'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mono(self) -> bool:
|
def mono(self) -> bool:
|
||||||
return self.getter("mono") == 1
|
return self.getter('mono') == 1
|
||||||
|
|
||||||
@mono.setter
|
@mono.setter
|
||||||
def mono(self, val: bool):
|
def mono(self, val: bool):
|
||||||
self.setter("mono", 1 if val else 0)
|
self.setter('mono', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def solo(self) -> bool:
|
def solo(self) -> bool:
|
||||||
return self.getter("solo") == 1
|
return self.getter('solo') == 1
|
||||||
|
|
||||||
@solo.setter
|
@solo.setter
|
||||||
def solo(self, val: bool):
|
def solo(self, val: bool):
|
||||||
self.setter("solo", 1 if val else 0)
|
self.setter('solo', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mute(self) -> bool:
|
def mute(self) -> bool:
|
||||||
return self.getter("mute") == 1
|
return self.getter('mute') == 1
|
||||||
|
|
||||||
@mute.setter
|
@mute.setter
|
||||||
def mute(self, val: bool):
|
def mute(self, val: bool):
|
||||||
self.setter("mute", 1 if val else 0)
|
self.setter('mute', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def limit(self) -> int:
|
def limit(self) -> int:
|
||||||
return int(self.getter("limit"))
|
return int(self.getter('limit'))
|
||||||
|
|
||||||
@limit.setter
|
@limit.setter
|
||||||
def limit(self, val: int):
|
def limit(self, val: int):
|
||||||
self.setter("limit", val)
|
self.setter('limit', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def label(self) -> str:
|
def label(self) -> str:
|
||||||
return self.getter("Label", is_string=True)
|
return self.getter('Label', is_string=True)
|
||||||
|
|
||||||
@label.setter
|
@label.setter
|
||||||
def label(self, val: str):
|
def label(self, val: str):
|
||||||
self.setter("Label", str(val))
|
self.setter('Label', str(val))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gain(self) -> float:
|
def gain(self) -> float:
|
||||||
return round(self.getter("gain"), 1)
|
return round(self.getter('gain'), 1)
|
||||||
|
|
||||||
@gain.setter
|
@gain.setter
|
||||||
def gain(self, val: float):
|
def gain(self, val: float):
|
||||||
self.setter("gain", val)
|
self.setter('gain', val)
|
||||||
|
|
||||||
def fadeto(self, target: float, time_: int):
|
def fadeto(self, target: float, time_: int):
|
||||||
self.setter("FadeTo", f"({target}, {time_})")
|
self.setter('FadeTo', f'({target}, {time_})')
|
||||||
time.sleep(self._remote.DELAY)
|
time.sleep(self._remote.DELAY)
|
||||||
|
|
||||||
def fadeby(self, change: float, time_: int):
|
def fadeby(self, change: float, time_: int):
|
||||||
self.setter("FadeBy", f"({change}, {time_})")
|
self.setter('FadeBy', f'({change}, {time_})')
|
||||||
time.sleep(self._remote.DELAY)
|
time.sleep(self._remote.DELAY)
|
||||||
|
|
||||||
|
|
||||||
@@ -90,203 +90,301 @@ class PhysicalStrip(Strip):
|
|||||||
"""
|
"""
|
||||||
EFFECTS_cls = _make_effects_mixins(is_phys)[remote.kind.name]
|
EFFECTS_cls = _make_effects_mixins(is_phys)[remote.kind.name]
|
||||||
return type(
|
return type(
|
||||||
"PhysicalStrip",
|
'PhysicalStrip',
|
||||||
(cls, EFFECTS_cls),
|
(cls, EFFECTS_cls),
|
||||||
{
|
{
|
||||||
"comp": StripComp(remote, i),
|
'comp': StripComp(remote, i),
|
||||||
"gate": StripGate(remote, i),
|
'gate': StripGate(remote, i),
|
||||||
"denoiser": StripDenoiser(remote, i),
|
'denoiser': StripDenoiser(remote, i),
|
||||||
"eq": StripEQ(remote, i),
|
'eq': StripEQ.make(remote, i),
|
||||||
"device": StripDevice.make(remote, i),
|
'device': StripDevice.make(remote, i),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}{self.index}"
|
return f'{type(self).__name__}{self.index}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def audibility(self) -> float:
|
def audibility(self) -> float:
|
||||||
return round(self.getter("audibility"), 1)
|
return round(self.getter('audibility'), 1)
|
||||||
|
|
||||||
@audibility.setter
|
@audibility.setter
|
||||||
def audibility(self, val: float):
|
def audibility(self, val: float):
|
||||||
self.setter("audibility", val)
|
self.setter('audibility', val)
|
||||||
|
|
||||||
|
|
||||||
class StripComp(IRemote):
|
class StripComp(IRemote):
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"Strip[{self.index}].comp"
|
return f'Strip[{self.index}].comp'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def knob(self) -> float:
|
def knob(self) -> float:
|
||||||
return round(self.getter(""), 1)
|
return round(self.getter(''), 1)
|
||||||
|
|
||||||
@knob.setter
|
@knob.setter
|
||||||
def knob(self, val: float):
|
def knob(self, val: float):
|
||||||
self.setter("", val)
|
self.setter('', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gainin(self) -> float:
|
def gainin(self) -> float:
|
||||||
return round(self.getter("GainIn"), 1)
|
return round(self.getter('GainIn'), 1)
|
||||||
|
|
||||||
@gainin.setter
|
@gainin.setter
|
||||||
def gainin(self, val: float):
|
def gainin(self, val: float):
|
||||||
self.setter("GainIn", val)
|
self.setter('GainIn', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ratio(self) -> float:
|
def ratio(self) -> float:
|
||||||
return round(self.getter("Ratio"), 1)
|
return round(self.getter('Ratio'), 1)
|
||||||
|
|
||||||
@ratio.setter
|
@ratio.setter
|
||||||
def ratio(self, val: float):
|
def ratio(self, val: float):
|
||||||
self.setter("Ratio", val)
|
self.setter('Ratio', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def threshold(self) -> float:
|
def threshold(self) -> float:
|
||||||
return round(self.getter("Threshold"), 1)
|
return round(self.getter('Threshold'), 1)
|
||||||
|
|
||||||
@threshold.setter
|
@threshold.setter
|
||||||
def threshold(self, val: float):
|
def threshold(self, val: float):
|
||||||
self.setter("Threshold", val)
|
self.setter('Threshold', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def attack(self) -> float:
|
def attack(self) -> float:
|
||||||
return round(self.getter("Attack"), 1)
|
return round(self.getter('Attack'), 1)
|
||||||
|
|
||||||
@attack.setter
|
@attack.setter
|
||||||
def attack(self, val: float):
|
def attack(self, val: float):
|
||||||
self.setter("Attack", val)
|
self.setter('Attack', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def release(self) -> float:
|
def release(self) -> float:
|
||||||
return round(self.getter("Release"), 1)
|
return round(self.getter('Release'), 1)
|
||||||
|
|
||||||
@release.setter
|
@release.setter
|
||||||
def release(self, val: float):
|
def release(self, val: float):
|
||||||
self.setter("Release", val)
|
self.setter('Release', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def knee(self) -> float:
|
def knee(self) -> float:
|
||||||
return round(self.getter("Knee"), 2)
|
return round(self.getter('Knee'), 2)
|
||||||
|
|
||||||
@knee.setter
|
@knee.setter
|
||||||
def knee(self, val: float):
|
def knee(self, val: float):
|
||||||
self.setter("Knee", val)
|
self.setter('Knee', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gainout(self) -> float:
|
def gainout(self) -> float:
|
||||||
return round(self.getter("GainOut"), 1)
|
return round(self.getter('GainOut'), 1)
|
||||||
|
|
||||||
@gainout.setter
|
@gainout.setter
|
||||||
def gainout(self, val: float):
|
def gainout(self, val: float):
|
||||||
self.setter("GainOut", val)
|
self.setter('GainOut', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def makeup(self) -> bool:
|
def makeup(self) -> bool:
|
||||||
return self.getter("makeup") == 1
|
return self.getter('makeup') == 1
|
||||||
|
|
||||||
@makeup.setter
|
@makeup.setter
|
||||||
def makeup(self, val: bool):
|
def makeup(self, val: bool):
|
||||||
self.setter("makeup", 1 if val else 0)
|
self.setter('makeup', 1 if val else 0)
|
||||||
|
|
||||||
|
|
||||||
class StripGate(IRemote):
|
class StripGate(IRemote):
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"Strip[{self.index}].gate"
|
return f'Strip[{self.index}].gate'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def knob(self) -> float:
|
def knob(self) -> float:
|
||||||
return round(self.getter(""), 1)
|
return round(self.getter(''), 1)
|
||||||
|
|
||||||
@knob.setter
|
@knob.setter
|
||||||
def knob(self, val: float):
|
def knob(self, val: float):
|
||||||
self.setter("", val)
|
self.setter('', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def threshold(self) -> float:
|
def threshold(self) -> float:
|
||||||
return round(self.getter("Threshold"), 1)
|
return round(self.getter('Threshold'), 1)
|
||||||
|
|
||||||
@threshold.setter
|
@threshold.setter
|
||||||
def threshold(self, val: float):
|
def threshold(self, val: float):
|
||||||
self.setter("Threshold", val)
|
self.setter('Threshold', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def damping(self) -> float:
|
def damping(self) -> float:
|
||||||
return round(self.getter("Damping"), 1)
|
return round(self.getter('Damping'), 1)
|
||||||
|
|
||||||
@damping.setter
|
@damping.setter
|
||||||
def damping(self, val: float):
|
def damping(self, val: float):
|
||||||
self.setter("Damping", val)
|
self.setter('Damping', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bpsidechain(self) -> int:
|
def bpsidechain(self) -> int:
|
||||||
return int(self.getter("BPSidechain"))
|
return int(self.getter('BPSidechain'))
|
||||||
|
|
||||||
@bpsidechain.setter
|
@bpsidechain.setter
|
||||||
def bpsidechain(self, val: int):
|
def bpsidechain(self, val: int):
|
||||||
self.setter("BPSidechain", val)
|
self.setter('BPSidechain', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def attack(self) -> float:
|
def attack(self) -> float:
|
||||||
return round(self.getter("Attack"), 1)
|
return round(self.getter('Attack'), 1)
|
||||||
|
|
||||||
@attack.setter
|
@attack.setter
|
||||||
def attack(self, val: float):
|
def attack(self, val: float):
|
||||||
self.setter("Attack", val)
|
self.setter('Attack', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hold(self) -> float:
|
def hold(self) -> float:
|
||||||
return round(self.getter("Hold"), 1)
|
return round(self.getter('Hold'), 1)
|
||||||
|
|
||||||
@hold.setter
|
@hold.setter
|
||||||
def hold(self, val: float):
|
def hold(self, val: float):
|
||||||
self.setter("Hold", val)
|
self.setter('Hold', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def release(self) -> float:
|
def release(self) -> float:
|
||||||
return round(self.getter("Release"), 1)
|
return round(self.getter('Release'), 1)
|
||||||
|
|
||||||
@release.setter
|
@release.setter
|
||||||
def release(self, val: float):
|
def release(self, val: float):
|
||||||
self.setter("Release", val)
|
self.setter('Release', val)
|
||||||
|
|
||||||
|
|
||||||
class StripDenoiser(IRemote):
|
class StripDenoiser(IRemote):
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"Strip[{self.index}].denoiser"
|
return f'Strip[{self.index}].denoiser'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def knob(self) -> float:
|
def knob(self) -> float:
|
||||||
return round(self.getter(""), 1)
|
return round(self.getter(''), 1)
|
||||||
|
|
||||||
@knob.setter
|
@knob.setter
|
||||||
def knob(self, val: float):
|
def knob(self, val: float):
|
||||||
self.setter("", val)
|
self.setter('', val)
|
||||||
|
|
||||||
|
|
||||||
class StripEQ(IRemote):
|
class StripEQ(IRemote):
|
||||||
|
@classmethod
|
||||||
|
def make(cls, remote, i):
|
||||||
|
"""
|
||||||
|
Factory method for Strip EQ.
|
||||||
|
|
||||||
|
Returns a StripEQ class.
|
||||||
|
"""
|
||||||
|
STRIPEQ_cls = type(
|
||||||
|
'StripEQ',
|
||||||
|
(cls,),
|
||||||
|
{
|
||||||
|
'channel': tuple(
|
||||||
|
StripEQCh.make(remote, i, j)
|
||||||
|
for j in range(remote.kind.strip_channels)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return STRIPEQ_cls(remote, i)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"Strip[{self.index}].eq"
|
return f'Strip[{self.index}].eq'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def on(self) -> bool:
|
def on(self) -> bool:
|
||||||
return self.getter("on") == 1
|
return self.getter('on') == 1
|
||||||
|
|
||||||
@on.setter
|
@on.setter
|
||||||
def on(self, val: bool):
|
def on(self, val: bool):
|
||||||
self.setter("on", 1 if val else 0)
|
self.setter('on', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ab(self) -> bool:
|
def ab(self) -> bool:
|
||||||
return self.getter("ab") == 1
|
return self.getter('ab') == 1
|
||||||
|
|
||||||
@ab.setter
|
@ab.setter
|
||||||
def ab(self, val: bool):
|
def ab(self, val: bool):
|
||||||
self.setter("ab", 1 if val else 0)
|
self.setter('ab', 1 if val else 0)
|
||||||
|
|
||||||
|
|
||||||
|
class StripEQCh(IRemote):
|
||||||
|
@classmethod
|
||||||
|
def make(cls, remote, i, j):
|
||||||
|
"""
|
||||||
|
Factory method for Strip EQ channel.
|
||||||
|
|
||||||
|
Returns a StripEQCh class.
|
||||||
|
"""
|
||||||
|
StripEQCh_cls = type(
|
||||||
|
'StripEQCh',
|
||||||
|
(cls,),
|
||||||
|
{
|
||||||
|
'cell': tuple(
|
||||||
|
StripEQChCell(remote, i, j, k) for k in range(remote.kind.cells)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return StripEQCh_cls(remote, i, j)
|
||||||
|
|
||||||
|
def __init__(self, remote, i, j):
|
||||||
|
super().__init__(remote, i)
|
||||||
|
self.channel_index = j
|
||||||
|
|
||||||
|
@property
|
||||||
|
def identifier(self) -> str:
|
||||||
|
return f'Strip[{self.index}].eq.channel[{self.channel_index}]'
|
||||||
|
|
||||||
|
|
||||||
|
class StripEQChCell(IRemote):
|
||||||
|
def __init__(self, remote, i, j, k):
|
||||||
|
super().__init__(remote, i)
|
||||||
|
self.channel_index = j
|
||||||
|
self.cell_index = k
|
||||||
|
|
||||||
|
@property
|
||||||
|
def identifier(self) -> str:
|
||||||
|
return f'Strip[{self.index}].eq.channel[{self.channel_index}].cell[{self.cell_index}]'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def on(self) -> bool:
|
||||||
|
return self.getter('on') == 1
|
||||||
|
|
||||||
|
@on.setter
|
||||||
|
def on(self, val: bool):
|
||||||
|
self.setter('on', 1 if val else 0)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def type(self) -> int:
|
||||||
|
return int(self.getter('type'))
|
||||||
|
|
||||||
|
@type.setter
|
||||||
|
def type(self, val: int):
|
||||||
|
self.setter('type', val)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def f(self) -> float:
|
||||||
|
return round(self.getter('f'), 1)
|
||||||
|
|
||||||
|
@f.setter
|
||||||
|
def f(self, val: float):
|
||||||
|
self.setter('f', val)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def gain(self) -> float:
|
||||||
|
return round(self.getter('gain'), 1)
|
||||||
|
|
||||||
|
@gain.setter
|
||||||
|
def gain(self, val: float):
|
||||||
|
self.setter('gain', val)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def q(self) -> float:
|
||||||
|
return round(self.getter('q'), 1)
|
||||||
|
|
||||||
|
@q.setter
|
||||||
|
def q(self, val: float):
|
||||||
|
self.setter('q', val)
|
||||||
|
|
||||||
|
|
||||||
class StripDevice(IRemote):
|
class StripDevice(IRemote):
|
||||||
@@ -298,16 +396,16 @@ class StripDevice(IRemote):
|
|||||||
Returns a StripDevice class of a kind.
|
Returns a StripDevice class of a kind.
|
||||||
"""
|
"""
|
||||||
DEVICE_cls = type(
|
DEVICE_cls = type(
|
||||||
f"StripDevice{remote.kind}",
|
f'StripDevice{remote.kind}',
|
||||||
(cls,),
|
(cls,),
|
||||||
{
|
{
|
||||||
**{
|
**{
|
||||||
param: device_prop(param)
|
param: device_prop(param)
|
||||||
for param in [
|
for param in [
|
||||||
"wdm",
|
'wdm',
|
||||||
"ks",
|
'ks',
|
||||||
"mme",
|
'mme',
|
||||||
"asio",
|
'asio',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -316,15 +414,15 @@ class StripDevice(IRemote):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"Strip[{self.index}].device"
|
return f'Strip[{self.index}].device'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
return self.getter("name", is_string=True)
|
return self.getter('name', is_string=True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sr(self) -> int:
|
def sr(self) -> int:
|
||||||
return int(self.getter("sr"))
|
return int(self.getter('sr'))
|
||||||
|
|
||||||
|
|
||||||
class VirtualStrip(Strip):
|
class VirtualStrip(Strip):
|
||||||
@@ -337,65 +435,65 @@ class VirtualStrip(Strip):
|
|||||||
"""
|
"""
|
||||||
EFFECTS_cls = _make_effects_mixins(is_phys)[remote.kind.name]
|
EFFECTS_cls = _make_effects_mixins(is_phys)[remote.kind.name]
|
||||||
return type(
|
return type(
|
||||||
"VirtualStrip",
|
'VirtualStrip',
|
||||||
(cls, EFFECTS_cls),
|
(cls, EFFECTS_cls),
|
||||||
{},
|
{},
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}{self.index}"
|
return f'{type(self).__name__}{self.index}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mc(self) -> bool:
|
def mc(self) -> bool:
|
||||||
return self.getter("mc") == 1
|
return self.getter('mc') == 1
|
||||||
|
|
||||||
@mc.setter
|
@mc.setter
|
||||||
def mc(self, val: bool):
|
def mc(self, val: bool):
|
||||||
self.setter("mc", 1 if val else 0)
|
self.setter('mc', 1 if val else 0)
|
||||||
|
|
||||||
mono = mc
|
mono = mc
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def k(self) -> int:
|
def k(self) -> int:
|
||||||
return int(self.getter("karaoke"))
|
return int(self.getter('karaoke'))
|
||||||
|
|
||||||
@k.setter
|
@k.setter
|
||||||
def k(self, val: int):
|
def k(self, val: int):
|
||||||
self.setter("karaoke", val)
|
self.setter('karaoke', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bass(self) -> float:
|
def bass(self) -> float:
|
||||||
return round(self.getter("EQGain1"), 1)
|
return round(self.getter('EQGain1'), 1)
|
||||||
|
|
||||||
@bass.setter
|
@bass.setter
|
||||||
def bass(self, val: float):
|
def bass(self, val: float):
|
||||||
self.setter("EQGain1", val)
|
self.setter('EQGain1', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mid(self) -> float:
|
def mid(self) -> float:
|
||||||
return round(self.getter("EQGain2"), 1)
|
return round(self.getter('EQGain2'), 1)
|
||||||
|
|
||||||
@mid.setter
|
@mid.setter
|
||||||
def mid(self, val: float):
|
def mid(self, val: float):
|
||||||
self.setter("EQGain2", val)
|
self.setter('EQGain2', val)
|
||||||
|
|
||||||
med = mid
|
med = mid
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def treble(self) -> float:
|
def treble(self) -> float:
|
||||||
return round(self.getter("EQGain3"), 1)
|
return round(self.getter('EQGain3'), 1)
|
||||||
|
|
||||||
high = treble
|
high = treble
|
||||||
|
|
||||||
@treble.setter
|
@treble.setter
|
||||||
def treble(self, val: float):
|
def treble(self, val: float):
|
||||||
self.setter("EQGain3", val)
|
self.setter('EQGain3', val)
|
||||||
|
|
||||||
def appgain(self, name: str, gain: float):
|
def appgain(self, name: str, gain: float):
|
||||||
self.setter("AppGain", f'("{name}", {gain})')
|
self.setter('AppGain', f'("{name}", {gain})')
|
||||||
|
|
||||||
def appmute(self, name: str, mute: bool = None):
|
def appmute(self, name: str, mute: bool = None):
|
||||||
self.setter("AppMute", f'("{name}", {1 if mute else 0})')
|
self.setter('AppMute', f'("{name}", {1 if mute else 0})')
|
||||||
|
|
||||||
|
|
||||||
class StripLevel(IRemote):
|
class StripLevel(IRemote):
|
||||||
@@ -416,7 +514,7 @@ class StripLevel(IRemote):
|
|||||||
return round(20 * log(x, 10), 1) if x > 0 else -200.0
|
return round(20 * log(x, 10), 1) if x > 0 else -200.0
|
||||||
|
|
||||||
if not self._remote.stopped() and self._remote.event.ldirty:
|
if not self._remote.stopped() and self._remote.event.ldirty:
|
||||||
vals = self._remote.cache["strip_level"][self.range[0] : self.range[-1]]
|
vals = self._remote.cache['strip_level'][self.range[0] : self.range[-1]]
|
||||||
else:
|
else:
|
||||||
vals = [self._remote.get_level(mode, i) for i in range(*self.range)]
|
vals = [self._remote.get_level(mode, i) for i in range(*self.range)]
|
||||||
|
|
||||||
@@ -424,7 +522,7 @@ class StripLevel(IRemote):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"Strip[{self.index}]"
|
return f'Strip[{self.index}]'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def prefader(self) -> tuple:
|
def prefader(self) -> tuple:
|
||||||
@@ -467,7 +565,7 @@ def make_strip_level_map(kind):
|
|||||||
return phys_map + virt_map
|
return phys_map + virt_map
|
||||||
|
|
||||||
|
|
||||||
_make_strip_level_maps = {kind.name: make_strip_level_map(kind) for kind in kinds_all}
|
_make_strip_level_maps = {kind.name: make_strip_level_map(kind) for kind in kinds.all}
|
||||||
|
|
||||||
|
|
||||||
class GainLayer(IRemote):
|
class GainLayer(IRemote):
|
||||||
@@ -477,24 +575,24 @@ class GainLayer(IRemote):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"Strip[{self.index}]"
|
return f'Strip[{self.index}]'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gain(self):
|
def gain(self):
|
||||||
return self.getter(f"GainLayer[{self._i}]")
|
return self.getter(f'GainLayer[{self._i}]')
|
||||||
|
|
||||||
@gain.setter
|
@gain.setter
|
||||||
def gain(self, val):
|
def gain(self, val):
|
||||||
self.setter(f"GainLayer[{self._i}]", val)
|
self.setter(f'GainLayer[{self._i}]', val)
|
||||||
|
|
||||||
|
|
||||||
def _make_gainlayer_mixin(remote, index):
|
def _make_gainlayer_mixin(remote, index):
|
||||||
"""Creates a GainLayer mixin"""
|
"""Creates a GainLayer mixin"""
|
||||||
return type(
|
return type(
|
||||||
"GainlayerMixin",
|
'GainlayerMixin',
|
||||||
(),
|
(),
|
||||||
{
|
{
|
||||||
"gainlayer": tuple(
|
'gainlayer': tuple(
|
||||||
GainLayer(remote, index, i) for i in range(remote.kind.num_bus)
|
GainLayer(remote, index, i) for i in range(remote.kind.num_bus)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -504,17 +602,17 @@ def _make_gainlayer_mixin(remote, index):
|
|||||||
def _make_channelout_mixin(kind):
|
def _make_channelout_mixin(kind):
|
||||||
"""Creates a channel out property mixin"""
|
"""Creates a channel out property mixin"""
|
||||||
return type(
|
return type(
|
||||||
f"ChannelOutMixin{kind}",
|
f'ChannelOutMixin{kind}',
|
||||||
(),
|
(),
|
||||||
{
|
{
|
||||||
**{f"A{i}": bool_prop(f"A{i}") for i in range(1, kind.phys_out + 1)},
|
**{f'A{i}': bool_prop(f'A{i}') for i in range(1, kind.phys_out + 1)},
|
||||||
**{f"B{i}": bool_prop(f"B{i}") for i in range(1, kind.virt_out + 1)},
|
**{f'B{i}': bool_prop(f'B{i}') for i in range(1, kind.virt_out + 1)},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
_make_channelout_mixins = {
|
_make_channelout_mixins = {
|
||||||
kind.name: _make_channelout_mixin(kind) for kind in kinds_all
|
kind.name: _make_channelout_mixin(kind) for kind in kinds.all
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -522,12 +620,12 @@ def _make_effects_mixin(kind, is_phys):
|
|||||||
"""creates an effects mixin for a kind"""
|
"""creates an effects mixin for a kind"""
|
||||||
|
|
||||||
def _make_xy_cls():
|
def _make_xy_cls():
|
||||||
pan = {param: float_prop(param) for param in ["pan_x", "pan_y"]}
|
pan = {param: float_prop(param) for param in ['pan_x', 'pan_y']}
|
||||||
color = {param: float_prop(param) for param in ["color_x", "color_y"]}
|
color = {param: float_prop(param) for param in ['color_x', 'color_y']}
|
||||||
fx = {param: float_prop(param) for param in ["fx_x", "fx_y"]}
|
fx = {param: float_prop(param) for param in ['fx_x', 'fx_y']}
|
||||||
if is_phys:
|
if is_phys:
|
||||||
return type(
|
return type(
|
||||||
"XYPhys",
|
'XYPhys',
|
||||||
(),
|
(),
|
||||||
{
|
{
|
||||||
**pan,
|
**pan,
|
||||||
@@ -536,7 +634,7 @@ def _make_effects_mixin(kind, is_phys):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
return type(
|
return type(
|
||||||
"XYVirt",
|
'XYVirt',
|
||||||
(),
|
(),
|
||||||
{**pan},
|
{**pan},
|
||||||
)
|
)
|
||||||
@@ -544,32 +642,32 @@ def _make_effects_mixin(kind, is_phys):
|
|||||||
def _make_fx_cls():
|
def _make_fx_cls():
|
||||||
if is_phys:
|
if is_phys:
|
||||||
return type(
|
return type(
|
||||||
"FX",
|
'FX',
|
||||||
(),
|
(),
|
||||||
{
|
{
|
||||||
**{
|
**{
|
||||||
param: float_prop(param)
|
param: float_prop(param)
|
||||||
for param in ["reverb", "delay", "fx1", "fx2"]
|
for param in ['reverb', 'delay', 'fx1', 'fx2']
|
||||||
},
|
},
|
||||||
**{
|
**{
|
||||||
f"post{param}": bool_prop(f"post{param}")
|
f'post{param}': bool_prop(f'post{param}')
|
||||||
for param in ["reverb", "delay", "fx1", "fx2"]
|
for param in ['reverb', 'delay', 'fx1', 'fx2']
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return type("FX", (), {})
|
return type('FX', (), {})
|
||||||
|
|
||||||
if kind.name == "basic":
|
if kind.name == 'basic':
|
||||||
steps = (_make_xy_cls,)
|
steps = (_make_xy_cls,)
|
||||||
elif kind.name == "banana":
|
elif kind.name == 'banana':
|
||||||
steps = (_make_xy_cls,)
|
steps = (_make_xy_cls,)
|
||||||
elif kind.name == "potato":
|
elif kind.name == 'potato':
|
||||||
steps = (_make_xy_cls, _make_fx_cls)
|
steps = (_make_xy_cls, _make_fx_cls)
|
||||||
return type(f"Effects{kind}", tuple(step() for step in steps), {})
|
return type(f'Effects{kind}', tuple(step() for step in steps), {})
|
||||||
|
|
||||||
|
|
||||||
def _make_effects_mixins(is_phys):
|
def _make_effects_mixins(is_phys):
|
||||||
return {kind.name: _make_effects_mixin(kind, is_phys) for kind in kinds_all}
|
return {kind.name: _make_effects_mixin(kind, is_phys) for kind in kinds.all}
|
||||||
|
|
||||||
|
|
||||||
def strip_factory(is_phys_strip, remote, i) -> Union[PhysicalStrip, VirtualStrip]:
|
def strip_factory(is_phys_strip, remote, i) -> Union[PhysicalStrip, VirtualStrip]:
|
||||||
@@ -588,14 +686,14 @@ def strip_factory(is_phys_strip, remote, i) -> Union[PhysicalStrip, VirtualStrip
|
|||||||
CHANNELOUTMIXIN_cls = _make_channelout_mixins[remote.kind.name]
|
CHANNELOUTMIXIN_cls = _make_channelout_mixins[remote.kind.name]
|
||||||
|
|
||||||
_kls = (STRIP_cls, CHANNELOUTMIXIN_cls)
|
_kls = (STRIP_cls, CHANNELOUTMIXIN_cls)
|
||||||
if remote.kind.name == "potato":
|
if remote.kind.name == 'potato':
|
||||||
GAINLAYERMIXIN_cls = _make_gainlayer_mixin(remote, i)
|
GAINLAYERMIXIN_cls = _make_gainlayer_mixin(remote, i)
|
||||||
_kls += (GAINLAYERMIXIN_cls,)
|
_kls += (GAINLAYERMIXIN_cls,)
|
||||||
return type(
|
return type(
|
||||||
f"{STRIP_cls.__name__}{remote.kind}",
|
f'{STRIP_cls.__name__}{remote.kind}',
|
||||||
_kls,
|
_kls,
|
||||||
{
|
{
|
||||||
"levels": StripLevel(remote, i),
|
'levels': StripLevel(remote, i),
|
||||||
},
|
},
|
||||||
)(remote, i)
|
)(remote, i)
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ class Subject:
|
|||||||
"""run callbacks on update"""
|
"""run callbacks on update"""
|
||||||
|
|
||||||
for o in self._observers:
|
for o in self._observers:
|
||||||
if hasattr(o, "on_update"):
|
if hasattr(o, 'on_update'):
|
||||||
o.on_update(event)
|
o.on_update(event)
|
||||||
else:
|
else:
|
||||||
if o.__name__ == f"on_{event}":
|
if o.__name__ == f'on_{event}':
|
||||||
o()
|
o()
|
||||||
|
|
||||||
def add(self, observer):
|
def add(self, observer):
|
||||||
@@ -34,15 +34,15 @@ class Subject:
|
|||||||
for o in iterator:
|
for o in iterator:
|
||||||
if o not in self._observers:
|
if o not in self._observers:
|
||||||
self._observers.append(o)
|
self._observers.append(o)
|
||||||
self.logger.info(f"{o} added to event observers")
|
self.logger.info(f'{o} added to event observers')
|
||||||
else:
|
else:
|
||||||
self.logger.error(f"Failed to add {o} to event observers")
|
self.logger.error(f'Failed to add {o} to event observers')
|
||||||
except TypeError:
|
except TypeError:
|
||||||
if observer not in self._observers:
|
if observer not in self._observers:
|
||||||
self._observers.append(observer)
|
self._observers.append(observer)
|
||||||
self.logger.info(f"{observer} added to event observers")
|
self.logger.info(f'{observer} added to event observers')
|
||||||
else:
|
else:
|
||||||
self.logger.error(f"Failed to add {observer} to event observers")
|
self.logger.error(f'Failed to add {observer} to event observers')
|
||||||
|
|
||||||
register = add
|
register = add
|
||||||
|
|
||||||
@@ -54,15 +54,15 @@ class Subject:
|
|||||||
for o in iterator:
|
for o in iterator:
|
||||||
try:
|
try:
|
||||||
self._observers.remove(o)
|
self._observers.remove(o)
|
||||||
self.logger.info(f"{o} removed from event observers")
|
self.logger.info(f'{o} removed from event observers')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.logger.error(f"Failed to remove {o} from event observers")
|
self.logger.error(f'Failed to remove {o} from event observers')
|
||||||
except TypeError:
|
except TypeError:
|
||||||
try:
|
try:
|
||||||
self._observers.remove(observer)
|
self._observers.remove(observer)
|
||||||
self.logger.info(f"{observer} removed from event observers")
|
self.logger.info(f'{observer} removed from event observers')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.logger.error(f"Failed to remove {observer} from event observers")
|
self.logger.error(f'Failed to remove {observer} from event observers')
|
||||||
|
|
||||||
deregister = remove
|
deregister = remove
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Producer(threading.Thread):
|
|||||||
"""Continously send job queue to the Updater thread at a rate of self._remote.ratelimit."""
|
"""Continously send job queue to the Updater thread at a rate of self._remote.ratelimit."""
|
||||||
|
|
||||||
def __init__(self, remote, queue, stop_event):
|
def __init__(self, remote, queue, stop_event):
|
||||||
super().__init__(name="producer", daemon=False)
|
super().__init__(name='producer', daemon=False)
|
||||||
self._remote = remote
|
self._remote = remote
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.stop_event = stop_event
|
self.stop_event = stop_event
|
||||||
@@ -23,35 +23,35 @@ class Producer(threading.Thread):
|
|||||||
def run(self):
|
def run(self):
|
||||||
while not self.stopped():
|
while not self.stopped():
|
||||||
if self._remote.event.pdirty:
|
if self._remote.event.pdirty:
|
||||||
self.queue.put("pdirty")
|
self.queue.put('pdirty')
|
||||||
if self._remote.event.mdirty:
|
if self._remote.event.mdirty:
|
||||||
self.queue.put("mdirty")
|
self.queue.put('mdirty')
|
||||||
if self._remote.event.midi:
|
if self._remote.event.midi:
|
||||||
self.queue.put("midi")
|
self.queue.put('midi')
|
||||||
if self._remote.event.ldirty:
|
if self._remote.event.ldirty:
|
||||||
self.queue.put("ldirty")
|
self.queue.put('ldirty')
|
||||||
time.sleep(self._remote.ratelimit)
|
time.sleep(self._remote.ratelimit)
|
||||||
self.logger.debug(f"terminating {self.name} thread")
|
self.logger.debug(f'terminating {self.name} thread')
|
||||||
self.queue.put(None)
|
self.queue.put(None)
|
||||||
|
|
||||||
|
|
||||||
class Updater(threading.Thread):
|
class Updater(threading.Thread):
|
||||||
def __init__(self, remote, queue):
|
def __init__(self, remote, queue):
|
||||||
super().__init__(name="updater", daemon=True)
|
super().__init__(name='updater', daemon=True)
|
||||||
self._remote = remote
|
self._remote = remote
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self._remote._strip_comp = [False] * (self._remote.kind.num_strip_levels)
|
self._remote._strip_comp = [False] * (self._remote.kind.num_strip_levels)
|
||||||
self._remote._bus_comp = [False] * (self._remote.kind.num_bus_levels)
|
self._remote._bus_comp = [False] * (self._remote.kind.num_bus_levels)
|
||||||
(
|
(
|
||||||
self._remote.cache["strip_level"],
|
self._remote.cache['strip_level'],
|
||||||
self._remote.cache["bus_level"],
|
self._remote.cache['bus_level'],
|
||||||
) = self._remote._get_levels()
|
) = self._remote._get_levels()
|
||||||
self.logger = logger.getChild(self.__class__.__name__)
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
|
|
||||||
def _update_comps(self, strip_level, bus_level):
|
def _update_comps(self, strip_level, bus_level):
|
||||||
self._remote._strip_comp, self._remote._bus_comp = (
|
self._remote._strip_comp, self._remote._bus_comp = (
|
||||||
tuple(not x for x in comp(self._remote.cache["strip_level"], strip_level)),
|
tuple(not x for x in comp(self._remote.cache['strip_level'], strip_level)),
|
||||||
tuple(not x for x in comp(self._remote.cache["bus_level"], bus_level)),
|
tuple(not x for x in comp(self._remote.cache['bus_level'], bus_level)),
|
||||||
)
|
)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@@ -61,15 +61,15 @@ class Updater(threading.Thread):
|
|||||||
Generate _strip_comp, _bus_comp and update level cache if ldirty.
|
Generate _strip_comp, _bus_comp and update level cache if ldirty.
|
||||||
"""
|
"""
|
||||||
while event := self.queue.get():
|
while event := self.queue.get():
|
||||||
if event == "pdirty" and self._remote.pdirty:
|
if event == 'pdirty' and self._remote.pdirty:
|
||||||
self._remote.subject.notify(event)
|
self._remote.subject.notify(event)
|
||||||
elif event == "mdirty" and self._remote.mdirty:
|
elif event == 'mdirty' and self._remote.mdirty:
|
||||||
self._remote.subject.notify(event)
|
self._remote.subject.notify(event)
|
||||||
elif event == "midi" and self._remote.get_midi_message():
|
elif event == 'midi' and self._remote.get_midi_message():
|
||||||
self._remote.subject.notify(event)
|
self._remote.subject.notify(event)
|
||||||
elif event == "ldirty" and self._remote.ldirty:
|
elif event == 'ldirty' and self._remote.ldirty:
|
||||||
self._update_comps(self._remote._strip_buf, self._remote._bus_buf)
|
self._update_comps(self._remote._strip_buf, self._remote._bus_buf)
|
||||||
self._remote.cache["strip_level"] = self._remote._strip_buf
|
self._remote.cache['strip_level'] = self._remote._strip_buf
|
||||||
self._remote.cache["bus_level"] = self._remote._bus_buf
|
self._remote.cache['bus_level'] = self._remote._bus_buf
|
||||||
self._remote.subject.notify(event)
|
self._remote.subject.notify(event)
|
||||||
self.logger.debug(f"terminating {self.name} thread")
|
self.logger.debug(f'terminating {self.name} thread')
|
||||||
|
|||||||
@@ -22,16 +22,16 @@ def timeout(func):
|
|||||||
try:
|
try:
|
||||||
time.sleep(0.1) # ensure at least 0.1 delay before clearing dirty
|
time.sleep(0.1) # ensure at least 0.1 delay before clearing dirty
|
||||||
remote.logger.info(
|
remote.logger.info(
|
||||||
f"{type(remote).__name__}: Successfully logged into {remote} version {remote.version}"
|
f'{type(remote).__name__}: Successfully logged into {remote} version {remote.version}'
|
||||||
)
|
)
|
||||||
remote.logger.debug(f"login time: {round(time.time() - start, 2)}")
|
remote.logger.debug(f'login time: {round(time.time() - start, 2)}')
|
||||||
err = None
|
err = None
|
||||||
break
|
break
|
||||||
except CAPIError as e:
|
except CAPIError as e:
|
||||||
err = e
|
err = e
|
||||||
continue
|
continue
|
||||||
if err:
|
if err:
|
||||||
raise VMError("Timeout logging into the api")
|
raise VMError('Timeout logging into the api')
|
||||||
remote.clear_dirty()
|
remote.clear_dirty()
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
@@ -48,15 +48,15 @@ def polling(func):
|
|||||||
|
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
get = func.__name__ == "get"
|
get = func.__name__ == 'get'
|
||||||
mb_get = func.__name__ == "get_buttonstatus"
|
mb_get = func.__name__ == 'get_buttonstatus'
|
||||||
remote, *remaining = args
|
remote, *remaining = args
|
||||||
|
|
||||||
if get:
|
if get:
|
||||||
param, *rem = remaining
|
param, *rem = remaining
|
||||||
elif mb_get:
|
elif mb_get:
|
||||||
id, mode, *rem = remaining
|
id, mode, *rem = remaining
|
||||||
param = f"mb_{id}_{mode}"
|
param = f'mb_{id}_{mode}'
|
||||||
|
|
||||||
if param in remote.cache:
|
if param in remote.cache:
|
||||||
return remote.cache.pop(param)
|
return remote.cache.pop(param)
|
||||||
@@ -73,15 +73,15 @@ def script(func):
|
|||||||
def wrapper(*args):
|
def wrapper(*args):
|
||||||
remote, script = args
|
remote, script = args
|
||||||
if isinstance(script, dict):
|
if isinstance(script, dict):
|
||||||
params = ""
|
params = ''
|
||||||
for key, val in script.items():
|
for key, val in script.items():
|
||||||
obj, m2, *rem = key.split("-")
|
obj, m2, *rem = key.split('-')
|
||||||
index = int(m2) if m2.isnumeric() else int(*rem)
|
index = int(m2) if m2.isnumeric() else int(*rem)
|
||||||
params += ";".join(
|
params += ';'.join(
|
||||||
f"{obj}{f'.{m2}stream' if not m2.isnumeric() else ''}[{index}].{k}={int(v) if isinstance(v, bool) else v}"
|
f"{obj}{f'.{m2}stream' if not m2.isnumeric() else ''}[{index}].{k}={int(v) if isinstance(v, bool) else v}"
|
||||||
for k, v in val.items()
|
for k, v in val.items()
|
||||||
)
|
)
|
||||||
params += ";"
|
params += ';'
|
||||||
script = params
|
script = params
|
||||||
return func(remote, script)
|
return func(remote, script)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from abc import abstractmethod
|
import abc
|
||||||
|
|
||||||
|
from . import kinds
|
||||||
from .iremote import IRemote
|
from .iremote import IRemote
|
||||||
from .kinds import kinds_all
|
|
||||||
|
|
||||||
|
|
||||||
class VbanStream(IRemote):
|
class VbanStream(IRemote):
|
||||||
@@ -11,100 +11,100 @@ class VbanStream(IRemote):
|
|||||||
Defines concrete implementation for vban stream
|
Defines concrete implementation for vban stream
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@abstractmethod
|
@abc.abstractmethod
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return f"vban.{self.direction}stream[{self.index}]"
|
return f'vban.{self.direction}stream[{self.index}]'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def on(self) -> bool:
|
def on(self) -> bool:
|
||||||
return self.getter("on") == 1
|
return self.getter('on') == 1
|
||||||
|
|
||||||
@on.setter
|
@on.setter
|
||||||
def on(self, val: bool):
|
def on(self, val: bool):
|
||||||
self.setter("on", 1 if val else 0)
|
self.setter('on', 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
return self.getter("name", is_string=True)
|
return self.getter('name', is_string=True)
|
||||||
|
|
||||||
@name.setter
|
@name.setter
|
||||||
def name(self, val: str):
|
def name(self, val: str):
|
||||||
self.setter("name", val)
|
self.setter('name', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ip(self) -> str:
|
def ip(self) -> str:
|
||||||
return self.getter("ip", is_string=True)
|
return self.getter('ip', is_string=True)
|
||||||
|
|
||||||
@ip.setter
|
@ip.setter
|
||||||
def ip(self, val: str):
|
def ip(self, val: str):
|
||||||
self.setter("ip", val)
|
self.setter('ip', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def port(self) -> int:
|
def port(self) -> int:
|
||||||
return int(self.getter("port"))
|
return int(self.getter('port'))
|
||||||
|
|
||||||
@port.setter
|
@port.setter
|
||||||
def port(self, val: int):
|
def port(self, val: int):
|
||||||
if not 1024 <= val <= 65535:
|
if not 1024 <= val <= 65535:
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
f"port got: {val} but expected a value from 1024 to 65535"
|
f'port got: {val} but expected a value from 1024 to 65535'
|
||||||
)
|
)
|
||||||
self.setter("port", val)
|
self.setter('port', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sr(self) -> int:
|
def sr(self) -> int:
|
||||||
return int(self.getter("sr"))
|
return int(self.getter('sr'))
|
||||||
|
|
||||||
@sr.setter
|
@sr.setter
|
||||||
def sr(self, val: int):
|
def sr(self, val: int):
|
||||||
opts = (11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
|
opts = (11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
self.logger.warning(f"sr got: {val} but expected a value in {opts}")
|
self.logger.warning(f'sr got: {val} but expected a value in {opts}')
|
||||||
self.setter("sr", val)
|
self.setter('sr', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def channel(self) -> int:
|
def channel(self) -> int:
|
||||||
return int(self.getter("channel"))
|
return int(self.getter('channel'))
|
||||||
|
|
||||||
@channel.setter
|
@channel.setter
|
||||||
def channel(self, val: int):
|
def channel(self, val: int):
|
||||||
if not 1 <= val <= 8:
|
if not 1 <= val <= 8:
|
||||||
self.logger.warning(f"channel got: {val} but expected a value from 1 to 8")
|
self.logger.warning(f'channel got: {val} but expected a value from 1 to 8')
|
||||||
self.setter("channel", val)
|
self.setter('channel', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bit(self) -> int:
|
def bit(self) -> int:
|
||||||
return 16 if (int(self.getter("bit") == 1)) else 24
|
return 16 if (int(self.getter('bit') == 1)) else 24
|
||||||
|
|
||||||
@bit.setter
|
@bit.setter
|
||||||
def bit(self, val: int):
|
def bit(self, val: int):
|
||||||
if val not in (16, 24):
|
if val not in (16, 24):
|
||||||
self.logger.warning(f"bit got: {val} but expected value 16 or 24")
|
self.logger.warning(f'bit got: {val} but expected value 16 or 24')
|
||||||
self.setter("bit", 1 if (val == 16) else 2)
|
self.setter('bit', 1 if (val == 16) else 2)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def quality(self) -> int:
|
def quality(self) -> int:
|
||||||
return int(self.getter("quality"))
|
return int(self.getter('quality'))
|
||||||
|
|
||||||
@quality.setter
|
@quality.setter
|
||||||
def quality(self, val: int):
|
def quality(self, val: int):
|
||||||
if not 0 <= val <= 4:
|
if not 0 <= val <= 4:
|
||||||
self.logger.warning(f"quality got: {val} but expected a value from 0 to 4")
|
self.logger.warning(f'quality got: {val} but expected a value from 0 to 4')
|
||||||
self.setter("quality", val)
|
self.setter('quality', val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def route(self) -> int:
|
def route(self) -> int:
|
||||||
return int(self.getter("route"))
|
return int(self.getter('route'))
|
||||||
|
|
||||||
@route.setter
|
@route.setter
|
||||||
def route(self, val: int):
|
def route(self, val: int):
|
||||||
if not 0 <= val <= 8:
|
if not 0 <= val <= 8:
|
||||||
self.logger.warning(f"route got: {val} but expected a value from 0 to 8")
|
self.logger.warning(f'route got: {val} but expected a value from 0 to 8')
|
||||||
self.setter("route", val)
|
self.setter('route', val)
|
||||||
|
|
||||||
|
|
||||||
class VbanInstream(VbanStream):
|
class VbanInstream(VbanStream):
|
||||||
@@ -115,11 +115,11 @@ class VbanInstream(VbanStream):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}{self._remote.kind}{self.index}"
|
return f'{type(self).__name__}{self._remote.kind}{self.index}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def direction(self) -> str:
|
def direction(self) -> str:
|
||||||
return "in"
|
return 'in'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sr(self) -> int:
|
def sr(self) -> int:
|
||||||
@@ -154,11 +154,11 @@ class VbanOutstream(VbanStream):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}{self._remote.kind}{self.index}"
|
return f'{type(self).__name__}{self._remote.kind}{self.index}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def direction(self) -> str:
|
def direction(self) -> str:
|
||||||
return "out"
|
return 'out'
|
||||||
|
|
||||||
|
|
||||||
class VbanAudioOutstream(VbanOutstream):
|
class VbanAudioOutstream(VbanOutstream):
|
||||||
@@ -174,27 +174,27 @@ def _make_stream_pair(remote, kind):
|
|||||||
|
|
||||||
def _make_cls(i, direction):
|
def _make_cls(i, direction):
|
||||||
match direction:
|
match direction:
|
||||||
case "in":
|
case 'in':
|
||||||
if i < num_instream:
|
if i < num_instream:
|
||||||
return VbanAudioInstream(remote, i)
|
return VbanAudioInstream(remote, i)
|
||||||
elif i < num_instream + num_midi:
|
elif i < num_instream + num_midi:
|
||||||
return VbanMidiInstream(remote, i)
|
return VbanMidiInstream(remote, i)
|
||||||
else:
|
else:
|
||||||
return VbanTextInstream(remote, i)
|
return VbanTextInstream(remote, i)
|
||||||
case "out":
|
case 'out':
|
||||||
if i < num_outstream:
|
if i < num_outstream:
|
||||||
return VbanAudioOutstream(remote, i)
|
return VbanAudioOutstream(remote, i)
|
||||||
else:
|
else:
|
||||||
return VbanMidiOutstream(remote, i)
|
return VbanMidiOutstream(remote, i)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
tuple(_make_cls(i, "in") for i in range(num_instream + num_midi + num_text)),
|
tuple(_make_cls(i, 'in') for i in range(num_instream + num_midi + num_text)),
|
||||||
tuple(_make_cls(i, "out") for i in range(num_outstream + num_midi)),
|
tuple(_make_cls(i, 'out') for i in range(num_outstream + num_midi)),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _make_stream_pairs(remote):
|
def _make_stream_pairs(remote):
|
||||||
return {kind.name: _make_stream_pair(remote, kind) for kind in kinds_all}
|
return {kind.name: _make_stream_pair(remote, kind) for kind in kinds.all}
|
||||||
|
|
||||||
|
|
||||||
class Vban:
|
class Vban:
|
||||||
@@ -209,10 +209,10 @@ class Vban:
|
|||||||
self.instream, self.outstream = _make_stream_pairs(remote)[remote.kind.name]
|
self.instream, self.outstream = _make_stream_pairs(remote)[remote.kind.name]
|
||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
self.remote.set("vban.Enable", 1)
|
self.remote.set('vban.Enable', 1)
|
||||||
|
|
||||||
def disable(self):
|
def disable(self):
|
||||||
self.remote.set("vban.Enable", 0)
|
self.remote.set('vban.Enable', 0)
|
||||||
|
|
||||||
|
|
||||||
def vban_factory(remote) -> Vban:
|
def vban_factory(remote) -> Vban:
|
||||||
@@ -222,7 +222,7 @@ def vban_factory(remote) -> Vban:
|
|||||||
Returns a class that represents the VBAN module.
|
Returns a class that represents the VBAN module.
|
||||||
"""
|
"""
|
||||||
VBAN_cls = Vban
|
VBAN_cls = Vban
|
||||||
return type(f"{VBAN_cls.__name__}", (VBAN_cls,), {})(remote)
|
return type(f'{VBAN_cls.__name__}', (VBAN_cls,), {})(remote)
|
||||||
|
|
||||||
|
|
||||||
def request_vban_obj(remote) -> Vban:
|
def request_vban_obj(remote) -> Vban:
|
||||||
|
|||||||
Reference in New Issue
Block a user