Page 1 of 1

Correct usage of "VBVMR_IsParametersDirty" question

Posted: Sat Mar 28, 2020 12:48 pm
by Atg
I little confused about VBVMR_IsParametersDirty function. This is what I figured out that kinda works for me like expected

Code: Select all

void WaitForUpdate()
{
    while (!iVMR.VBVMR_IsParametersDirty())
    {
        Sleep(10);
    }
}

int IsRecording()
{
    float val;
    WaitForUpdate();
    iVMR.VBVMR_GetParameterFloat("recorder.record", &val);
    return val;
}
Is it ok to call VBVMR_IsParametersDirty in loop like this? And call WaitForUpdate() before any GetParameter function and after any SetParameter ?

Re: Correct usage of "VBVMR_IsParametersDirty" question

Posted: Mon Mar 30, 2020 3:28 pm
by Vincent Burel
no, you may call iVMR.VBVMR_IsParametersDirty periodically (20 to 50 times per second) - typically in WM_TIMER event.
and refresh display if returning a value different from ZERO

Code: Select all

fDisplayParam=iVMR.VBVMR_IsParametersDirty();
if (fDisplayParam!= 0) 
{
   dc=GetDC(hw);
   DrawCurrentValues(lpapp, hw, dc);
   ReleaseDC(hw,dc);
}
you can call iVMR.VBVMR_GetParameterFloat when you want and consider it is updated.
see example in source code example vmr_client.c in Voicemeeter Remote SDK

Re: Correct usage of "VBVMR_IsParametersDirty" question

Posted: Mon Mar 30, 2020 4:16 pm
by Atg
Ok. But without "WaitForUpdate()" I get very unreliable results, for example iVMR.VBVMR_GetParameterFloat("recorder.record", &val); was returning (putting in "val" variable) 0 on first program launch and 1 on second (recorder was enabled). Also if I write something like this: Login() -> SetParameter() -> Logout();. Then SetParameter() will not change anything unless I use that loop before Logout(). For example that program https://www.dropbox.com/s/ltxfvzxenxfqt ... c%2Fmain.c was not able to change parameter without that loop at lines 46-49 or just without any Sleep function.

Re: Correct usage of "VBVMR_IsParametersDirty" question

Posted: Tue Mar 31, 2020 8:17 pm
by Vincent Burel
ok, if you are not in a Windows Event Handling Context,
you may just call iVMR.VBVMR_IsParametersDirty without sleep()
and call after iVMR.VBVMR_GetParameterFloat("recorder.record", &val);