Compare commits

...

5 Commits

8 changed files with 36 additions and 40 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "voicemeeter-api"
version = "2.3.3"
version = "2.3.4"
description = "A Python wrapper for the Voiceemeter API"
authors = ["onyx-and-iris <code@onyxandiris.online>"]
license = "MIT"

View File

@ -32,29 +32,37 @@ class KindMapClass(metaclass=SingletonType):
insert: int
@property
def phys_in(self):
def phys_in(self) -> int:
return self.ins[0]
@property
def virt_in(self):
def virt_in(self) -> int:
return self.ins[-1]
@property
def phys_out(self):
def phys_out(self) -> int:
return self.outs[0]
@property
def virt_out(self):
def virt_out(self) -> int:
return self.outs[-1]
@property
def num_strip(self):
def num_strip(self) -> int:
return sum(self.ins)
@property
def num_bus(self):
def num_bus(self) -> int:
return sum(self.outs)
@property
def num_strip_levels(self) -> int:
return 2 * self.phys_in + 8 * self.virt_in
@property
def num_bus_levels(self) -> int:
return 8 * (self.phys_out + self.virt_out)
def __str__(self) -> str:
return self.name.capitalize()

View File

@ -25,7 +25,7 @@ class MacroButton(Adapter):
return self.getter(1) == 1
@state.setter
def state(self, val):
def state(self, val: bool):
self.setter(1 if val else 0, 1)
@property
@ -33,7 +33,7 @@ class MacroButton(Adapter):
return self.getter(2) == 1
@stateonly.setter
def stateonly(self, val):
def stateonly(self, val: bool):
self.setter(1 if val else 0, 2)
@property
@ -41,5 +41,5 @@ class MacroButton(Adapter):
return self.getter(3) == 1
@trigger.setter
def trigger(self, val):
def trigger(self, val: bool):
self.setter(1 if val else 0, 3)

View File

@ -1,4 +1,3 @@
import copy
import ctypes as ct
import logging
import time
@ -244,12 +243,9 @@ class Remote(CBindings):
return (
tuple(
self.get_level(self.strip_mode, i)
for i in range(2 * self.kind.phys_in + 8 * self.kind.virt_in)
),
tuple(
self.get_level(3, i)
for i in range(8 * (self.kind.phys_out + self.kind.virt_out))
for i in range(self.kind.num_strip_levels)
),
tuple(self.get_level(3, i) for i in range(self.kind.num_bus_levels)),
)
def get_midi_message(self):
@ -325,16 +321,16 @@ class Remote(CBindings):
self.apply(config)
self.logger.info(f"Profile '{name}' applied!")
def logout(self) -> NoReturn:
"""Wait for dirty parameters to clear, then logout of the API"""
time.sleep(0.1)
self.call(self.vm_logout)
self.logger.info(f"{type(self).__name__}: Successfully logged out of {self}")
def end_thread(self):
self.logger.debug("events thread shutdown started")
self.running = False
def logout(self) -> NoReturn:
"""Logout of the API"""
time.sleep(0.1)
self.call(self.vm_logout)
self.logger.info(f"{type(self).__name__}: Successfully logged out of {self}")
def __exit__(self, exc_type, exc_value, exc_traceback) -> NoReturn:
"""teardown procedures"""
self.end_thread()

View File

@ -364,7 +364,7 @@ class VirtualStrip(Strip):
self.setter("karaoke", val)
@property
def bass(self):
def bass(self) -> float:
return round(self.getter("EQGain1"), 1)
@bass.setter
@ -372,7 +372,7 @@ class VirtualStrip(Strip):
self.setter("EQGain1", val)
@property
def mid(self):
def mid(self) -> float:
return round(self.getter("EQGain2"), 1)
@mid.setter
@ -382,7 +382,7 @@ class VirtualStrip(Strip):
med = mid
@property
def treble(self):
def treble(self) -> float:
return round(self.getter("EQGain3"), 1)
high = treble

View File

@ -36,10 +36,8 @@ class Updater(threading.Thread):
super().__init__(name="updater", daemon=True)
self._remote = remote
self.queue = queue
self._remote._strip_comp = [False] * (
2 * self._remote.kind.phys_in + 8 * self._remote.kind.virt_in
)
self._remote._bus_comp = [False] * (self._remote.kind.num_bus * 8)
self._remote._strip_comp = [False] * (self._remote.kind.num_strip_levels)
self._remote._bus_comp = [False] * (self._remote.kind.num_bus_levels)
(
self._remote.cache["strip_level"],
self._remote.cache["bus_level"],

View File

@ -1,4 +1,3 @@
import copy
import functools
from itertools import zip_longest
from typing import Iterator

View File

@ -135,18 +135,15 @@ class VbanInstream(VbanStream):
class VbanAudioInstream(VbanInstream):
def __str__(self):
return f"{type(self).__name__}{self._remote.kind}{self.index}"
"""Represents a VBAN Audio Instream"""
class VbanMidiInstream(VbanInstream):
def __str__(self):
return f"{type(self).__name__}{self._remote.kind}{self.index}"
"""Represents a VBAN Midi Instream"""
class VbanTextInstream(VbanInstream):
def __str__(self):
return f"{type(self).__name__}{self._remote.kind}{self.index}"
"""Represents a VBAN Text Instream"""
class VbanOutstream(VbanStream):
@ -165,13 +162,11 @@ class VbanOutstream(VbanStream):
class VbanAudioOutstream(VbanOutstream):
def __str__(self):
return f"{type(self).__name__}{self._remote.kind}{self.index}"
"""Represents a VBAN Audio Outstream"""
class VbanMidiOutstream(VbanOutstream):
def __str__(self):
return f"{type(self).__name__}{self._remote.kind}{self.index}"
"""Represents a VBAN Midi Outstream"""
def _make_stream_pair(remote, kind):