mirror of
https://github.com/onyx-and-iris/voicemeeter-compact.git
synced 2026-03-12 05:09:12 +00:00
ensure we get the right bus modes according to the kind
This commit is contained in:
parent
b0d7d734fb
commit
d903faecd9
@ -6,10 +6,11 @@ from tkinter import messagebox, ttk
|
|||||||
from typing import NamedTuple
|
from typing import NamedTuple
|
||||||
|
|
||||||
import voicemeeterlib
|
import voicemeeterlib
|
||||||
|
from voicemeeterlib import kinds
|
||||||
|
|
||||||
from .builders import MainFrameBuilder
|
from .builders import MainFrameBuilder
|
||||||
from .configurations import loader
|
from .configurations import loader
|
||||||
from .data import _base_values, _configuration, _kinds_all, get_configuration
|
from .data import _base_values, _configuration, get_configuration
|
||||||
from .errors import VMCompactError
|
from .errors import VMCompactError
|
||||||
from .menu import Menus
|
from .menu import Menus
|
||||||
from .subject import Subject
|
from .subject import Subject
|
||||||
@ -198,7 +199,7 @@ class App(tk.Tk):
|
|||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
||||||
|
|
||||||
_apps = {kind.name: App.make(kind) for kind in _kinds_all}
|
_apps = {kind.name: App.make(kind) for kind in kinds.all}
|
||||||
|
|
||||||
|
|
||||||
def connect(kind_id: str, vmr, theme=None) -> App:
|
def connect(kind_id: str, vmr, theme=None) -> App:
|
||||||
|
|||||||
@ -6,6 +6,7 @@ from tkinter import ttk
|
|||||||
|
|
||||||
import sv_ttk
|
import sv_ttk
|
||||||
|
|
||||||
|
from . import util
|
||||||
from .banner import Banner
|
from .banner import Banner
|
||||||
from .channels import _make_channelframe
|
from .channels import _make_channelframe
|
||||||
from .config import BusConfig, StripConfig
|
from .config import BusConfig, StripConfig
|
||||||
@ -561,31 +562,22 @@ class StripConfigFrameBuilder(ChannelConfigFrameBuilder):
|
|||||||
class BusConfigFrameBuilder(ChannelConfigFrameBuilder):
|
class BusConfigFrameBuilder(ChannelConfigFrameBuilder):
|
||||||
"""Responsible for building channel configframe widgets"""
|
"""Responsible for building channel configframe widgets"""
|
||||||
|
|
||||||
|
def __init__(self, configframe, app):
|
||||||
|
super().__init__(configframe)
|
||||||
|
self.app = app
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
# fmt: off
|
self.configframe.bus_mode_map = util.get_busmode_fullnames(self.app.kind)
|
||||||
self.configframe.bus_mode_map = {
|
self.configframe.bus_mode_map_reverse = util.get_busmode_fullnames_reversed(
|
||||||
"normal": "Normal",
|
self.app.kind
|
||||||
"amix": "Mix Down A",
|
)
|
||||||
"bmix": "Mix Down B",
|
self.configframe.bus_modes = util.get_busmode_shortnames(self.app.kind)
|
||||||
"repeat": "Stereo Repeat",
|
|
||||||
"composite": "Composite",
|
|
||||||
"tvmix": "Up Mix TV",
|
|
||||||
"upmix21": "Up Mix 2.1",
|
|
||||||
"upmix41": "Up Mix 4.1",
|
|
||||||
"upmix61": "Up Mix 6.1",
|
|
||||||
"centeronly": "Center Only",
|
|
||||||
"lfeonly": "LFE Only",
|
|
||||||
"rearonly": "Rear Only",
|
|
||||||
}
|
|
||||||
self.configframe.bus_mode_map_reverse = {v: k for k, v in self.configframe.bus_mode_map.items()}
|
|
||||||
self.configframe.bus_modes = list(self.configframe.bus_mode_map.keys())
|
|
||||||
# fmt: on
|
|
||||||
self.configframe.int_params = ('mono',)
|
self.configframe.int_params = ('mono',)
|
||||||
self.configframe.int_param_vars = [
|
self.configframe.int_param_vars = [
|
||||||
tk.IntVar(value=getattr(self.configframe.target, param))
|
tk.IntVar(value=getattr(self.configframe.target, param))
|
||||||
for param in self.configframe.int_params
|
for param in self.configframe.int_params
|
||||||
]
|
]
|
||||||
self.configframe.mono_modes = ['mono: off', 'mono: on', 'stereo reverse']
|
self.configframe.mono_modes = util.get_busmono_modes()
|
||||||
self.configframe.bus_mono_label_text = tk.StringVar(
|
self.configframe.bus_mono_label_text = tk.StringVar(
|
||||||
value=self.configframe.mono_modes[self.configframe.target.mono]
|
value=self.configframe.mono_modes[self.configframe.target.mono]
|
||||||
)
|
)
|
||||||
|
|||||||
@ -217,7 +217,7 @@ class BusConfig(Config):
|
|||||||
self.grid(column=0, row=1, columnspan=4, padx=(2,))
|
self.grid(column=0, row=1, columnspan=4, padx=(2,))
|
||||||
else:
|
else:
|
||||||
self.grid(column=0, row=3, columnspan=4, padx=(2,))
|
self.grid(column=0, row=3, columnspan=4, padx=(2,))
|
||||||
self.builder = builders.BusConfigFrameBuilder(self)
|
self.builder = builders.BusConfigFrameBuilder(self, parent)
|
||||||
self.builder.setup()
|
self.builder.setup()
|
||||||
self.make_row_0()
|
self.make_row_0()
|
||||||
self.make_row_1()
|
self.make_row_1()
|
||||||
|
|||||||
@ -61,10 +61,6 @@ class BaseValues(metaclass=SingletonMeta):
|
|||||||
_base_values = BaseValues()
|
_base_values = BaseValues()
|
||||||
_configuration = Configurations()
|
_configuration = Configurations()
|
||||||
|
|
||||||
_kinds = {kind.name: kind for kind in kinds.kinds_all}
|
|
||||||
|
|
||||||
_kinds_all = _kinds.values()
|
|
||||||
|
|
||||||
|
|
||||||
def kind_get(kind_id):
|
def kind_get(kind_id):
|
||||||
return _kinds[kind_id]
|
return kinds.request_kind_map(kind_id)
|
||||||
|
|||||||
34
vmcompact/util.py
Normal file
34
vmcompact/util.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
def get_busmode_fullnames(kind) -> dict:
|
||||||
|
if kind.name == 'basic':
|
||||||
|
return {
|
||||||
|
'normal': 'Normal',
|
||||||
|
'amix': 'Mix Down A',
|
||||||
|
'repeat': 'Stereo Repeat',
|
||||||
|
'composite': 'Composite',
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
'normal': 'Normal',
|
||||||
|
'amix': 'Mix Down A',
|
||||||
|
'bmix': 'Mix Down B',
|
||||||
|
'repeat': 'Stereo Repeat',
|
||||||
|
'composite': 'Composite',
|
||||||
|
'tvmix': 'Up Mix TV',
|
||||||
|
'upmix21': 'Up Mix 2.1',
|
||||||
|
'upmix41': 'Up Mix 4.1',
|
||||||
|
'upmix61': 'Up Mix 6.1',
|
||||||
|
'centeronly': 'Center Only',
|
||||||
|
'lfeonly': 'LFE Only',
|
||||||
|
'rearonly': 'Rear Only',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def get_busmode_fullnames_reversed(kind) -> dict:
|
||||||
|
return {v: k for k, v in get_busmode_fullnames(kind).items()}
|
||||||
|
|
||||||
|
|
||||||
|
def get_busmode_shortnames(kind) -> list:
|
||||||
|
return list(get_busmode_fullnames(kind).keys())
|
||||||
|
|
||||||
|
|
||||||
|
def get_busmono_modes() -> list:
|
||||||
|
return ['mono: off', 'mono: on', 'stereo repeat']
|
||||||
Loading…
x
Reference in New Issue
Block a user