'GetParameterFloat returning invalid status when attempting to use Voicemeeter API with AHK
I am attempting to right a simple script in AutoHotKey (AHK) that I can use to switch sources a bit more easily that with the Voicemeeter Remote panel that is included. I am using Voicemeeter Potato. After some mucking around, I was able to get the SetParameterFloat API call to work. For some reason I cannot get the GetParameterFloat call to work when trying to retrieve the status of the input selection (A1, A2, etc). GetParameterFloat just returns 0 regardless of whether the input is enabled. Is there something I have missed here?
Here is my full code (most promising version to date)
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
WinWait, ahk_exe voicemeeter8.exe ; wait for voicemeeter
DllLoad := DllCall("LoadLibrary", "Str", "C:\Program Files (x86)\VB\Voicemeeter\VoicemeeterRemote64.dll")
MsgBox, LoadLibrary: %ErrorLevel%
VMLogin()
OnExit("VMLogout")
Result := DllCall("VoicemeeterRemote64\VBVMR_SetParameterFloat", "AStr", "Bus[0].Gain", "Float", 0.0)
Result := DllCall("VoicemeeterRemote64\VBVMR_SetParameterFloat", "AStr", "Bus[1].Gain", "Float", 0.0)
Result := DllCall("VoicemeeterRemote64\VBVMR_SetParameterFloat", "AStr", "Strip[3].A1", "Float", 1.0)
Result := DllCall("VoicemeeterRemote64\VBVMR_SetParameterFloat", "AStr", "Strip[3].A2", "Float", 0.0)
VMLogin() {
Login := DllCall("VoicemeeterRemote64\VBVMR_Login")
MsgBox,Login: %ErrorLevel%
}
VMLogout() {
Logout := DllCall("VoicemeeterRemote64\VBVMR_Logout")
MsgBox, Logout: %ErrorLevel%
}
!s::
DllCall("VoicemeeterRemote64\VBVMR_IsParametersDirty")
MsgBox, IsParameterDirty: %ErrorLevel%
Result := DllCall("VoicemeeterRemote64\VBVMR_GetParameterFloat", "AStr", "Strip[1].A1", "Ptr", &str1stat, "Int")
MsgBox, GetParameterFloat: %ErrorLevel%
str1stat := NumGet(str1stat, 0, "Float")
MsgBox, NumGet: %str1stat%
MsgBox, GetResult: %Result%
Result := DllCall("VoicemeeterRemote64\VBVMR_SetParameterFloat", "AStr", "Strip[1].A1", "Float", 1.0)
MsgBox, SetParameterFloat: %ErrorLevel%
return
Majority of this code has been gleaned from here: https://gist.github.com/dcragusa/f3ab67ba1ed692cb628d1ef45dc9fac1
I am very new to using API calls so I would not be surprised if I missed something simple.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
