mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2024-11-15 16:40:46 +00:00
added strip/bus device mixins.
device_prop added to meta README, CHANGELOG updated to reflect changes. minor version bump fixes #3
This commit is contained in:
parent
816fd76213
commit
f4fc58cea0
22
CHANGELOG.md
22
CHANGELOG.md
@ -11,6 +11,28 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass
|
|||||||
|
|
||||||
- [x]
|
- [x]
|
||||||
|
|
||||||
|
## [0.9.0] - 2022-10-11
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- StripDevice and BusDevice mixins.
|
||||||
|
- README updated to reflect changes.
|
||||||
|
- Minor version bump
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- device, sr properties for physical strip, bus moved into mixin classes
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Event class property setters added.
|
||||||
|
- Event add/remove methods now accept multiple events.
|
||||||
|
- bus levels now printed in observer example.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- initialize channel comps in updater thread. Fixes bug when switching to a kind before any level updates have occurred.
|
||||||
|
|
||||||
## [0.8.0] - 2022-09-29
|
## [0.8.0] - 2022-09-29
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
25
README.md
25
README.md
@ -114,8 +114,6 @@ The following properties are available.
|
|||||||
- `limit`: int, from -40 to 12
|
- `limit`: int, from -40 to 12
|
||||||
- `A1 - A5`, `B1 - B3`: boolean
|
- `A1 - A5`, `B1 - B3`: boolean
|
||||||
- `label`: string
|
- `label`: string
|
||||||
- `device`: string
|
|
||||||
- `sr`: int
|
|
||||||
- `mc`: boolean
|
- `mc`: boolean
|
||||||
- `k`: int, from 0 to 4
|
- `k`: int, from 0 to 4
|
||||||
- `bass`: float, from -12.0 to 12.0
|
- `bass`: float, from -12.0 to 12.0
|
||||||
@ -199,8 +197,6 @@ The following properties are available.
|
|||||||
- `sel`: boolean
|
- `sel`: boolean
|
||||||
- `gain`: float, from -60.0 to 12.0
|
- `gain`: float, from -60.0 to 12.0
|
||||||
- `label`: string
|
- `label`: string
|
||||||
- `device`: string
|
|
||||||
- `sr`: int
|
|
||||||
- `returnreverb`: float, from 0.0 to 10.0
|
- `returnreverb`: float, from 0.0 to 10.0
|
||||||
- `returndelay`: float, from 0.0 to 10.0
|
- `returndelay`: float, from 0.0 to 10.0
|
||||||
- `returnfx1`: float, from 0.0 to 10.0
|
- `returnfx1`: float, from 0.0 to 10.0
|
||||||
@ -274,6 +270,27 @@ vm.strip[0].fadeto(-10.3, 1000)
|
|||||||
vm.bus[3].fadeby(-5.6, 500)
|
vm.bus[3].fadeby(-5.6, 500)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Strip.Device | Bus.Device
|
||||||
|
|
||||||
|
The following properties are available
|
||||||
|
|
||||||
|
- `name`: str
|
||||||
|
- `sr`: int
|
||||||
|
- `wdm`: str
|
||||||
|
- `ks`: str
|
||||||
|
- `mme`: str
|
||||||
|
- `asio`: str
|
||||||
|
|
||||||
|
example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
print(vm.strip[0].device.name)
|
||||||
|
vm.bus[0].device.asio = "Audient USB Audio ASIO Driver"
|
||||||
|
```
|
||||||
|
|
||||||
|
strip|bus device parameters are defined for physical channels only.
|
||||||
|
name, sr are read only. wdm, ks, mme, asio are write only.
|
||||||
|
|
||||||
### Macrobuttons
|
### Macrobuttons
|
||||||
|
|
||||||
The following properties are available.
|
The following properties are available.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "voicemeeter-api"
|
name = "voicemeeter-api"
|
||||||
version = "0.8.4"
|
version = "0.9.0"
|
||||||
description = "A Python wrapper for the Voiceemeter API"
|
description = "A Python wrapper for the Voiceemeter API"
|
||||||
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -4,10 +4,9 @@ from enum import IntEnum
|
|||||||
from math import log
|
from math import log
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from .error import VMError
|
|
||||||
from .iremote import IRemote
|
from .iremote import IRemote
|
||||||
from .kinds import kinds_all
|
from .kinds import kinds_all
|
||||||
from .meta import bool_prop, bus_mode_prop, float_prop
|
from .meta import bus_mode_prop, device_prop, float_prop
|
||||||
|
|
||||||
BusModes = IntEnum(
|
BusModes = IntEnum(
|
||||||
"BusModes",
|
"BusModes",
|
||||||
@ -106,7 +105,7 @@ class Bus(IRemote):
|
|||||||
|
|
||||||
class PhysicalBus(Bus):
|
class PhysicalBus(Bus):
|
||||||
@classmethod
|
@classmethod
|
||||||
def make(cls, kind):
|
def make(cls, remote, i, kind):
|
||||||
"""
|
"""
|
||||||
Factory method for PhysicalBus.
|
Factory method for PhysicalBus.
|
||||||
|
|
||||||
@ -116,18 +115,54 @@ class PhysicalBus(Bus):
|
|||||||
if kind.name == "potato":
|
if kind.name == "potato":
|
||||||
EFFECTS_cls = _make_effects_mixin()
|
EFFECTS_cls = _make_effects_mixin()
|
||||||
kls += (EFFECTS_cls,)
|
kls += (EFFECTS_cls,)
|
||||||
return type("PhysicalBus", kls, {})
|
return type(
|
||||||
|
"PhysicalBus",
|
||||||
|
kls,
|
||||||
|
{
|
||||||
|
"device": BusDevice.make(remote, i),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}{self.index}"
|
return f"{type(self).__name__}{self.index}"
|
||||||
|
|
||||||
@property
|
|
||||||
def device(self) -> str:
|
class BusDevice(IRemote):
|
||||||
return self.getter("device.name", is_string=True)
|
@classmethod
|
||||||
|
def make(cls, remote, i):
|
||||||
|
"""
|
||||||
|
Factory function for bus.device.
|
||||||
|
|
||||||
|
Returns a BusDevice class of a kind.
|
||||||
|
"""
|
||||||
|
DEVICE_cls = type(
|
||||||
|
f"BusDevice{remote.kind}",
|
||||||
|
(cls,),
|
||||||
|
{
|
||||||
|
**{
|
||||||
|
param: device_prop(param)
|
||||||
|
for param in [
|
||||||
|
"wdm",
|
||||||
|
"ks",
|
||||||
|
"mme",
|
||||||
|
"asio",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return DEVICE_cls(remote, i)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sr(self) -> int:
|
def identifier(self) -> str:
|
||||||
return int(self.getter("device.sr"))
|
return f"Bus[{self.index}].device"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self):
|
||||||
|
return self.getter("name", is_string=True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def sr(self):
|
||||||
|
return int(self.getter("sr"))
|
||||||
|
|
||||||
|
|
||||||
class VirtualBus(Bus):
|
class VirtualBus(Bus):
|
||||||
@ -263,7 +298,9 @@ def bus_factory(is_phys_bus, remote, i) -> Union[PhysicalBus, VirtualBus]:
|
|||||||
Returns a physical or virtual bus subclass
|
Returns a physical or virtual bus subclass
|
||||||
"""
|
"""
|
||||||
BUS_cls = (
|
BUS_cls = (
|
||||||
PhysicalBus.make(remote.kind) if is_phys_bus else VirtualBus.make(remote.kind)
|
PhysicalBus.make(remote, i, remote.kind)
|
||||||
|
if is_phys_bus
|
||||||
|
else VirtualBus.make(remote.kind)
|
||||||
)
|
)
|
||||||
BUSMODEMIXIN_cls = _make_bus_mode_mixin()
|
BUSMODEMIXIN_cls = _make_bus_mode_mixin()
|
||||||
return type(
|
return type(
|
||||||
|
@ -42,3 +42,12 @@ def bus_mode_prop(param):
|
|||||||
self.setter(param, 1 if val else 0)
|
self.setter(param, 1 if val else 0)
|
||||||
|
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
|
|
||||||
|
|
||||||
|
def device_prop(param):
|
||||||
|
"""meta function for strip device parameters"""
|
||||||
|
|
||||||
|
def fset(self, val: str):
|
||||||
|
self.setter(param, val)
|
||||||
|
|
||||||
|
return property(fset=fset)
|
||||||
|
@ -5,7 +5,7 @@ from typing import Union
|
|||||||
|
|
||||||
from .iremote import IRemote
|
from .iremote import IRemote
|
||||||
from .kinds import kinds_all
|
from .kinds import kinds_all
|
||||||
from .meta import bool_prop, float_prop
|
from .meta import bool_prop, device_prop, float_prop
|
||||||
|
|
||||||
|
|
||||||
class Strip(IRemote):
|
class Strip(IRemote):
|
||||||
@ -82,14 +82,20 @@ class Strip(IRemote):
|
|||||||
|
|
||||||
class PhysicalStrip(Strip):
|
class PhysicalStrip(Strip):
|
||||||
@classmethod
|
@classmethod
|
||||||
def make(cls, kind):
|
def make(cls, remote, i, kind):
|
||||||
"""
|
"""
|
||||||
Factory method for PhysicalStrip.
|
Factory method for PhysicalStrip.
|
||||||
|
|
||||||
Returns a PhysicalStrip class.
|
Returns a PhysicalStrip class.
|
||||||
"""
|
"""
|
||||||
EFFECTS_cls = _make_effects_mixins[kind.name]
|
EFFECTS_cls = _make_effects_mixins[kind.name]
|
||||||
return type(f"PhysicalStrip", (cls, EFFECTS_cls), {})
|
return type(
|
||||||
|
f"PhysicalStrip",
|
||||||
|
(cls, EFFECTS_cls),
|
||||||
|
{
|
||||||
|
"device": StripDevice.make(remote, i),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{type(self).__name__}{self.index}"
|
return f"{type(self).__name__}{self.index}"
|
||||||
@ -118,13 +124,43 @@ class PhysicalStrip(Strip):
|
|||||||
def audibility(self, val: float):
|
def audibility(self, val: float):
|
||||||
self.setter("audibility", val)
|
self.setter("audibility", val)
|
||||||
|
|
||||||
|
|
||||||
|
class StripDevice(IRemote):
|
||||||
|
@classmethod
|
||||||
|
def make(cls, remote, i):
|
||||||
|
"""
|
||||||
|
Factory function for strip.device.
|
||||||
|
|
||||||
|
Returns a StripDevice class of a kind.
|
||||||
|
"""
|
||||||
|
DEVICE_cls = type(
|
||||||
|
f"StripDevice{remote.kind}",
|
||||||
|
(cls,),
|
||||||
|
{
|
||||||
|
**{
|
||||||
|
param: device_prop(param)
|
||||||
|
for param in [
|
||||||
|
"wdm",
|
||||||
|
"ks",
|
||||||
|
"mme",
|
||||||
|
"asio",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return DEVICE_cls(remote, i)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device(self):
|
def identifier(self) -> str:
|
||||||
return self.getter("device.name", is_string=True)
|
return f"Strip[{self.index}].device"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self):
|
||||||
|
return self.getter("name", is_string=True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sr(self):
|
def sr(self):
|
||||||
return int(self.getter("device.sr"))
|
return int(self.getter("sr"))
|
||||||
|
|
||||||
|
|
||||||
class VirtualStrip(Strip):
|
class VirtualStrip(Strip):
|
||||||
@ -358,7 +394,9 @@ def strip_factory(is_phys_strip, remote, i) -> Union[PhysicalStrip, VirtualStrip
|
|||||||
|
|
||||||
Returns a physical or virtual strip subclass
|
Returns a physical or virtual strip subclass
|
||||||
"""
|
"""
|
||||||
STRIP_cls = PhysicalStrip.make(remote.kind) if is_phys_strip else VirtualStrip
|
STRIP_cls = (
|
||||||
|
PhysicalStrip.make(remote, i, remote.kind) if is_phys_strip else VirtualStrip
|
||||||
|
)
|
||||||
CHANNELOUTMIXIN_cls = _make_channelout_mixins[remote.kind.name]
|
CHANNELOUTMIXIN_cls = _make_channelout_mixins[remote.kind.name]
|
||||||
|
|
||||||
_kls = (STRIP_cls, CHANNELOUTMIXIN_cls)
|
_kls = (STRIP_cls, CHANNELOUTMIXIN_cls)
|
||||||
|
Loading…
Reference in New Issue
Block a user