mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2024-11-23 19:40:46 +00:00
add ButtonModes IntEnum to macrobutton
debug log getter,setter for macrobutton
This commit is contained in:
parent
bdf8dc489a
commit
7841dfe10f
@ -1,5 +1,13 @@
|
|||||||
|
from enum import IntEnum
|
||||||
|
|
||||||
from .iremote import IRemote
|
from .iremote import IRemote
|
||||||
|
|
||||||
|
ButtonModes = IntEnum(
|
||||||
|
"ButtonModes",
|
||||||
|
"state stateonly trigger",
|
||||||
|
start=1,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Adapter(IRemote):
|
class Adapter(IRemote):
|
||||||
"""Adapter to the common interface."""
|
"""Adapter to the common interface."""
|
||||||
@ -8,9 +16,13 @@ class Adapter(IRemote):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def getter(self, mode):
|
def getter(self, mode):
|
||||||
|
self.logger.debug(f"getter: button[{self.index}].{ButtonModes(mode).name}")
|
||||||
return self._remote.get_buttonstatus(self.index, mode)
|
return self._remote.get_buttonstatus(self.index, mode)
|
||||||
|
|
||||||
def setter(self, val, mode):
|
def setter(self, mode, val):
|
||||||
|
self.logger.debug(
|
||||||
|
f"setter: button[{self.index}].{ButtonModes(mode).name}={val}"
|
||||||
|
)
|
||||||
self._remote.set_buttonstatus(self.index, val, mode)
|
self._remote.set_buttonstatus(self.index, val, mode)
|
||||||
|
|
||||||
|
|
||||||
@ -22,24 +34,24 @@ class MacroButton(Adapter):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self) -> bool:
|
def state(self) -> bool:
|
||||||
return self.getter(1) == 1
|
return self.getter(ButtonModes.state) == 1
|
||||||
|
|
||||||
@state.setter
|
@state.setter
|
||||||
def state(self, val: bool):
|
def state(self, val: bool):
|
||||||
self.setter(1 if val else 0, 1)
|
self.setter(ButtonModes.state, 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stateonly(self) -> bool:
|
def stateonly(self) -> bool:
|
||||||
return self.getter(2) == 1
|
return self.getter(ButtonModes.stateonly) == 1
|
||||||
|
|
||||||
@stateonly.setter
|
@stateonly.setter
|
||||||
def stateonly(self, val: bool):
|
def stateonly(self, val: bool):
|
||||||
self.setter(1 if val else 0, 2)
|
self.setter(ButtonModes.stateonly, 1 if val else 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def trigger(self) -> bool:
|
def trigger(self) -> bool:
|
||||||
return self.getter(3) == 1
|
return self.getter(ButtonModes.trigger) == 1
|
||||||
|
|
||||||
@trigger.setter
|
@trigger.setter
|
||||||
def trigger(self, val: bool):
|
def trigger(self, val: bool):
|
||||||
self.setter(1 if val else 0, 3)
|
self.setter(ButtonModes.trigger, 1 if val else 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user