mirror of
https://github.com/onyx-and-iris/xair-api-python.git
synced 2026-04-20 06:23:31 +00:00
Compare commits
11 Commits
fd4a228086
...
v2.4.3
| Author | SHA1 | Date | |
|---|---|---|---|
| 669aba4cc4 | |||
| ce4fccdc85 | |||
| deb298537f | |||
| f963997f35 | |||
| 39f3a9dd98 | |||
|
|
6cccfd0f56 | ||
| 05df111e69 | |||
| 2b91863337 | |||
| cf4a1d295f | |||
| b5b5633577 | |||
| 7b6e70028b |
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/p/xair-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@v4
|
||||||
|
- uses: astral-sh/ruff-action@v3
|
||||||
|
with:
|
||||||
|
args: 'format --check --diff'
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -130,6 +130,8 @@ dmypy.json
|
|||||||
|
|
||||||
# config, quick test
|
# config, quick test
|
||||||
config.toml
|
config.toml
|
||||||
quick.py
|
test-*.py
|
||||||
|
tools/*
|
||||||
|
!tools/README.md
|
||||||
|
|
||||||
.vscode/
|
.vscode/
|
||||||
13
README.md
13
README.md
@@ -1,5 +1,6 @@
|
|||||||
[](https://badge.fury.io/py/xair-api)
|
[](https://badge.fury.io/py/xair-api)
|
||||||
[](https://github.com/onyx-and-iris/xair-api-python/blob/dev/LICENSE)
|
[](https://github.com/onyx-and-iris/xair-api-python/blob/dev/LICENSE)
|
||||||
|
[](https://python-poetry.org/)
|
||||||
[](https://github.com/astral-sh/ruff)
|
[](https://github.com/astral-sh/ruff)
|
||||||

|

|
||||||
|
|
||||||
@@ -338,14 +339,14 @@ print(mixer.query('/ch/01/mix/on'))
|
|||||||
|
|
||||||
### `Tests`
|
### `Tests`
|
||||||
|
|
||||||
Unplug any expensive equipment before running tests.
|
Install [poetry](https://python-poetry.org/docs/#installation) and then:
|
||||||
Save your current settings to a snapshot first.
|
|
||||||
|
|
||||||
First make sure you installed the [development dependencies](https://github.com/onyx-and-iris/xair-api-python#installation)
|
```powershell
|
||||||
|
poetry poe test-xair
|
||||||
|
poetry poe test-x32
|
||||||
|
```
|
||||||
|
|
||||||
To run all tests:
|
Unplug any expensive equipment and save your current settings to a snapshot first.
|
||||||
|
|
||||||
`pytest -v`.
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ password = "mystrongpass"
|
|||||||
|
|
||||||
## Use
|
## Use
|
||||||
|
|
||||||
Change the xair ip argument from `mixer.local` to the ip of your xair mixer. Run the code and switch between scenes in OBS.
|
Change the xair ip argument from `mixer.local` to the ip of your xair mixer. Run the code and switch between scenes in OBS. Closing OBS will end the script.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,48 @@
|
|||||||
import obsws_python as obs
|
import threading
|
||||||
|
from logging import config
|
||||||
|
|
||||||
|
import obsws_python as obsws
|
||||||
|
|
||||||
import xair_api
|
import xair_api
|
||||||
|
|
||||||
|
config.dictConfig(
|
||||||
|
{
|
||||||
|
'version': 1,
|
||||||
|
'formatters': {
|
||||||
|
'standard': {
|
||||||
|
'format': '%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'handlers': {
|
||||||
|
'stream': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'class': 'logging.StreamHandler',
|
||||||
|
'formatter': 'standard',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'loggers': {
|
||||||
|
'xair_api.xair': {
|
||||||
|
'handlers': ['stream'],
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'propagate': False,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'root': {'handlers': ['stream'], 'level': 'WARNING'},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Observer:
|
class Observer:
|
||||||
def __init__(self, mixer):
|
def __init__(self, mixer, stop_event):
|
||||||
self._mixer = mixer
|
self._mixer = mixer
|
||||||
self._client = obs.EventClient()
|
self._stop_event = stop_event
|
||||||
self._client.callback.register(self.on_current_program_scene_changed)
|
self._client = obsws.EventClient()
|
||||||
|
self._client.callback.register(
|
||||||
|
(
|
||||||
|
self.on_current_program_scene_changed,
|
||||||
|
self.on_exit_started,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
return self
|
return self
|
||||||
@@ -32,12 +67,16 @@ class Observer:
|
|||||||
self._mixer.config.mute_group[0].on = True
|
self._mixer.config.mute_group[0].on = True
|
||||||
print(f'Mute Group 1 is {self._mixer.config.mute_group[0].on}')
|
print(f'Mute Group 1 is {self._mixer.config.mute_group[0].on}')
|
||||||
|
|
||||||
|
def on_exit_started(self, _):
|
||||||
|
self._stop_event.set()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
with xair_api.connect('MR18', ip='mixer.local') as mixer:
|
with xair_api.connect('MR18', ip='mixer.local') as mixer:
|
||||||
with Observer(mixer):
|
stop_event = threading.Event()
|
||||||
while _ := input('Press <Enter> to exit\n'):
|
|
||||||
pass
|
with Observer(mixer, stop_event):
|
||||||
|
stop_event.wait()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
27
poetry.lock
generated
27
poetry.lock
generated
@@ -1,4 +1,4 @@
|
|||||||
# This file is automatically @generated by Poetry 2.0.1 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]]
|
[[package]]
|
||||||
name = "cachetools"
|
name = "cachetools"
|
||||||
@@ -55,7 +55,7 @@ description = "Backport of PEP 654 (exception groups)"
|
|||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
markers = "python_version < \"3.11\""
|
markers = "python_version == \"3.10\""
|
||||||
files = [
|
files = [
|
||||||
{file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"},
|
{file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"},
|
||||||
{file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"},
|
{file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"},
|
||||||
@@ -66,21 +66,16 @@ test = ["pytest (>=6)"]
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "filelock"
|
name = "filelock"
|
||||||
version = "3.16.1"
|
version = "3.20.1"
|
||||||
description = "A platform independent file lock."
|
description = "A platform independent file lock."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8"
|
python-versions = ">=3.10"
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "filelock-3.16.1-py3-none-any.whl", hash = "sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0"},
|
{file = "filelock-3.20.1-py3-none-any.whl", hash = "sha256:15d9e9a67306188a44baa72f569d2bfd803076269365fdea0934385da4dc361a"},
|
||||||
{file = "filelock-3.16.1.tar.gz", hash = "sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435"},
|
{file = "filelock-3.20.1.tar.gz", hash = "sha256:b8360948b351b80f420878d8516519a2204b07aefcdcfd24912a5d33127f188c"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
docs = ["furo (>=2024.8.6)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4.1)"]
|
|
||||||
testing = ["covdefaults (>=2.3)", "coverage (>=7.6.1)", "diff-cover (>=9.2)", "pytest (>=8.3.3)", "pytest-asyncio (>=0.24)", "pytest-cov (>=5)", "pytest-mock (>=3.14)", "pytest-timeout (>=2.3.1)", "virtualenv (>=20.26.4)"]
|
|
||||||
typing = ["typing-extensions (>=4.12.2)"]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iniconfig"
|
name = "iniconfig"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
@@ -255,7 +250,7 @@ description = "A lil' TOML parser"
|
|||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8"
|
python-versions = ">=3.8"
|
||||||
groups = ["main", "dev"]
|
groups = ["main", "dev"]
|
||||||
markers = "python_version < \"3.11\""
|
markers = "python_version == \"3.10\""
|
||||||
files = [
|
files = [
|
||||||
{file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"},
|
{file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"},
|
||||||
{file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"},
|
{file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"},
|
||||||
@@ -326,7 +321,7 @@ description = "Backported and Experimental Type Hints for Python 3.8+"
|
|||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8"
|
python-versions = ">=3.8"
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
markers = "python_version < \"3.11\""
|
markers = "python_version == \"3.10\""
|
||||||
files = [
|
files = [
|
||||||
{file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"},
|
{file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"},
|
||||||
{file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"},
|
{file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"},
|
||||||
@@ -351,7 +346,7 @@ platformdirs = ">=3.9.1,<5"
|
|||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
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)"]
|
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.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"]
|
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 == \"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]]
|
[[package]]
|
||||||
name = "virtualenv-pyenv"
|
name = "virtualenv-pyenv"
|
||||||
@@ -371,5 +366,5 @@ virtualenv = "*"
|
|||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.1"
|
lock-version = "2.1"
|
||||||
python-versions = "<4.0,>=3.10"
|
python-versions = ">=3.10"
|
||||||
content-hash = "6cd4c5329b1df022fdec343a52a0fda804c33234b208aab94025e6798ea6820d"
|
content-hash = "dbba803b0ac29e3120c3f302260b600a8ef58bfac91c41a58f242804f17b89ba"
|
||||||
|
|||||||
103
pyproject.toml
103
pyproject.toml
@@ -1,20 +1,18 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "xair-api"
|
name = "xair-api"
|
||||||
version = "2.4.1"
|
version = "2.4.3"
|
||||||
description = "Remote control Behringer X-Air | Midas MR mixers through OSC"
|
description = "Remote control Behringer X-Air | Midas MR mixers through OSC"
|
||||||
authors = [
|
authors = [{ name = "Onyx and Iris", email = "code@onyxandiris.online" }]
|
||||||
{name = "Onyx and Iris",email = "code@onyxandiris.online"}
|
license = { text = "MIT" }
|
||||||
]
|
|
||||||
license = {text = "MIT"}
|
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = "<4.0,>=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"python-osc (>=1.9.3,<2.0.0)",
|
"python-osc (>=1.9.3,<2.0.0)",
|
||||||
"tomli (>=2.0.1,<3.0) ; python_version < '3.11'"
|
"tomli (>=2.0.1,<3.0) ; python_version < '3.11'",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.poetry.requires-plugins]
|
[tool.poetry.requires-plugins]
|
||||||
poethepoet = "^0.32.1"
|
poethepoet = "^0.35.0"
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
pytest = "^8.3.4"
|
pytest = "^8.3.4"
|
||||||
@@ -31,54 +29,58 @@ build-backend = "poetry.core.masonry.api"
|
|||||||
obs.script = "scripts:ex_obs"
|
obs.script = "scripts:ex_obs"
|
||||||
sends.script = "scripts:ex_sends"
|
sends.script = "scripts:ex_sends"
|
||||||
headamp.script = "scripts:ex_headamp"
|
headamp.script = "scripts:ex_headamp"
|
||||||
xair.script = "scripts:test_xair"
|
test-xair.script = "scripts:test_xair"
|
||||||
x32.script = "scripts:test_x32"
|
test-x32.script = "scripts:test_x32"
|
||||||
all.script = "scripts:test_all"
|
test-all.script = "scripts:test_all"
|
||||||
|
|
||||||
[tool.tox]
|
[tool.tox]
|
||||||
legacy_tox_ini = """
|
legacy_tox_ini = """
|
||||||
[tox]
|
[tox]
|
||||||
envlist = py310,py311,py312
|
envlist = py310,py311,py312,py313
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
setenv = VIRTUALENV_DISCOVERY=pyenv
|
passenv =
|
||||||
allowlist_externals = poetry
|
TEST_MODULE
|
||||||
commands =
|
setenv = VIRTUALENV_DISCOVERY=pyenv
|
||||||
poetry install -v
|
allowlist_externals = poetry
|
||||||
poetry run pytest tests/
|
commands_pre =
|
||||||
|
poetry install --no-interaction --no-root
|
||||||
|
commands =
|
||||||
|
poetry run pytest tests/{env:TEST_MODULE}
|
||||||
|
|
||||||
[testenv:obs]
|
[testenv:obs]
|
||||||
setenv = VIRTUALENV_DISCOVERY=pyenv
|
setenv = VIRTUALENV_DISCOVERY=pyenv
|
||||||
allowlist_externals = poetry
|
allowlist_externals = poetry
|
||||||
deps = obsws-python
|
deps = obsws-python
|
||||||
commands =
|
commands_pre =
|
||||||
poetry install -v --without dev
|
poetry install --no-interaction --no-root --without dev
|
||||||
poetry run python examples/xair_obs/
|
commands =
|
||||||
|
poetry run python examples/xair_obs
|
||||||
"""
|
"""
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
exclude = [
|
exclude = [
|
||||||
".bzr",
|
".bzr",
|
||||||
".direnv",
|
".direnv",
|
||||||
".eggs",
|
".eggs",
|
||||||
".git",
|
".git",
|
||||||
".git-rewrite",
|
".git-rewrite",
|
||||||
".hg",
|
".hg",
|
||||||
".mypy_cache",
|
".mypy_cache",
|
||||||
".nox",
|
".nox",
|
||||||
".pants.d",
|
".pants.d",
|
||||||
".pytype",
|
".pytype",
|
||||||
".ruff_cache",
|
".ruff_cache",
|
||||||
".svn",
|
".svn",
|
||||||
".tox",
|
".tox",
|
||||||
".venv",
|
".venv",
|
||||||
"__pypackages__",
|
"__pypackages__",
|
||||||
"_build",
|
"_build",
|
||||||
"buck-out",
|
"buck-out",
|
||||||
"build",
|
"build",
|
||||||
"dist",
|
"dist",
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"venv",
|
"venv",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Same as Black.
|
# Same as Black.
|
||||||
@@ -133,7 +135,4 @@ docstring-code-line-length = "dynamic"
|
|||||||
max-complexity = 10
|
max-complexity = 10
|
||||||
|
|
||||||
[tool.ruff.lint.per-file-ignores]
|
[tool.ruff.lint.per-file-ignores]
|
||||||
"__init__.py" = [
|
"__init__.py" = ["E402", "F401"]
|
||||||
"E402",
|
|
||||||
"F401",
|
|
||||||
]
|
|
||||||
|
|||||||
20
scripts.py
20
scripts.py
@@ -1,31 +1,35 @@
|
|||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
def ex_obs():
|
def ex_obs():
|
||||||
subprocess.run(["tox", "r", "-e", "obs"])
|
subprocess.run(['tox', 'r', '-e', 'obs'])
|
||||||
|
|
||||||
|
|
||||||
def ex_sends():
|
def ex_sends():
|
||||||
path = Path.cwd() / "examples" / "sends" / "."
|
path = Path.cwd() / 'examples' / 'sends' / '.'
|
||||||
subprocess.run([sys.executable, str(path)])
|
subprocess.run([sys.executable, str(path)])
|
||||||
|
|
||||||
|
|
||||||
def ex_headamp():
|
def ex_headamp():
|
||||||
path = Path.cwd() / "examples" / "headamp" / "."
|
path = Path.cwd() / 'examples' / 'headamp' / '.'
|
||||||
subprocess.run([sys.executable, str(path)])
|
subprocess.run([sys.executable, str(path)])
|
||||||
|
|
||||||
|
|
||||||
def test_xair():
|
def test_xair():
|
||||||
path = Path.cwd() / "tests" / "xair"
|
subprocess.run(['tox'], env=os.environ.copy() | {'TEST_MODULE': 'xair'})
|
||||||
subprocess.run(["pytest", "-v", str(path)])
|
|
||||||
|
|
||||||
|
|
||||||
def test_x32():
|
def test_x32():
|
||||||
path = Path.cwd() / "tests" / "x32"
|
path = Path.cwd() / 'tools' / 'x32.exe'
|
||||||
subprocess.run(["pytest", "-v", str(path)])
|
proc = subprocess.Popen([str(path), '-i', 'x32.local'])
|
||||||
|
subprocess.run(['tox'], env=os.environ.copy() | {'TEST_MODULE': 'x32'})
|
||||||
|
proc.terminate()
|
||||||
|
|
||||||
|
|
||||||
def test_all():
|
def test_all():
|
||||||
subprocess.run(["tox"])
|
steps = [test_xair, test_x32]
|
||||||
|
for step in steps:
|
||||||
|
step()
|
||||||
|
|||||||
3
tools/README.md
Normal file
3
tools/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# X32 Tests
|
||||||
|
|
||||||
|
Download the [x32 Emulator](https://sites.google.com/site/patrickmaillot/x32#h.p_rE4IH0Luimc0) and place it in this directory in order to run the x32 tests.
|
||||||
@@ -118,12 +118,12 @@ class Gate:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def mode(self) -> str:
|
def mode(self) -> str:
|
||||||
opts = ('gate', 'exp2', 'exp3', 'exp4', 'duck')
|
opts = ('exp2', 'exp3', 'exp4', 'gate', 'duck')
|
||||||
return opts[self.getter('mode')[0]]
|
return opts[self.getter('mode')[0]]
|
||||||
|
|
||||||
@mode.setter
|
@mode.setter
|
||||||
def mode(self, val: str):
|
def mode(self, val: str):
|
||||||
opts = ('gate', 'exp2', 'exp3', 'exp4', 'duck')
|
opts = ('exp2', 'exp3', 'exp4', 'gate', 'duck')
|
||||||
if val not in opts:
|
if val not in opts:
|
||||||
self.logger.warning(f'mode got {val}, expected one of {opts}')
|
self.logger.warning(f'mode got {val}, expected one of {opts}')
|
||||||
self.setter('mode', opts.index(val))
|
self.setter('mode', opts.index(val))
|
||||||
@@ -525,7 +525,7 @@ class EQ:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def quality(self) -> float:
|
def quality(self) -> float:
|
||||||
retval = util.log_get(0.3, 10, self.getter('q')[0])
|
retval = util.log_get(0.3, 10, 1.0 - self.getter('q')[0])
|
||||||
return round(retval, 1)
|
return round(retval, 1)
|
||||||
|
|
||||||
@quality.setter
|
@quality.setter
|
||||||
@@ -534,7 +534,7 @@ class EQ:
|
|||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
f'quality got {val}, expected value in range 0.3 to 10.0'
|
f'quality got {val}, expected value in range 0.3 to 10.0'
|
||||||
)
|
)
|
||||||
self.setter('q', util.log_set(0.3, 10, val))
|
self.setter('q', 1.0 - util.log_set(0.3, 10, val))
|
||||||
|
|
||||||
|
|
||||||
class GEQ:
|
class GEQ:
|
||||||
|
|||||||
Reference in New Issue
Block a user