From d951c5efce228636ba7e1da7c7d6efc4f12f6839 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Mon, 20 Jun 2022 00:06:03 +0100 Subject: [PATCH] changes to observers thread. minor version bump --- pyproject.toml | 2 +- voicemeeterlib/base.py | 18 +++++++++--------- voicemeeterlib/subject.py | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6760778..d418017 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "voicemeeter-api" -version = "0.1.8" +version = "0.1.9" description = "A Python wrapper for the Voiceemeter API" authors = ["onyx-and-iris "] license = "MIT" diff --git a/voicemeeterlib/base.py b/voicemeeterlib/base.py index 4ebd160..3c7762b 100644 --- a/voicemeeterlib/base.py +++ b/voicemeeterlib/base.py @@ -50,15 +50,7 @@ class Remote(CBindings): if self.ldirty: self._strip_levels = self.strip_buf self._bus_levels = self.bus_buf - self.subject.notify( - "ldirty", - ( - self._strip_levels, - self._strip_comp, - self._bus_levels, - self._bus_comp, - ), - ) + self.subject.notify("ldirty") time.sleep(self.ratelimit) def login(self) -> NoReturn: @@ -228,6 +220,14 @@ class Remote(CBindings): self.vm_get_level(ct.c_long(type_), ct.c_long(index), ct.byref(val)) return val.value + @property + def strip_levels(self): + return self._strip_levels + + @property + def bus_levels(self): + return self._bus_levels + @script def sendtext(self, script: str): """Sets many parameters from a script""" diff --git a/voicemeeterlib/subject.py b/voicemeeterlib/subject.py index 643549d..f5f0bf1 100644 --- a/voicemeeterlib/subject.py +++ b/voicemeeterlib/subject.py @@ -12,10 +12,10 @@ class Subject: return self._observers - def notify(self, modifier=None, data=None): + def notify(self, modifier=None): """run callbacks on update""" - [o.on_update(modifier, data) for o in self._observers] + [o.on_update(modifier) for o in self._observers] def add(self, observer): """adds an observer to _observers"""