diff --git a/examples/obs/__main__.py b/examples/obs/__main__.py index 83e4c55..d74db44 100644 --- a/examples/obs/__main__.py +++ b/examples/obs/__main__.py @@ -11,23 +11,37 @@ from obswebsocket import events, obsws def on_start(): vm.strip[0].mute = True + vm.strip[1].B1 = True + vm.strip[2].B2 = True def on_brb(): vm.strip[7].fadeto(0, 500) + vm.bus[0].mute = True def on_end(): - vm.strip[0].mute = True + vm.apply( + { + "strip-0": {"mute": True}, + "strip-1": {"mute": True, "B1": False}, + "strip-2": {"mute": True, "B1": False}, + "vban-in-0": {"on": False}, + } + ) def on_live(): vm.strip[0].mute = False vm.strip[7].fadeto(-6, 500) + vm.strip[7].A3 = True + vm.vban.instream[0].on = True def on_switch(message): scene = message.getSceneName() + print(f"Switched to scene {scene}") + match scene: case "START": on_start() diff --git a/voicemeeterlib/bus.py b/voicemeeterlib/bus.py index be53f45..51a8447 100644 --- a/voicemeeterlib/bus.py +++ b/voicemeeterlib/bus.py @@ -116,7 +116,7 @@ class PhysicalBus(Bus): if kind.name == "potato": EFFECTS_cls = _make_effects_mixin() kls += (EFFECTS_cls,) - return type(f"PhysicalBus", kls, {}) + return type("PhysicalBus", kls, {}) def __str__(self): return f"{type(self).__name__}{self.index}" @@ -146,7 +146,7 @@ class VirtualBus(Bus): elif kind.name == "potato": EFFECTS_cls = _make_effects_mixin() kls += (EFFECTS_cls,) - return type(f"VirtualBus", kls, {}) + return type("VirtualBus", kls, {}) def __str__(self): return f"{type(self).__name__}{self.index}" @@ -164,15 +164,15 @@ class BusLevel(IRemote): If observables thread running fetch values from cache otherwise call CAPI func. """ - def fget(i): - return round(20 * log(i, 10), 1) if i > 0 else -200.0 + def fget(x): + return round(20 * log(x, 10), 1) if x > 0 else -200.0 if self._remote.running and "bus_level" in self._remote.cache: vals = self._remote.cache["bus_level"][self.range[0] : self.range[-1]] else: vals = [self._remote.get_level(mode, i) for i in range(*self.range)] - return tuple(fget(i) for i in vals) + return tuple(fget(val) for val in vals) @property def identifier(self) -> str: diff --git a/voicemeeterlib/misc.py b/voicemeeterlib/misc.py index 3a008c4..aca7db3 100644 --- a/voicemeeterlib/misc.py +++ b/voicemeeterlib/misc.py @@ -96,10 +96,10 @@ class Asio(IRemote): class AsioIn(Asio): def get(self) -> int: - return int(self.getter(f"asio{[self.index]}")) + return int(self.getter(f"asio[{self.index}]")) def set(self, val: int): - self.setter(f"asio{[self.index]}", val) + self.setter(f"asio[{self.index}]", val) class AsioOut(Asio): @@ -108,10 +108,10 @@ class AsioOut(Asio): self._param = param def get(self) -> int: - return int(self.getter(f"out{self._param}{[self.index]}")) + return int(self.getter(f"out{self._param}[{self.index}]")) def set(self, val: int): - self.setter(f"out{self._param}{[self.index]}", val) + self.setter(f"out{self._param}[{self.index}]", val) def _make_asio_mixin(remote, kind): @@ -138,7 +138,7 @@ def _make_asio_mixins(remote): class Composite(IRemote): @property def identifier(self) -> str: - return f"patch" + return "patch" def get(self) -> int: return int(self.getter(f"composite[{self.index}]")) @@ -150,7 +150,7 @@ class Composite(IRemote): class Insert(IRemote): @property def identifier(self) -> str: - return f"patch" + return "patch" @property def on(self) -> bool: @@ -184,7 +184,7 @@ class Option(IRemote): @property def identifier(self) -> str: - return f"option" + return "option" @property def sr(self) -> int: @@ -220,7 +220,7 @@ class Option(IRemote): class Delay(IRemote): @property def identifier(self) -> str: - return f"option" + return "option" def get(self) -> int: return int(self.getter(f"delay[{self.index}]")) diff --git a/voicemeeterlib/strip.py b/voicemeeterlib/strip.py index 1db3d69..4b407d2 100644 --- a/voicemeeterlib/strip.py +++ b/voicemeeterlib/strip.py @@ -196,15 +196,15 @@ class StripLevel(IRemote): If observables thread running fetch values from cache otherwise call CAPI func. """ - def fget(i): - return round(20 * log(i, 10), 1) if i > 0 else -200.0 + def fget(x): + return round(20 * log(x, 10), 1) if x > 0 else -200.0 if self._remote.running and "strip_level" in self._remote.cache: vals = self._remote.cache["strip_level"][self.range[0] : self.range[-1]] else: vals = [self._remote.get_level(mode, i) for i in range(*self.range)] - return tuple(fget(i) for i in vals) + return tuple(fget(val) for val in vals) @property def identifier(self) -> str: