From 24870e1861e7e8f8bb45a492b49f4ef7f94d4ce5 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Wed, 6 Jul 2022 13:57:52 +0100 Subject: [PATCH] channels and gainlayers now using is_updated minor ver bump. dependencies updated. --- pyproject.toml | 6 +++--- vmcompact/channels.py | 47 ++++++------------------------------------ vmcompact/gainlayer.py | 37 ++++++++------------------------- 3 files changed, 18 insertions(+), 72 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e618e65..a7bf569 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "voicemeeter-compact" -version = "1.0.5" +version = "1.0.6" description = "A Compact Voicemeeter Remote App" authors = ["onyx-and-iris "] license = "MIT" @@ -15,8 +15,8 @@ include = ["vmcompact/img/cat.ico"] [tool.poetry.dependencies] python = "^3.11" sv-ttk = "^0.1" -voicemeeter-api = { version = "^0.1.9", python = "^3.10" } -vban-cmd = { version = "^1.0.8", python = "^3.10" } +voicemeeter-api = { version = "^0.2.0", python = "^3.10" } +vban-cmd = { version = "^1.1.0", python = "^3.10" } [tool.poetry.dev-dependencies] diff --git a/vmcompact/channels.py b/vmcompact/channels.py index 7e45cc0..e3c5c6b 100644 --- a/vmcompact/channels.py +++ b/vmcompact/channels.py @@ -125,11 +125,6 @@ class ChannelLabelFrame(ttk.LabelFrame): self.grid() self.configure(text=retval) - def convert_level(self, val): - if _base_values.vban_connected: - return round(-val * 0.01, 1) - return round(20 * log(val, 10), 1) if val > 0 else -200.0 - def grid_configure(self): self.grid(sticky=(tk.N, tk.S)) [ @@ -167,25 +162,9 @@ class Strip(ChannelLabelFrame): Checks offset against expected level array size to avoid a race condition """ - if self.level_offset + 1 < len(self.parent.target.strip_levels): - if ( - any( - self.parent.target._strip_comp[ - self.level_offset : self.level_offset + 1 - ] - ) - or self.level.get() > 0 - ): - val = self.convert_level( - max( - self.parent.target.strip_levels[ - self.level_offset : self.level_offset + 1 - ] - ) - ) - self.level.set( - (0 if self.mute.get() else 100 + val - 18 + self.gain.get()) - ) + if self.target.levels.is_updated: + val = max(self.target.levels.prefader) + self.level.set((0 if self.mute.get() else 100 + val - 18 + self.gain.get())) def on_update(self, subject): """update levels""" @@ -208,23 +187,9 @@ class Bus(ChannelLabelFrame): return getattr(_target, self.identifier)[self.index] def upd_levels(self): - if self.level_offset + 1 < len(self.parent.target.bus_levels): - if ( - any( - self.parent.target._bus_comp[ - self.level_offset : self.level_offset + 1 - ] - ) - or self.level.get() > 0 - ): - val = self.convert_level( - max( - self.parent.target.bus_levels[ - self.level_offset : self.level_offset + 1 - ] - ) - ) - self.level.set((0 if self.mute.get() else 100 + val - 18)) + if self.target.levels.is_updated: + val = max(self.target.levels.all) + self.level.set((0 if self.mute.get() else 100 + val - 18)) def on_update(self, subject): """update levels""" diff --git a/vmcompact/gainlayer.py b/vmcompact/gainlayer.py index cd61797..7c2f52e 100644 --- a/vmcompact/gainlayer.py +++ b/vmcompact/gainlayer.py @@ -127,41 +127,22 @@ class GainLayer(ttk.LabelFrame): self.grid() self.configure(text=retval) - def convert_level(self, val): - if _base_values.vban_connected: - return round(-val * 0.01, 1) - return round(20 * log(val, 10), 1) if val > 0 else -200.0 - def upd_levels(self): """ Updates level values. Checks offset against expected level array size to avoid a race condition """ - if self.level_offset + 1 < len(self.parent.target.strip_levels): - if ( - any( - self.parent.target._strip_comp[ - self.level_offset : self.level_offset + 1 - ] - ) - or self.level.get() > 0 - ): - val = self.convert_level( - max( - self.parent.target.strip_levels[ - self.level_offset : self.level_offset + 1 - ] - ) - ) - self.level.set( - ( - 0 - if self.parent.target.strip[self.index].mute - or not self.on.get() - else 100 + val - 18 + self.gain.get() - ) + + if self.parent.target.strip[self.index].levels.is_updated: + val = max(self.parent.target.strip[self.index].levels.prefader) + self.level.set( + ( + 0 + if self.parent.target.strip[self.index].mute or not self.on.get() + else 100 + val - 18 + self.gain.get() ) + ) def on_update(self, subject): """update levels"""