From ad7cd367cbd0dd4bcc5fabe177cfd6719c7abb15 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Wed, 2 Mar 2022 21:06:39 +0000 Subject: [PATCH] fix gain setter, add public_packet methods, update readme fix gain setter for strips. add accessor methods for public_packet. update readme --- README.md | 1 + tests/__init__.py | 5 +++-- vban_cmd/strip.py | 2 +- vban_cmd/vban_cmd.py | 7 ++++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bf54c7d..3a605a4 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ The following properties are gettable and settable: - `mute`: boolean - `label`: string - `gainlayer`: float, -60 to 12 +- `gain`: float, -60 to 12 - Output mapping (e.g. `A1`, `B3`, etc.): boolean, depends on the Voicemeeter kind The following properties are settable: diff --git a/tests/__init__.py b/tests/__init__.py index 1b2a0d6..cc88407 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -9,18 +9,19 @@ _kind = 'potato' opts = { 'ip': 'ws.local', 'streamname': 'testing', - 'port': 6980, + 'port': 6990, 'bps': 0, + 'channel': 3 } vbanrs = {kind.id: vban_cmd.connect(_kind, **opts) for kind in kinds.all} tests = vbanrs[_kind] def setup_package(): + tests._modes = Modes() tests._rt_packet_socket.bind((socket.gethostbyname(socket.gethostname()), tests._port)) tests.worker = Thread(target=tests._send_register_rt, daemon=True) tests.worker.start() - tests._modes = Modes() def teardown_package(): tests._rt_packet_socket.close() diff --git a/vban_cmd/strip.py b/vban_cmd/strip.py index 5072344..ff4339d 100644 --- a/vban_cmd/strip.py +++ b/vban_cmd/strip.py @@ -80,7 +80,7 @@ class InputStrip(Channel): @gain.setter def gain(self, val: float): - self.gainlayer[0].gain = val + self.setter('gain', val) class PhysicalInputStrip(InputStrip): diff --git a/vban_cmd/vban_cmd.py b/vban_cmd/vban_cmd.py index 68ad9ce..9ec43c3 100644 --- a/vban_cmd/vban_cmd.py +++ b/vban_cmd/vban_cmd.py @@ -48,11 +48,13 @@ class VbanCmd(abc.ABC): is_writable = [self._rt_register_socket, self._rt_packet_socket, self._sendrequest_string_socket] is_error = [] self.ready_to_read, self.ready_to_write, in_error = select.select(is_readable, is_writable, is_error, 60) + self._public_packet = None def __enter__(self): self._rt_packet_socket.bind((socket.gethostbyname(socket.gethostname()), self._port)) worker = Thread(target=self._send_register_rt, daemon=True) worker.start() + self._public_packet = self._get_rt() return self def _send_register_rt(self): @@ -99,7 +101,10 @@ class VbanCmd(abc.ABC): @property def public_packet(self): - return self._get_rt() + return self._public_packet or self._get_rt() + @public_packet.setter + def public_packet(self, val): + self._public_packet = val def _get_rt(self): def fget():