mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2025-04-04 12:43:52 +01:00
Compare commits
5 Commits
68177c3c6c
...
160a6f89f9
Author | SHA1 | Date | |
---|---|---|---|
160a6f89f9 | |||
4fcb2f93ca | |||
8acd0b1385 | |||
89866bb87b | |||
f996fc0d9c |
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "voicemeeter-api"
|
name = "voicemeeter-api"
|
||||||
version = "2.3.3"
|
version = "2.3.4"
|
||||||
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"
|
||||||
|
@ -32,29 +32,37 @@ class KindMapClass(metaclass=SingletonType):
|
|||||||
insert: int
|
insert: int
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def phys_in(self):
|
def phys_in(self) -> int:
|
||||||
return self.ins[0]
|
return self.ins[0]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def virt_in(self):
|
def virt_in(self) -> int:
|
||||||
return self.ins[-1]
|
return self.ins[-1]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def phys_out(self):
|
def phys_out(self) -> int:
|
||||||
return self.outs[0]
|
return self.outs[0]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def virt_out(self):
|
def virt_out(self) -> int:
|
||||||
return self.outs[-1]
|
return self.outs[-1]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def num_strip(self):
|
def num_strip(self) -> int:
|
||||||
return sum(self.ins)
|
return sum(self.ins)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def num_bus(self):
|
def num_bus(self) -> int:
|
||||||
return sum(self.outs)
|
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:
|
def __str__(self) -> str:
|
||||||
return self.name.capitalize()
|
return self.name.capitalize()
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class MacroButton(Adapter):
|
|||||||
return self.getter(1) == 1
|
return self.getter(1) == 1
|
||||||
|
|
||||||
@state.setter
|
@state.setter
|
||||||
def state(self, val):
|
def state(self, val: bool):
|
||||||
self.setter(1 if val else 0, 1)
|
self.setter(1 if val else 0, 1)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -33,7 +33,7 @@ class MacroButton(Adapter):
|
|||||||
return self.getter(2) == 1
|
return self.getter(2) == 1
|
||||||
|
|
||||||
@stateonly.setter
|
@stateonly.setter
|
||||||
def stateonly(self, val):
|
def stateonly(self, val: bool):
|
||||||
self.setter(1 if val else 0, 2)
|
self.setter(1 if val else 0, 2)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -41,5 +41,5 @@ class MacroButton(Adapter):
|
|||||||
return self.getter(3) == 1
|
return self.getter(3) == 1
|
||||||
|
|
||||||
@trigger.setter
|
@trigger.setter
|
||||||
def trigger(self, val):
|
def trigger(self, val: bool):
|
||||||
self.setter(1 if val else 0, 3)
|
self.setter(1 if val else 0, 3)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import copy
|
|
||||||
import ctypes as ct
|
import ctypes as ct
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
@ -244,12 +243,9 @@ class Remote(CBindings):
|
|||||||
return (
|
return (
|
||||||
tuple(
|
tuple(
|
||||||
self.get_level(self.strip_mode, i)
|
self.get_level(self.strip_mode, i)
|
||||||
for i in range(2 * self.kind.phys_in + 8 * self.kind.virt_in)
|
for i in range(self.kind.num_strip_levels)
|
||||||
),
|
|
||||||
tuple(
|
|
||||||
self.get_level(3, i)
|
|
||||||
for i in range(8 * (self.kind.phys_out + self.kind.virt_out))
|
|
||||||
),
|
),
|
||||||
|
tuple(self.get_level(3, i) for i in range(self.kind.num_bus_levels)),
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_midi_message(self):
|
def get_midi_message(self):
|
||||||
@ -325,16 +321,16 @@ class Remote(CBindings):
|
|||||||
self.apply(config)
|
self.apply(config)
|
||||||
self.logger.info(f"Profile '{name}' applied!")
|
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):
|
def end_thread(self):
|
||||||
self.logger.debug("events thread shutdown started")
|
self.logger.debug("events thread shutdown started")
|
||||||
self.running = False
|
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:
|
def __exit__(self, exc_type, exc_value, exc_traceback) -> NoReturn:
|
||||||
"""teardown procedures"""
|
"""teardown procedures"""
|
||||||
self.end_thread()
|
self.end_thread()
|
||||||
|
@ -364,7 +364,7 @@ class VirtualStrip(Strip):
|
|||||||
self.setter("karaoke", val)
|
self.setter("karaoke", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bass(self):
|
def bass(self) -> float:
|
||||||
return round(self.getter("EQGain1"), 1)
|
return round(self.getter("EQGain1"), 1)
|
||||||
|
|
||||||
@bass.setter
|
@bass.setter
|
||||||
@ -372,7 +372,7 @@ class VirtualStrip(Strip):
|
|||||||
self.setter("EQGain1", val)
|
self.setter("EQGain1", val)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mid(self):
|
def mid(self) -> float:
|
||||||
return round(self.getter("EQGain2"), 1)
|
return round(self.getter("EQGain2"), 1)
|
||||||
|
|
||||||
@mid.setter
|
@mid.setter
|
||||||
@ -382,7 +382,7 @@ class VirtualStrip(Strip):
|
|||||||
med = mid
|
med = mid
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def treble(self):
|
def treble(self) -> float:
|
||||||
return round(self.getter("EQGain3"), 1)
|
return round(self.getter("EQGain3"), 1)
|
||||||
|
|
||||||
high = treble
|
high = treble
|
||||||
|
@ -36,10 +36,8 @@ class Updater(threading.Thread):
|
|||||||
super().__init__(name="updater", daemon=True)
|
super().__init__(name="updater", daemon=True)
|
||||||
self._remote = remote
|
self._remote = remote
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self._remote._strip_comp = [False] * (
|
self._remote._strip_comp = [False] * (self._remote.kind.num_strip_levels)
|
||||||
2 * self._remote.kind.phys_in + 8 * self._remote.kind.virt_in
|
self._remote._bus_comp = [False] * (self._remote.kind.num_bus_levels)
|
||||||
)
|
|
||||||
self._remote._bus_comp = [False] * (self._remote.kind.num_bus * 8)
|
|
||||||
(
|
(
|
||||||
self._remote.cache["strip_level"],
|
self._remote.cache["strip_level"],
|
||||||
self._remote.cache["bus_level"],
|
self._remote.cache["bus_level"],
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import copy
|
|
||||||
import functools
|
import functools
|
||||||
from itertools import zip_longest
|
from itertools import zip_longest
|
||||||
from typing import Iterator
|
from typing import Iterator
|
||||||
|
@ -135,18 +135,15 @@ class VbanInstream(VbanStream):
|
|||||||
|
|
||||||
|
|
||||||
class VbanAudioInstream(VbanInstream):
|
class VbanAudioInstream(VbanInstream):
|
||||||
def __str__(self):
|
"""Represents a VBAN Audio Instream"""
|
||||||
return f"{type(self).__name__}{self._remote.kind}{self.index}"
|
|
||||||
|
|
||||||
|
|
||||||
class VbanMidiInstream(VbanInstream):
|
class VbanMidiInstream(VbanInstream):
|
||||||
def __str__(self):
|
"""Represents a VBAN Midi Instream"""
|
||||||
return f"{type(self).__name__}{self._remote.kind}{self.index}"
|
|
||||||
|
|
||||||
|
|
||||||
class VbanTextInstream(VbanInstream):
|
class VbanTextInstream(VbanInstream):
|
||||||
def __str__(self):
|
"""Represents a VBAN Text Instream"""
|
||||||
return f"{type(self).__name__}{self._remote.kind}{self.index}"
|
|
||||||
|
|
||||||
|
|
||||||
class VbanOutstream(VbanStream):
|
class VbanOutstream(VbanStream):
|
||||||
@ -165,13 +162,11 @@ class VbanOutstream(VbanStream):
|
|||||||
|
|
||||||
|
|
||||||
class VbanAudioOutstream(VbanOutstream):
|
class VbanAudioOutstream(VbanOutstream):
|
||||||
def __str__(self):
|
"""Represents a VBAN Audio Outstream"""
|
||||||
return f"{type(self).__name__}{self._remote.kind}{self.index}"
|
|
||||||
|
|
||||||
|
|
||||||
class VbanMidiOutstream(VbanOutstream):
|
class VbanMidiOutstream(VbanOutstream):
|
||||||
def __str__(self):
|
"""Represents a VBAN Midi Outstream"""
|
||||||
return f"{type(self).__name__}{self._remote.kind}{self.index}"
|
|
||||||
|
|
||||||
|
|
||||||
def _make_stream_pair(remote, kind):
|
def _make_stream_pair(remote, kind):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user