mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2024-11-15 16:40:46 +00:00
add VmGUI class to misc.
lets you check if gui was launched by the api
This commit is contained in:
parent
b2005030f2
commit
59624ccb3e
@ -250,3 +250,19 @@ class Midi:
|
||||
|
||||
def _set(self, key: int, velocity: int):
|
||||
self.cache[key] = velocity
|
||||
|
||||
|
||||
class VmGui:
|
||||
_launched = None
|
||||
|
||||
@property
|
||||
def launched(self) -> bool:
|
||||
return self._launched
|
||||
|
||||
@launched.setter
|
||||
def launched(self, val: bool):
|
||||
self._launched = val
|
||||
|
||||
@property
|
||||
def launched_by_api(self):
|
||||
return not self.launched
|
||||
|
@ -10,7 +10,7 @@ from .error import CAPIError, VMError
|
||||
from .event import Event
|
||||
from .inst import bits
|
||||
from .kinds import KindId
|
||||
from .misc import Midi
|
||||
from .misc import Midi, VmGui
|
||||
from .subject import Subject
|
||||
from .updater import Producer, Updater
|
||||
from .util import grouper, polling, script
|
||||
@ -32,6 +32,7 @@ class Remote(CBindings):
|
||||
self.event = Event(
|
||||
{k: kwargs.pop(k) for k in ("pdirty", "mdirty", "midi", "ldirty")}
|
||||
)
|
||||
self.gui = VmGui()
|
||||
self.logger = logger.getChild(self.__class__.__name__)
|
||||
|
||||
for attr, val in kwargs.items():
|
||||
@ -63,8 +64,8 @@ class Remote(CBindings):
|
||||
|
||||
def login(self) -> NoReturn:
|
||||
"""Login to the API, initialize dirty parameters"""
|
||||
res = self.call(self.vm_login, ok=(0, 1))
|
||||
if res == 1:
|
||||
self.gui.launched = self.call(self.vm_login, ok=(0, 1)) == 0
|
||||
if not self.gui.launched:
|
||||
self.logger.info(
|
||||
"Voicemeeter engine running but GUI not launched. Launching the GUI now."
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user