From edc8d820df84c147ddb6e723b9639bddd6d15344 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sat, 10 Oct 2026 17:20:48 +0200 Subject: XR18 volume controller --- solo-tool-project/pyproject.toml | 3 ++- solo-tool-project/src/solo_tool/external_volume.py | 31 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 solo-tool-project/src/solo_tool/external_volume.py (limited to 'solo-tool-project') diff --git a/solo-tool-project/pyproject.toml b/solo-tool-project/pyproject.toml index 40d09d8..2b70459 100644 --- a/solo-tool-project/pyproject.toml +++ b/solo-tool-project/pyproject.toml @@ -16,7 +16,8 @@ dependencies = [ "mido", "python-mpv", "pyaudio", - "pydub-ng" + "pydub-ng", + "python-osc" ] [project.optional-dependencies] diff --git a/solo-tool-project/src/solo_tool/external_volume.py b/solo-tool-project/src/solo_tool/external_volume.py new file mode 100644 index 0000000..425351a --- /dev/null +++ b/solo-tool-project/src/solo_tool/external_volume.py @@ -0,0 +1,31 @@ +from pythonosc import udp_client + +class VolumeControllerXR18(): + def __init__(self, ip: str): + port = 10024 + self._client = udp_client.SimpleUDPClient(ip, port, timeout=1) + self._headphoneVolume = 0.0 + self._speakerVolume = 0.0 + + def __del__(self): + self._client.close() + + @property + def headphoneVolume(self) -> float: + return self._headphoneVolume + + @headphoneVolume.setter + def headphoneVolume(self, new: float) -> None: + if new is not None: + self._headphoneVolume = min(max(new, 0.0), 1.0) + self._client.send_message("/config/solo/level", self._headphoneVolume) + + @property + def speakerVolume(self) -> float: + return self._speakerVolume + + @speakerVolume.setter + def speakerVolume(self, new: float) -> None: + if new is not None: + self._speakerVolume = min(max(new, 0.0), 1.0) + self._client.send_message("/lr/mix/fader", self._speakerVolume) -- cgit v1.2.3