From a9103ca1f4bd93886cf6f3682668e8a94090b87b Mon Sep 17 00:00:00 2001 From: 3ll3d00d Date: Sun, 4 Aug 2024 12:01:03 +0100 Subject: [PATCH] fix bad upload --- README.md | 8 ++++-- examples/ezbeq_named.yml | 3 +++ ezbeq/minidsp.py | 46 +++++++++++++++++++------------- pyproject.toml | 2 +- ui/src/components/main/Slots.jsx | 2 +- 5 files changed, 39 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 8af2093..36f55ba 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ See [examples](examples) |-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Camilla DSP | [ezbeq_cdsp.yml](examples/ezbeq_cdsp.yml) | | J River Media Center | [ezbeq_mc.yml](examples/ezbeq_mc.yml) | -| Minidsp 2x4HD | [ezbeq_md.yml](examples/ezbeq_md.yml) or [using multiple devices](examples/ezbeq_md2.yml) | +| Minidsp 2x4HD | [ezbeq_md.yml](examples/ezbeq_md.yml), [using multiple devices](examples/ezbeq_md2.yml) or [with custom slot names](examples/ezbeq_named.yml) | | Minidsp 4x10 | [ezbeq_4x10.yml](examples/ezbeq_4x10.yml) | | Minidsp 10x10 | [without use of XO](examples/ezbeq_10x10.yml), [with](examples/ezbeq_10x10_xo.yml) or [using a custom mapping across input, output and xo](examples/ezbeq_10x10_custom.yml) | | Minidsp DDRC-24 | [ezbeq_ddrc24.yml](examples/ezbeq_ddrc24.yml) | @@ -150,7 +150,11 @@ Using, and controlling, multiple devices independently is supported but does req For reference, a community provided example configuration guide can be found via [avs](https://www.avsforum.com/threads/ezbeq-use-and-development-discussion.3181732/page-170#post-62257128) -A full list of supported models is provided below. +##### Naming Slots + +By default, the slots are numbered 1-4 as per the minidsp console. + +To override, extend the device configuration with the `slotNames` key. It is not necessary to list every slot, just those that require an explicit name. ##### Minidsp Variants diff --git a/examples/ezbeq_named.yml b/examples/ezbeq_named.yml index 76c95d3..73b19e2 100644 --- a/examples/ezbeq_named.yml +++ b/examples/ezbeq_named.yml @@ -6,4 +6,7 @@ devices: exe: minidsp options: '' type: minidsp + slotNames: + 1: Hot + 3: Normal port: 8080 diff --git a/ezbeq/minidsp.py b/ezbeq/minidsp.py index 8748e47..b0268db 100644 --- a/ezbeq/minidsp.py +++ b/ezbeq/minidsp.py @@ -38,7 +38,9 @@ def __init__(self, name: str, descriptor: 'MinidspDescriptor', **kwargs): MinidspSlotState(c_id, c_id == self.active_slot, 0 if not descriptor.input else len(descriptor.input.channels), - 0 if not descriptor.output else len(descriptor.output.channels)) for c_id in slot_ids + 0 if not descriptor.output else len(descriptor.output.channels), + slot_name=descriptor.slot_names.get(c_id, None)) + for c_id in slot_ids ] def update_master_state(self, mute: bool, gain: float): @@ -118,13 +120,14 @@ def merge_with(self, cached: dict) -> None: class MinidspSlotState(SlotState['MinidspSlotState']): - def __init__(self, slot_id: str, active: bool, input_channels: int, output_channels: int): + def __init__(self, slot_id: str, active: bool, input_channels: int, output_channels: int, slot_name: str = None): super().__init__(slot_id) self.__input_channels = input_channels self.__output_channels = output_channels self.gains = self.__make_vals(0.0) self.mutes = self.__make_vals(False) self.active = active + self.slot_name = slot_name def clear(self): super().clear() @@ -177,13 +180,15 @@ def merge_with(self, state: dict) -> None: def as_dict(self) -> dict: sup = super().as_dict() + if self.slot_name: + sup['name'] = self.slot_name return { **sup, 'gains': self.gains, 'mutes': self.mutes, 'canActivate': True, 'inputs': self.__input_channels, - 'outputs': self.__output_channels + 'outputs': self.__output_channels, } def __repr__(self): @@ -256,13 +261,14 @@ def __repr__(self): class MinidspDescriptor: def __init__(self, name: str, fs: str, i: Optional[PeqRoutes] = None, xo: Optional[PeqRoutes] = None, - o: Optional[PeqRoutes] = None, extra: List[PeqRoutes] = None): + o: Optional[PeqRoutes] = None, extra: List[PeqRoutes] = None, slot_names: dict[str, str] = None): self.name = name self.fs = str(int(fs)) self.input = i self.crossover = xo self.output = o self.extra = extra + self.slot_names = slot_names if slot_names else {} @property def peq_routes(self) -> List[PeqRoutes]: @@ -280,6 +286,8 @@ def __repr__(self): s = f"{s}, crossovers: {self.crossover}" if self.output: s = f"{s}, outputs: {self.output}" + if self.slot_names: + s = f"{s}, slot_names: {self.slot_names}" return s @@ -289,17 +297,18 @@ def zero_til(count: int) -> List[int]: class Minidsp24HD(MinidspDescriptor): - def __init__(self): + def __init__(self, slot_names: dict[str, str] = None): super().__init__('2x4HD', '96000', i=PeqRoutes(INPUT_NAME, 10, zero_til(2), zero_til(10)), xo=PeqRoutes(CROSSOVER_NAME, 4, zero_til(4), [], groups=zero_til(2)), - o=PeqRoutes(OUTPUT_NAME, 10, zero_til(4), [])) + o=PeqRoutes(OUTPUT_NAME, 10, zero_til(4), []), + slot_names=slot_names) class MinidspDDRC24(MinidspDescriptor): - def __init__(self): + def __init__(self, slot_names: dict[str, str] = None): super().__init__('DDRC24', '48000', xo=PeqRoutes(CROSSOVER_NAME, 4, zero_til(4), [], zero_til(2)), @@ -308,7 +317,7 @@ def __init__(self): class MinidspDDRC88(MinidspDescriptor): - def __init__(self, sw_channels: List[int] = None): + def __init__(self, slot_names: dict[str, str] = None, sw_channels: List[int] = None): c = sw_channels if sw_channels is not None else [3] if any(ch for ch in c if ch < 0 or ch > 7): raise ValueError(f"Invalid channels {c}") @@ -322,7 +331,7 @@ def __init__(self, sw_channels: List[int] = None): class Minidsp410(MinidspDescriptor): - def __init__(self): + def __init__(self, slot_names: dict[str, str] = None): super().__init__('4x10', '96000', i=PeqRoutes(INPUT_NAME, 5, zero_til(2), zero_til(5)), @@ -331,7 +340,7 @@ def __init__(self): class Minidsp1010(MinidspDescriptor): - def __init__(self, use_xo: Union[bool, int, str]): + def __init__(self, use_xo: Union[bool, int, str], slot_names: dict[str, str] = None): if use_xo is True: secondary = {'xo': PeqRoutes(CROSSOVER_NAME, 4, zero_til(8), zero_til(4), groups=[0])} elif use_xo is False: @@ -351,20 +360,21 @@ def __init__(self, use_xo: Union[bool, int, str]): def make_peq_layout(cfg: dict) -> MinidspDescriptor: + slot_names: dict[str, str] = {str(k): str(v) for k,v in cfg.get('slotNames', {}).items()} if 'device_type' in cfg: device_type = cfg['device_type'] if device_type == '24HD': - return Minidsp24HD() + return Minidsp24HD(slot_names=slot_names) elif device_type == 'DDRC24': - return MinidspDDRC24() + return MinidspDDRC24(slot_names=slot_names) elif device_type == 'DDRC88': - return MinidspDDRC88(sw_channels=cfg.get('sw_channels', None)) + return MinidspDDRC88(sw_channels=cfg.get('sw_channels', None), slot_names=slot_names) elif device_type == '4x10': - return Minidsp410() + return Minidsp410(slot_names=slot_names) elif device_type == '10x10': - return Minidsp1010(cfg.get('use_xo', False)) + return Minidsp1010(cfg.get('use_xo', False), slot_names=slot_names) elif device_type == 'SHD': - return MinidspDDRC24() + return MinidspDDRC24(slot_names=slot_names) elif 'descriptor' in cfg: desc: dict = cfg['descriptor'] named_args = ['name', 'fs', 'routes'] @@ -408,9 +418,9 @@ def to_ints(v): extra.append(route) if extra: routes_by_name['extra'] = extra - return MinidspDescriptor(desc['name'], str(desc['fs']), **routes_by_name) + return MinidspDescriptor(desc['name'], str(desc['fs']), **routes_by_name, slot_names=slot_names) else: - return Minidsp24HD() + return Minidsp24HD(slot_names=slot_names) class Minidsp(PersistentDevice[MinidspState]): diff --git a/pyproject.toml b/pyproject.toml index 3aee54f..9d1f69e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ezbeq" -version = "2.1.0a7" +version = "2.1.0a9" description = "A webapp which can send beqcatalogue filters to a DSP device" authors = ["3ll3d00d "] license = "MIT" diff --git a/ui/src/components/main/Slots.jsx b/ui/src/components/main/Slots.jsx index e768d70..100a125 100644 --- a/ui/src/components/main/Slots.jsx +++ b/ui/src/components/main/Slots.jsx @@ -59,7 +59,7 @@ const Slot = ({selected, slot, onSelect, isPending, onClear}) => { - {slot.id}: {slot.last}{last_author} + {slot.name ? slot.name : slot.id}: {slot.last}{last_author}