2023-09-23 22:55:58 +01:00
|
|
|
import ctypes as ct
|
2023-09-24 17:25:43 +01:00
|
|
|
from ctypes.wintypes import CHAR, FLOAT, LONG
|
2023-09-23 22:55:58 +01:00
|
|
|
|
2023-09-24 17:25:43 +01:00
|
|
|
from .cdll import libc
|
|
|
|
from .error import VMCAPIError
|
2023-09-23 22:55:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Binds:
|
2023-09-24 17:25:43 +01:00
|
|
|
bind_login = libc.VBVMR_Login
|
|
|
|
bind_login.restype = LONG
|
|
|
|
bind_login.argtypes = None
|
|
|
|
|
|
|
|
bind_logout = libc.VBVMR_Logout
|
|
|
|
bind_logout.restype = LONG
|
|
|
|
bind_logout.argtypes = None
|
|
|
|
|
|
|
|
bind_run_voicemeeter = libc.VBVMR_RunVoicemeeter
|
|
|
|
bind_run_voicemeeter.restype = LONG
|
|
|
|
bind_run_voicemeeter.argtypes = [LONG]
|
|
|
|
|
|
|
|
bind_get_voicemeeter_type = libc.VBVMR_GetVoicemeeterType
|
|
|
|
bind_get_voicemeeter_type.restype = LONG
|
|
|
|
bind_get_voicemeeter_type.argtypes = [ct.POINTER(LONG)]
|
|
|
|
|
|
|
|
bind_is_parameters_dirty = libc.VBVMR_IsParametersDirty
|
|
|
|
bind_is_parameters_dirty.restype = LONG
|
|
|
|
bind_is_parameters_dirty.argtypes = None
|
|
|
|
|
|
|
|
bind_get_parameter_float = libc.VBVMR_GetParameterFloat
|
|
|
|
bind_get_parameter_float.restype = LONG
|
|
|
|
bind_get_parameter_float.argtypes = [ct.POINTER(CHAR), ct.POINTER(FLOAT)]
|
|
|
|
|
|
|
|
bind_set_parameter_float = libc.VBVMR_SetParameterFloat
|
|
|
|
bind_set_parameter_float.restype = LONG
|
|
|
|
bind_set_parameter_float.argtypes = [ct.POINTER(CHAR), FLOAT]
|
2023-09-23 22:55:58 +01:00
|
|
|
|
|
|
|
def call(self, fn, *args, ok=(0,)):
|
2023-09-24 17:25:43 +01:00
|
|
|
retval = fn(*args)
|
2023-09-23 22:55:58 +01:00
|
|
|
if retval not in ok:
|
2023-09-24 18:31:06 +01:00
|
|
|
raise VMCAPIError(fn.__name__, retval)
|
2023-09-23 22:55:58 +01:00
|
|
|
return retval
|