prepend all bindings with vm

This commit is contained in:
onyx-and-iris 2022-06-23 14:01:39 +01:00
parent cb68b8acec
commit 751200951b

View File

@ -13,29 +13,29 @@ import (
var ( var (
mod = syscall.NewLazyDLL(getDllPath()) mod = syscall.NewLazyDLL(getDllPath())
vmLogin = mod.NewProc("VBVMR_Login") vmLogin = mod.NewProc("VBVMR_Login")
vmLogout = mod.NewProc("VBVMR_Logout") vmLogout = mod.NewProc("VBVMR_Logout")
vmRunvm = mod.NewProc("VBVMR_RunVoicemeeter") vmRunvm = mod.NewProc("VBVMR_RunVoicemeeter")
vmGetvmType = mod.NewProc("VBVMR_GetVoicemeeterType") vmGetvmType = mod.NewProc("VBVMR_GetVoicemeeterType")
vmGetvmVersion = mod.NewProc("VBVMR_GetVoicemeeterVersion") vmGetvmVersion = mod.NewProc("VBVMR_GetVoicemeeterVersion")
vmPdirty = mod.NewProc("VBVMR_IsParametersDirty") vmPdirty = mod.NewProc("VBVMR_IsParametersDirty")
getParamFloat = mod.NewProc("VBVMR_GetParameterFloat") vmGetParamFloat = mod.NewProc("VBVMR_GetParameterFloat")
getParamString = mod.NewProc("VBVMR_GetParameterStringA") vmGetParamString = mod.NewProc("VBVMR_GetParameterStringA")
//getLevelFloat = mod.NewProc("VBVMR_GetLevel") //vmGetLevelFloat = mod.NewProc("VBVMR_GetLevel")
setParamFloat = mod.NewProc("VBVMR_SetParameterFloat") vmSetParamFloat = mod.NewProc("VBVMR_SetParameterFloat")
setParameters = mod.NewProc("VBVMR_SetParameters") vmSetParameters = mod.NewProc("VBVMR_SetParameters")
setParamString = mod.NewProc("VBVMR_SetParameterStringA") vmSetParamString = mod.NewProc("VBVMR_SetParameterStringA")
//getDevNumOut = mod.NewProc("VBVMR_Output_GetDeviceNumber") //vmGetDevNumOut = mod.NewProc("VBVMR_Output_GetDeviceNumber")
//getDevDescOut = mod.NewProc("VBVMR_Output_GetDeviceDescA") //vmGetDevDescOut = mod.NewProc("VBVMR_Output_GetDeviceDescA")
//getDevNumIn = mod.NewProc("VBVMR_Input_GetDeviceNumber") //vmGetDevNumIn = mod.NewProc("VBVMR_Input_GetDeviceNumber")
//getDevDescIn = mod.NewProc("VBVMR_Input_GetDeviceDescA") //vmGetDevDescIn = mod.NewProc("VBVMR_Input_GetDeviceDescA")
vmMdirty = mod.NewProc("VBVMR_MacroButton_IsDirty") vmMdirty = mod.NewProc("VBVMR_MacroButton_IsDirty")
getMacroButtonStatus = mod.NewProc("VBVMR_MacroButton_GetStatus") vmGetMacroStatus = mod.NewProc("VBVMR_MacroButton_GetStatus")
setMacroButtonStatus = mod.NewProc("VBVMR_MacroButton_SetStatus") vmSetMacroStatus = mod.NewProc("VBVMR_MacroButton_SetStatus")
) )
// login logs into the API, // login logs into the API,
@ -139,7 +139,7 @@ func getVMType() string {
func getParameterFloat(name string) float64 { func getParameterFloat(name string) float64 {
var value float32 var value float32
b := append([]byte(name), 0) b := append([]byte(name), 0)
res, _, _ := getParamFloat.Call( res, _, _ := vmGetParamFloat.Call(
uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&b[0])),
uintptr(unsafe.Pointer(&value)), uintptr(unsafe.Pointer(&value)),
) )
@ -155,7 +155,7 @@ func getParameterFloat(name string) float64 {
func setParameterFloat(name string, value float32) { func setParameterFloat(name string, value float32) {
b1 := append([]byte(name), 0) b1 := append([]byte(name), 0)
b2 := math.Float32bits(value) b2 := math.Float32bits(value)
res, _, _ := setParamFloat.Call( res, _, _ := vmSetParamFloat.Call(
uintptr(unsafe.Pointer(&b1[0])), uintptr(unsafe.Pointer(&b1[0])),
uintptr(b2), uintptr(b2),
) )
@ -171,7 +171,7 @@ func setParameterFloat(name string, value float32) {
func getParameterString(name string) string { func getParameterString(name string) string {
b1 := append([]byte(name), 0) b1 := append([]byte(name), 0)
var b2 [512]byte var b2 [512]byte
res, _, _ := getParamString.Call( res, _, _ := vmGetParamString.Call(
uintptr(unsafe.Pointer(&b1[0])), uintptr(unsafe.Pointer(&b1[0])),
uintptr(unsafe.Pointer(&b2[0])), uintptr(unsafe.Pointer(&b2[0])),
) )
@ -188,7 +188,7 @@ func getParameterString(name string) string {
func setParameterString(name, value string) { func setParameterString(name, value string) {
b1 := append([]byte(name), 0) b1 := append([]byte(name), 0)
b2 := append([]byte(value), 0) b2 := append([]byte(value), 0)
res, _, _ := setParamString.Call( res, _, _ := vmSetParamString.Call(
uintptr(unsafe.Pointer(&b1[0])), uintptr(unsafe.Pointer(&b1[0])),
uintptr(unsafe.Pointer(&b2[0])), uintptr(unsafe.Pointer(&b2[0])),
) )
@ -203,7 +203,7 @@ func setParameterString(name, value string) {
// setParametersMulti sets multiple parameters with a script // setParametersMulti sets multiple parameters with a script
func setParametersMulti(script string) { func setParametersMulti(script string) {
b1 := append([]byte(script), 0) b1 := append([]byte(script), 0)
res, _, _ := setParameters.Call( res, _, _ := vmSetParameters.Call(
uintptr(unsafe.Pointer(&b1[0])), uintptr(unsafe.Pointer(&b1[0])),
) )
if res != 0 { if res != 0 {
@ -216,7 +216,7 @@ func setParametersMulti(script string) {
// getMacroStatus gets a macrobutton value // getMacroStatus gets a macrobutton value
func getMacroStatus(id, mode int) float32 { func getMacroStatus(id, mode int) float32 {
var state float32 var state float32
res, _, _ := getMacroButtonStatus.Call( res, _, _ := vmGetMacroStatus.Call(
uintptr(id), uintptr(id),
uintptr(unsafe.Pointer(&state)), uintptr(unsafe.Pointer(&state)),
uintptr(mode), uintptr(mode),
@ -231,7 +231,7 @@ func getMacroStatus(id, mode int) float32 {
// setMacroStatus sets a macrobutton value // setMacroStatus sets a macrobutton value
func setMacroStatus(id, state, mode int) { func setMacroStatus(id, state, mode int) {
res, _, _ := setMacroButtonStatus.Call( res, _, _ := vmSetMacroStatus.Call(
uintptr(id), uintptr(id),
uintptr(state), uintptr(state),
uintptr(mode), uintptr(mode),