question - Detect changes (but not caused by user's direct input)

How to use Voicemeeter Remote API and control Voicemeeter Audio Engine
Post Reply
Atg
Posts: 32
Joined: Sat Oct 19, 2019 11:30 am

question - Detect changes (but not caused by user's direct input)

Post by Atg »

In win 10 when user press media keys to change volume OSD will appear. I want to write similar program for Voicemeeter. Is it possible to detect (by using API or any other way) when volume or mono/solo/mute button state are changed by MacroButtons or by hooked volume keys, but ignore changes made by user in GUI (dragging slider, pressing buttons in Voicemeeter)? Simplest way will be to check last state and compare to current state in a loop, but it will not distinguish what changes made by user and what by MacroButton; as far as I know same problem with "IsParametersDirty" function.
Vincent Burel
Site Admin
Posts: 2008
Joined: Sun Jan 17, 2010 12:01 pm

Re: question - Detect changes (but not caused by user's direct input)

Post by Vincent Burel »

yes, this OSD app should be done already ... because very simple to do with Voicemeeter Remote API

general principle is very simple:

Code: Select all

//if there is a change in Voicemeeter parameters
fParamChange=iVMR.VBVMR_IsParametersDirty();
{
   //we check our parameters specifically:
    iVMR.VBVMR_GetParameterFloat("Bus[0].Gain", &fcurrentValue);
   //we compare it to the one we previously displayed
   if (fcurrentValue != fDisplayedValue)
   {
       fDisplayedValue = fCurrentValue;
       ShowWindows
       DisplayCurrentValue(fDisplayedValue);
   }
}
then you could Hide the window after 2 second automatically for example... and that's it... you can do that with all parameters you want to possibily display in an OSD... This principle is also shown in sample0 source code of the SDK (for values given in edit box, see DrawCurrentValues() function).
Atg
Posts: 32
Joined: Sat Oct 19, 2019 11:30 am

Re: question - Detect changes (but not caused by user's direct input)

Post by Atg »

Ok. But if I open Voicemeeter manually and press some buttons/drag faders will OSD still appear (will VBVMR_IsParametersDirty() return true)? If it does it will be a little inconvenient but I can work it out, maybe checking if Voicemeeter windows in focus.
Vincent Burel
Site Admin
Posts: 2008
Joined: Sun Jan 17, 2010 12:01 pm

Re: question - Detect changes (but not caused by user's direct input)

Post by Vincent Burel »

of course! VBVMR_IsParametersDirty() returns 1 if there is a change on Voicemeeter (by mouse or anything else).

you may detect if Voicemeeter is hidden or not, for example with EnumWindows() functions...
Atg
Posts: 32
Joined: Sat Oct 19, 2019 11:30 am

Re: question - Detect changes (but not caused by user's direct input)

Post by Atg »

My main question was is it possible to detect changes, except changes made by user in GUI (dragging faders, pressing buttons). You said yes so I wanted to clarify what if I didnt know something about VBVMR_IsParametersDirty.
Anyway after some research I understand why nobody made OSD already - window apps cant be on top of fullscreen apps (games for example). Only ways to make a proper OSD is to hook into 3d graphics API or use win10 UWP CompactOverlay (and there is lack of info how to make proper OSD "window" in UWP without control bar and close button, etc).
Vincent Burel
Site Admin
Posts: 2008
Joined: Sun Jan 17, 2010 12:01 pm

Re: question - Detect changes (but not caused by user's direct input)

Post by Vincent Burel »

you may detect if the Voicemeeter GUI (main windows) is hidden or not for example. But i note your request...
last pack 10 includes an example of code to make an OSD (MAR 2021)
Post Reply