Page 1 of 1
API Call to see if Voicemeeter is running
Posted: Sat Oct 03, 2020 2:34 am
by sjc-or
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.
Re: API Call to see if Voicemeeter is running
Posted: Sat Oct 03, 2020 3:03 am
by sjc-or
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
}
Re: API Call to see if Voicemeeter is running
Posted: Sat Oct 03, 2020 7:49 am
by Vincent Burel
the best example is in the vmr_matrix.c example (in SDK):
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;
The function "DetectVoicemeeterType" will set the vbvmr_connect according the Voicemeeter version for example:
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
Posted: Sat Oct 03, 2020 6:00 pm
by sjc-or
Thanks, Vincent!