aboutsummaryrefslogtreecommitdiffstats
path: root/solo-tool-project
diff options
context:
space:
mode:
Diffstat (limited to 'solo-tool-project')
-rw-r--r--solo-tool-project/pyproject.toml3
-rw-r--r--solo-tool-project/src/solo_tool/external_volume.py31
2 files changed, 33 insertions, 1 deletions
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)