mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2025-06-27 06:40:23 +01:00
Got rid of error with channels and cells not being subscriptable, but now getting -3 error trying to set eq.channel[0].cell[0].on
This commit is contained in:
parent
f8f10e358f
commit
f702b4feb3
@ -88,6 +88,25 @@ class Bus(IRemote):
|
||||
|
||||
|
||||
class BusEQ(IRemote):
|
||||
@classmethod
|
||||
def make(cls, remote, i):
|
||||
"""
|
||||
Factory method for BusEQ.
|
||||
|
||||
Returns a BusEQ class.
|
||||
"""
|
||||
kls = (cls,)
|
||||
return type(
|
||||
'BusEQ',
|
||||
kls,
|
||||
{
|
||||
'channel': tuple(
|
||||
BusEQCh.make(remote, j)
|
||||
for j in range(remote.kind.channels)
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
@property
|
||||
def identifier(self) -> str:
|
||||
return f'Bus[{self.index}].eq'
|
||||
@ -109,15 +128,34 @@ class BusEQ(IRemote):
|
||||
self.setter('ab', 1 if val else 0)
|
||||
|
||||
class BusEQCh(IRemote):
|
||||
@classmethod
|
||||
def make(cls, remote, i):
|
||||
"""
|
||||
Factory method for Bus EQ channel.
|
||||
|
||||
Returns a BusEQCh class.
|
||||
"""
|
||||
kls = (cls,)
|
||||
return type(
|
||||
'BusEQCh',
|
||||
kls,
|
||||
{
|
||||
'cell': tuple(
|
||||
BusEQChCell(remote, k)
|
||||
for k in range(remote.kind.cells)
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
@property
|
||||
def identifier(self) -> str:
|
||||
return f'Bus[{self.index}].eq.channel[{self.index}]'
|
||||
return f'channel[{self.index}]'
|
||||
|
||||
|
||||
class BusEQChCell(IRemote):
|
||||
@property
|
||||
def identifier(self) -> str:
|
||||
return f'Bus[{self.index}].eq.channel[{self.index}].cell[{self.kndex}]'
|
||||
return f'cell[{self.index}]'
|
||||
|
||||
@property
|
||||
def on(self) -> bool:
|
||||
@ -300,20 +338,6 @@ def make_bus_level_map(kind):
|
||||
|
||||
_make_bus_level_maps = {kind.name: make_bus_level_map(kind) for kind in kinds.all}
|
||||
|
||||
def _make_bus_eq(remote, i):
|
||||
"""
|
||||
Factory function for bus.eq.
|
||||
|
||||
Returns a BusEQ class of a kind.
|
||||
"""
|
||||
return type(
|
||||
'BusEQ',
|
||||
(),
|
||||
{
|
||||
'channel': BusEQCh(remote, i)
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def _make_bus_mode_mixin():
|
||||
"""Creates a mixin of Bus Modes."""
|
||||
@ -379,14 +403,13 @@ def bus_factory(is_phys_bus, remote, i) -> Union[PhysicalBus, VirtualBus]:
|
||||
else VirtualBus.make(remote, i, remote.kind)
|
||||
)
|
||||
BUSMODEMIXIN_cls = _make_bus_mode_mixin()
|
||||
BUSEQ_cls = _make_bus_eq(remote, i)
|
||||
return type(
|
||||
f'{BUS_cls.__name__}{remote.kind}',
|
||||
(BUS_cls,),
|
||||
{
|
||||
'levels': BusLevel(remote, i),
|
||||
'mode': BUSMODEMIXIN_cls(remote, i),
|
||||
'eq': BUSEQ_cls,
|
||||
'eq': BusEQ.make(remote, i),
|
||||
},
|
||||
)(remote, i)
|
||||
|
||||
@ -398,29 +421,3 @@ def request_bus_obj(phys_bus, remote, i) -> Bus:
|
||||
Returns a reference to a bus subclass of a kind
|
||||
"""
|
||||
return bus_factory(phys_bus, remote, i)
|
||||
|
||||
def request_busCh_obj(channel, remote, i) -> BusEQCh:
|
||||
"""
|
||||
Bus EQ Channel entry point. Wraps factory method
|
||||
|
||||
Returns a reference to a bus EQ channel subcless of a kind
|
||||
"""
|
||||
kls = ()
|
||||
BusEQChCls = type('channel',kls,{})
|
||||
return type(
|
||||
f'{BusEQChCls.__name__}{remote.kind}',
|
||||
(BusEQChCls,){},
|
||||
)()
|
||||
|
||||
def request_busChCe_obj(cell, remote, i) -> BusEQChCell:
|
||||
"""
|
||||
Bus EQ Channel Cell entry point. Wraps factory method
|
||||
|
||||
Returns a reference to a bus EQ channel cell subcless of a kind
|
||||
"""
|
||||
kls = ()
|
||||
BusEQCellCls = type('cell',kls,{})
|
||||
return type(
|
||||
f'{BusEQCellCls.__name__}{remote.kind}',
|
||||
(BusEQCellCls,){},
|
||||
)()
|
||||
|
@ -6,8 +6,6 @@ from typing import Iterable
|
||||
|
||||
from . import misc
|
||||
from .bus import request_bus_obj as bus
|
||||
from .bus import request_busCh_obj as channel
|
||||
from .bus import request_busChCe_obj as cell
|
||||
from .command import Command
|
||||
from .config import request_config as configs
|
||||
from .device import Device
|
||||
@ -32,7 +30,7 @@ class FactoryBuilder:
|
||||
|
||||
BuilderProgress = IntEnum(
|
||||
'BuilderProgress',
|
||||
'strip bus channels cells command macrobutton vban device option recorder patch fx',
|
||||
'strip bus command macrobutton vban device option recorder patch fx',
|
||||
start=0,
|
||||
)
|
||||
|
||||
@ -42,8 +40,6 @@ class FactoryBuilder:
|
||||
self._info = (
|
||||
f'Finished building strips for {self._factory}',
|
||||
f'Finished building buses for {self._factory}',
|
||||
f'Finished building channels for {self._factory}',
|
||||
f'Finished building cells for {self._factory}',
|
||||
f'Finished building commands for {self._factory}',
|
||||
f'Finished building macrobuttons for {self._factory}',
|
||||
f'Finished building vban in/out streams for {self._factory}',
|
||||
@ -74,20 +70,6 @@ class FactoryBuilder:
|
||||
)
|
||||
return self
|
||||
|
||||
def make_channels(self):
|
||||
self._factory.channels = tuple(
|
||||
channel(i < self.kind.channels, self._factory, i)
|
||||
for i in range(self.kind.channels)
|
||||
)
|
||||
return self
|
||||
|
||||
def make_cells(self):
|
||||
self._factory.cells = tuple(
|
||||
cell(i < self.kind.cells, self._factory, i)
|
||||
for i in range(self.kind.cells)
|
||||
)
|
||||
return self
|
||||
|
||||
def make_command(self):
|
||||
self._factory.command = Command.make(self._factory)
|
||||
return self
|
||||
@ -144,8 +126,6 @@ class FactoryBase(Remote):
|
||||
self._steps = (
|
||||
self.builder.make_strip,
|
||||
self.builder.make_bus,
|
||||
self.builder.make_channels,
|
||||
self.builder.make_cells,
|
||||
self.builder.make_command,
|
||||
self.builder.make_macrobutton,
|
||||
self.builder.make_vban,
|
||||
|
@ -12,11 +12,9 @@ class IRemote(metaclass=ABCMeta):
|
||||
Provides some default implementation
|
||||
"""
|
||||
|
||||
def __init__(self, remote, index=None):#, jndex = None, kndex = None):
|
||||
def __init__(self, remote, index=None):
|
||||
self._remote = remote
|
||||
self.index = index
|
||||
#self.jndex = jndex
|
||||
#self.kndex = kndex
|
||||
self.logger = logger.getChild(self.__class__.__name__)
|
||||
|
||||
def getter(self, param, **kwargs):
|
||||
|
@ -65,14 +65,6 @@ class KindMapClass(metaclass=SingletonType):
|
||||
@property
|
||||
def num_bus_levels(self) -> int:
|
||||
return 8 * (self.phys_out + self.virt_out)
|
||||
|
||||
@property
|
||||
def num_bus_channels(self) -> int:
|
||||
return self.channels
|
||||
|
||||
@property
|
||||
def num_bus_cells(self) -> int:
|
||||
return self.cells
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.name.capitalize()
|
||||
@ -86,8 +78,8 @@ class BasicMap(KindMapClass):
|
||||
asio: tuple = (0, 0)
|
||||
insert: int = 0
|
||||
composite: int = 0
|
||||
channels: int = 8
|
||||
cells: int = 7
|
||||
channels: int = 0
|
||||
cells: int = 0
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@ -110,8 +102,8 @@ class PotatoMap(KindMapClass):
|
||||
asio: tuple = (10, 8)
|
||||
insert: int = 34
|
||||
composite: int = 8
|
||||
channels: int = 0
|
||||
cells: int = 0
|
||||
channels: int = 9
|
||||
cells: int = 7
|
||||
|
||||
|
||||
def kind_factory(kind_id):
|
||||
|
Loading…
x
Reference in New Issue
Block a user