Hi,
I'm using AutoHokey with Voicemeeter Remote API. Is there a call I can make to see if Voicemeeter is running.
RIght now, if I call VBVMR_IsParametersDirty while Voicemeeter Is not running, it returns -2. Is this the best way to tell if it is running? I want to catch the case where Voicemeeter is no longer running (because the user or some other process may have shut it down after I started my application) and either alert the user to restart voicemeeter or just restart it myself within the script.
API Call to see if Voicemeeter is running
Re: API Call to see if Voicemeeter is running
I think I solved it. Below is what I did for now.
Commented is the original
/* Original
IsParametersDirty(){
return DllCall(VBVMR.VM_DLL . "\VBVMR_IsParametersDirty")
}
*/
; Modified 2020-10-02
IsParametersDirty(){
a:= DllCall(VBVMR.VM_DLL . "\VBVMR_IsParametersDirty")
if ( a < 0 )
{
msgbox Voicemeeter is down, please restart then then press OK
return 1
}
return a
}
Commented is the original
/* Original
IsParametersDirty(){
return DllCall(VBVMR.VM_DLL . "\VBVMR_IsParametersDirty")
}
*/
; Modified 2020-10-02
IsParametersDirty(){
a:= DllCall(VBVMR.VM_DLL . "\VBVMR_IsParametersDirty")
if ( a < 0 )
{
msgbox Voicemeeter is down, please restart then then press OK
return 1
}
return a
}
-
- Site Admin
- Posts: 2133
- Joined: Sun Jan 17, 2010 12:01 pm
Re: API Call to see if Voicemeeter is running
the best example is in the vmr_matrix.c example (in SDK):
The function "DetectVoicemeeterType" will set the vbvmr_connect according the Voicemeeter version for example:
Code: Select all
case WM_TIMER:
if (wparam == MYTIMERID)
{
//check if voicemeeter type has changed
lpapp->vbvmr_error=iVMR.VBVMR_IsParametersDirty();
if (lpapp->vbvmr_error >= 0)
{
if (lpapp->vbvmr_connect == 0)
{
DetectVoicemeeterType(lpapp, hw);
}
}
else
{
if (lpapp->vbvmr_connect != 0)
{
//Voicemeeter has been shut down
lpapp->vbvmr_connect =0;
lpapp->vbvmr_nbbus =0;
InvalidateRect(hw,NULL,TRUE);
}
}
}
break;
Code: Select all
void DetectVoicemeeterType(LPT_APP_CONTEXT lpapp, HWND hw)
{
long rep,vmType;
lpapp->vbvmr_nbbus =0;
lpapp->vbvmr_pBUSName =NULL;
rep=iVMR.VBVMR_GetVoicemeeterType(&vmType);
if (rep == 0)
{
if (lpapp->vbvmr_connect != vmType)
{
lpapp->vbvmr_connect =vmType;
switch(vmType)
{
case 1://Voicemeeter
lpapp->vbvmr_nbbus =2;
lpapp->vbvmr_pBUSName =G_szBUSNameList_v1;
break;
case 2://Voicemeeter Banana
lpapp->vbvmr_nbbus =5;
lpapp->vbvmr_pBUSName =G_szBUSNameList_v2;
break;
case 3://Voicemeeter 8
lpapp->vbvmr_nbbus =8;
lpapp->vbvmr_pBUSName =G_szBUSNameList_v3;
break;
}
InvalidateRect(hw,NULL,TRUE);
}
}
}
Re: API Call to see if Voicemeeter is running
Thanks, Vincent!