fix gain setter, add public_packet methods, update readme

fix gain setter for strips.

add accessor methods for public_packet.

update readme
This commit is contained in:
onyx-and-iris 2022-03-02 21:06:39 +00:00
parent b836fa8642
commit ad7cd367cb
4 changed files with 11 additions and 4 deletions

View File

@ -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:

View File

@ -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()

View File

@ -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):

View File

@ -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():