mirror of
https://github.com/onyx-and-iris/voicemeeter-compact.git
synced 2024-11-25 06:10:53 +00:00
update timing adjusted
deregister as observer moved into teardown functions. check index against num_strip, num_bus in level updates patch bump
This commit is contained in:
parent
8790e24ff3
commit
4118002b0a
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "voicemeeter-compact"
|
name = "voicemeeter-compact"
|
||||||
version = "1.0.7"
|
version = "1.0.8"
|
||||||
description = "A Compact Voicemeeter Remote App"
|
description = "A Compact Voicemeeter Remote App"
|
||||||
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@ -16,7 +16,7 @@ include = ["vmcompact/img/cat.ico"]
|
|||||||
python = "^3.11"
|
python = "^3.11"
|
||||||
sv-ttk = "^0.1"
|
sv-ttk = "^0.1"
|
||||||
voicemeeter-api = { version = "^0.2.1", python = "^3.10" }
|
voicemeeter-api = { version = "^0.2.1", python = "^3.10" }
|
||||||
vban-cmd = { version = "^1.1.0", python = "^3.10" }
|
vban-cmd = { version = "^1.1.1", python = "^3.10" }
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
black = {version = "^22.6.0", allow-prereleases = true}
|
black = {version = "^22.6.0", allow-prereleases = true}
|
||||||
|
@ -23,7 +23,8 @@ class ChannelLabelFrame(ttk.LabelFrame):
|
|||||||
self.builder.add_mute_button()
|
self.builder.add_mute_button()
|
||||||
self.builder.add_conf_button()
|
self.builder.add_conf_button()
|
||||||
self.builder.add_gain_label()
|
self.builder.add_gain_label()
|
||||||
self.sync()
|
self.sync_params()
|
||||||
|
self.sync_labels()
|
||||||
self.grid_configure()
|
self.grid_configure()
|
||||||
|
|
||||||
self.configbuilder = builders.MainFrameBuilder(self.parent.parent)
|
self.configbuilder = builders.MainFrameBuilder(self.parent.parent)
|
||||||
@ -96,9 +97,13 @@ class ChannelLabelFrame(ttk.LabelFrame):
|
|||||||
background=f'{"yellow" if self.conf.get() else "white"}',
|
background=f'{"yellow" if self.conf.get() else "white"}',
|
||||||
)
|
)
|
||||||
|
|
||||||
def sync(self):
|
def on_update(self, subject):
|
||||||
self.after(_base_values.pdelay, self.sync_params)
|
if subject == "ldirty":
|
||||||
self.after(100, self.sync_labels)
|
self.upd_levels()
|
||||||
|
elif subject == "pdirty":
|
||||||
|
self.sync_params()
|
||||||
|
elif subject == "labelframe":
|
||||||
|
self.after(5, self.sync_labels)
|
||||||
|
|
||||||
def sync_params(self):
|
def sync_params(self):
|
||||||
"""sync parameter states, update button colours"""
|
"""sync parameter states, update button colours"""
|
||||||
@ -160,14 +165,12 @@ class Strip(ChannelLabelFrame):
|
|||||||
"""
|
"""
|
||||||
Updates level values.
|
Updates level values.
|
||||||
"""
|
"""
|
||||||
if self.target.levels.is_updated:
|
if self.index < self.parent.parent.kind.num_strip:
|
||||||
val = max(self.target.levels.prefader)
|
if self.target.levels.is_updated:
|
||||||
self.level.set((0 if self.mute.get() else 100 + val - 18 + self.gain.get()))
|
val = max(self.target.levels.prefader)
|
||||||
|
self.level.set(
|
||||||
def on_update(self, subject):
|
(0 if self.mute.get() else 100 + val - 18 + self.gain.get())
|
||||||
"""update levels"""
|
)
|
||||||
if subject == "ldirty":
|
|
||||||
self.after(_base_values.ldelay, self.upd_levels)
|
|
||||||
|
|
||||||
|
|
||||||
class Bus(ChannelLabelFrame):
|
class Bus(ChannelLabelFrame):
|
||||||
@ -185,14 +188,10 @@ class Bus(ChannelLabelFrame):
|
|||||||
return getattr(_target, self.identifier)[self.index]
|
return getattr(_target, self.identifier)[self.index]
|
||||||
|
|
||||||
def upd_levels(self):
|
def upd_levels(self):
|
||||||
if self.target.levels.is_updated:
|
if self.index < self.parent.parent.kind.num_bus:
|
||||||
val = max(self.target.levels.all)
|
if self.target.levels.is_updated:
|
||||||
self.level.set((0 if self.mute.get() else 100 + val - 18))
|
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"""
|
|
||||||
if subject == "ldirty":
|
|
||||||
self.after(_base_values.ldelay, self.upd_levels)
|
|
||||||
|
|
||||||
|
|
||||||
class ChannelFrame(ttk.Frame):
|
class ChannelFrame(ttk.Frame):
|
||||||
@ -202,8 +201,6 @@ class ChannelFrame(ttk.Frame):
|
|||||||
self.id = id
|
self.id = id
|
||||||
self.phys_in, self.virt_in = parent.kind.ins
|
self.phys_in, self.virt_in = parent.kind.ins
|
||||||
self.phys_out, self.virt_out = parent.kind.outs
|
self.phys_out, self.virt_out = parent.kind.outs
|
||||||
|
|
||||||
# registers channelframe as pdirty observer
|
|
||||||
self.parent.subject.add(self)
|
self.parent.subject.add(self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -226,6 +223,11 @@ class ChannelFrame(ttk.Frame):
|
|||||||
if isinstance(frame, ttk.LabelFrame)
|
if isinstance(frame, ttk.LabelFrame)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def on_update(self, subject):
|
||||||
|
if subject == "pdirty":
|
||||||
|
for labelframe in self.labelframes:
|
||||||
|
labelframe.on_update("labelframe")
|
||||||
|
|
||||||
def grid_configure(self):
|
def grid_configure(self):
|
||||||
[
|
[
|
||||||
self.columnconfigure(i, minsize=_configuration.level_width)
|
self.columnconfigure(i, minsize=_configuration.level_width)
|
||||||
@ -233,18 +235,8 @@ class ChannelFrame(ttk.Frame):
|
|||||||
]
|
]
|
||||||
[self.rowconfigure(0, minsize=100) for i, _ in enumerate(self.labelframes)]
|
[self.rowconfigure(0, minsize=100) for i, _ in enumerate(self.labelframes)]
|
||||||
|
|
||||||
def upd_labelframe(self, labelframe):
|
|
||||||
labelframe.sync()
|
|
||||||
|
|
||||||
def on_update(self, subject):
|
|
||||||
"""update parameters"""
|
|
||||||
if subject == "pdirty":
|
|
||||||
for labelframe in self.labelframes:
|
|
||||||
self.after(1, self.upd_labelframe, labelframe)
|
|
||||||
|
|
||||||
def teardown(self):
|
def teardown(self):
|
||||||
# deregisters channelframe as pdirty observer
|
[self.parent.subject.remove(frame) for frame in self.labelframes]
|
||||||
|
|
||||||
self.parent.subject.remove(self)
|
self.parent.subject.remove(self)
|
||||||
self.destroy()
|
self.destroy()
|
||||||
setattr(self.parent, f"{self.identifier}_frame", None)
|
setattr(self.parent, f"{self.identifier}_frame", None)
|
||||||
@ -293,7 +285,7 @@ def _make_channelframe(parent, id):
|
|||||||
|
|
||||||
if id == "strip":
|
if id == "strip":
|
||||||
CHANNELFRAME_cls = type(
|
CHANNELFRAME_cls = type(
|
||||||
f"ChannelFrame{id.capitalize}",
|
f"ChannelFrame{id.capitalize()}",
|
||||||
(ChannelFrame,),
|
(ChannelFrame,),
|
||||||
{
|
{
|
||||||
"__init__": init_strip,
|
"__init__": init_strip,
|
||||||
@ -301,7 +293,7 @@ def _make_channelframe(parent, id):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
CHANNELFRAME_cls = type(
|
CHANNELFRAME_cls = type(
|
||||||
f"ChannelFrame{id.capitalize}",
|
f"ChannelFrame{id.capitalize()}",
|
||||||
(ChannelFrame,),
|
(ChannelFrame,),
|
||||||
{
|
{
|
||||||
"__init__": init_bus,
|
"__init__": init_bus,
|
||||||
|
@ -71,7 +71,7 @@ class Config(ttk.Frame):
|
|||||||
def on_update(self, subject):
|
def on_update(self, subject):
|
||||||
"""update parameters"""
|
"""update parameters"""
|
||||||
if subject == "pdirty":
|
if subject == "pdirty":
|
||||||
self.after(_base_values.pdelay, self.sync)
|
self.sync()
|
||||||
|
|
||||||
|
|
||||||
class StripConfig(Config):
|
class StripConfig(Config):
|
||||||
|
@ -51,10 +51,6 @@ class BaseValues(metaclass=SingletonMeta):
|
|||||||
dragging: bool = False
|
dragging: bool = False
|
||||||
# a vban connection established
|
# a vban connection established
|
||||||
vban_connected: bool = False
|
vban_connected: bool = False
|
||||||
# pdirty delay
|
|
||||||
pdelay: int = 1
|
|
||||||
# ldirty delay
|
|
||||||
ldelay: int = 5
|
|
||||||
|
|
||||||
|
|
||||||
_base_values = BaseValues()
|
_base_values = BaseValues()
|
||||||
|
@ -26,7 +26,8 @@ class GainLayer(ttk.LabelFrame):
|
|||||||
self.builder.add_scale()
|
self.builder.add_scale()
|
||||||
self.builder.add_gain_label()
|
self.builder.add_gain_label()
|
||||||
self.builder.add_on_button()
|
self.builder.add_on_button()
|
||||||
self.sync()
|
self.sync_params()
|
||||||
|
self.sync_labels()
|
||||||
self.grid_configure()
|
self.grid_configure()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -94,9 +95,13 @@ class GainLayer(ttk.LabelFrame):
|
|||||||
background=f'{"green" if self.on.get() else "white"}',
|
background=f'{"green" if self.on.get() else "white"}',
|
||||||
)
|
)
|
||||||
|
|
||||||
def sync(self):
|
def on_update(self, subject):
|
||||||
self.after(_base_values.pdelay, self.sync_params)
|
if subject == "ldirty":
|
||||||
self.after(100, self.sync_labels)
|
self.upd_levels()
|
||||||
|
elif subject == "pdirty":
|
||||||
|
self.sync_params()
|
||||||
|
elif subject == "labelframe":
|
||||||
|
self.after(5, self.sync_labels)
|
||||||
|
|
||||||
def sync_params(self):
|
def sync_params(self):
|
||||||
self.gain.set(self.getter("gain"))
|
self.gain.set(self.getter("gain"))
|
||||||
@ -142,11 +147,6 @@ class GainLayer(ttk.LabelFrame):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def on_update(self, subject):
|
|
||||||
"""update levels"""
|
|
||||||
if subject == "ldirty":
|
|
||||||
self.after(_base_values.ldelay, self.upd_levels)
|
|
||||||
|
|
||||||
def grid_configure(self):
|
def grid_configure(self):
|
||||||
[
|
[
|
||||||
child.grid_configure(padx=1, pady=1, sticky=(tk.N, tk.S, tk.W, tk.E))
|
child.grid_configure(padx=1, pady=1, sticky=(tk.N, tk.S, tk.W, tk.E))
|
||||||
@ -200,9 +200,6 @@ class SubMixFrame(ttk.Frame):
|
|||||||
else:
|
else:
|
||||||
self.grid(row=2, column=0, sticky=(tk.W))
|
self.grid(row=2, column=0, sticky=(tk.W))
|
||||||
|
|
||||||
# registers submixframe as pdirty observer
|
|
||||||
self.parent.subject.add(self)
|
|
||||||
|
|
||||||
self.grid_configure()
|
self.grid_configure()
|
||||||
"""
|
"""
|
||||||
Grids each labelframe, grid_removes any without a label
|
Grids each labelframe, grid_removes any without a label
|
||||||
@ -213,6 +210,8 @@ class SubMixFrame(ttk.Frame):
|
|||||||
self.columnconfigure(i, minsize=0)
|
self.columnconfigure(i, minsize=0)
|
||||||
labelframe.grid_remove()
|
labelframe.grid_remove()
|
||||||
|
|
||||||
|
self.parent.subject.add(self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def target(self):
|
def target(self):
|
||||||
"""returns the current interface"""
|
"""returns the current interface"""
|
||||||
@ -229,6 +228,11 @@ class SubMixFrame(ttk.Frame):
|
|||||||
if isinstance(frame, ttk.LabelFrame)
|
if isinstance(frame, ttk.LabelFrame)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def on_update(self, subject):
|
||||||
|
if subject == "pdirty":
|
||||||
|
for labelframe in self.labelframes:
|
||||||
|
labelframe.on_update("labelframe")
|
||||||
|
|
||||||
def grid_configure(self):
|
def grid_configure(self):
|
||||||
[
|
[
|
||||||
self.columnconfigure(i, minsize=_configuration.level_width)
|
self.columnconfigure(i, minsize=_configuration.level_width)
|
||||||
@ -239,15 +243,8 @@ class SubMixFrame(ttk.Frame):
|
|||||||
for i, _ in enumerate(self.labelframes)
|
for i, _ in enumerate(self.labelframes)
|
||||||
]
|
]
|
||||||
|
|
||||||
def upd_labelframe(self, labelframe):
|
|
||||||
labelframe.sync()
|
|
||||||
|
|
||||||
def on_update(self, subject):
|
|
||||||
if subject == "pdirty":
|
|
||||||
for labelframe in self.labelframes:
|
|
||||||
self.after(1, self.upd_labelframe, labelframe)
|
|
||||||
|
|
||||||
def teardown(self):
|
def teardown(self):
|
||||||
# deregisters submixframe as pdirty observer
|
# deregisters submixframe as pdirty observer
|
||||||
|
[self.parent.subject.remove(frame) for frame in self.gainlayers]
|
||||||
self.parent.subject.remove(self)
|
self.parent.subject.remove(self)
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
@ -75,13 +75,13 @@ class Navigation(ttk.Frame):
|
|||||||
self.parent.bus_frame = None
|
self.parent.bus_frame = None
|
||||||
self.channel_button["state"] = "normal"
|
self.channel_button["state"] = "normal"
|
||||||
|
|
||||||
if self.parent.submix_frame:
|
if self.parent.submix_frame:
|
||||||
self.parent.submix_frame.teardown()
|
self.parent.submix_frame.teardown()
|
||||||
self.submix.set(False)
|
self.submix.set(False)
|
||||||
if not _configuration.themes_enabled:
|
if not _configuration.themes_enabled:
|
||||||
self.styletable.configure(
|
self.styletable.configure(
|
||||||
f"Submix.TButton",
|
f"Submix.TButton",
|
||||||
background=f'{"purple" if self.submix.get() else "white"}',
|
background=f'{"purple" if self.submix.get() else "white"}',
|
||||||
)
|
)
|
||||||
|
|
||||||
self.extend_text.set("REDUCE" if self.extend.get() else "EXTEND")
|
self.extend_text.set("REDUCE" if self.extend.get() else "EXTEND")
|
||||||
|
Loading…
Reference in New Issue
Block a user