Level meter showing peak and RMS


I’m quite new to VSTGUI and would like to create a level meter that draws the peak amplitude of an audio signal as a solid filled meter with a color gradient. I figured out CVumeter would work for this as i can just create 2 bitmaps for the on and off state. But i would also like to have a thin line in the meter indicating the RMS value of the audio signal. How would i go about that? Can i send 2 different values to the meter (one for Peak and one for RMS)? How can i position the line in the meter so it shows the correct RMS value? Can i still use a bitmap for drawing the peak amplitude?

One control can only have one value. What you can do in your situation is to create another view on top of the CVuMeter control which only draws the single RMS line.

“One control can only have one value”: That is not technically true. All the controls provided by VSTGUI4 supports only one value. But you can write your own controls that support as many values as you want. I am not saying it is easy to do, but you can do it, as I did in my Jamba framework

For example, my VAC-6V plugin, has a GainView control, that uses 3 parameters for its “draw” call:

   // fBypassParameter, fGain1Parameter and fGain2Parameter are 3 vst parameters
  Gain gain = fBypassParameter.getValue() ? Gain{} : Gain{fGain1Parameter.getValue().getValue() * fGain2Parameter.getValue().getValue()};

  rdc.drawString(toDbString(gain.getValue()), sdc);

    rdc.fillRect(0,0, getWidth(), getHeight(), CColor{128,128,128,100});```

Technically this is true, but you’ll loose automatic parameter updating if you do it like this. So I don’t recommend doing this!

Can you clarify what you mean by “automatic parameter updating” ? Like I said, this is not a theoretical example, but something that is currently implemented by my framework (who simply uses VST3SDK, and does not modify it) and used in my device. I have 4 different views:

  • a gain1 control know, tied to fGain1Parameter
  • a gain2 control know, tied to fGain2Parameter
  • a bypass control toggle tied to fBypassParameter
  • finally the GainView control I mentioned in my previous example which uses the 3 previous parameters

Anytime, any of the 3 values changes, my GainView control is notified as well and it is irrelevant of how the value of the parameter changes, whether it is changed by the user when it turns a knob, the real time code changing the value, the user automating the value, or loading another preset… I just don’t see what else is there… Under the cover, I end up calling addDependent on the Vst::Parameter object to be notified of any changes…

Please let me know what I missed and what is this “automatic parameter updating” means.


You are not using the WYSIWYG editor and code your UI in c++. That’s fine, but still the CControl base class is build with one value in mind, just look up all the methods in there: getMin(), getMax(), getValue(), etc…

I don’t know why you say I am not using the WYSIWYG editor. On the contrary, ALL the controls you create with my Jamba framework are fully integrated with the WYSIWYG editor, and to be honest are very easy to create… I made sure of that.

The CustomView hierarchy I created inherits from CView not CControl so there is no such restriction…

I’m not familiar with your additions to the vstgui editor. But I think the topic starter is not using your framework and may be a newbie so I gave my best advice I think.

I didn’t add anything to the vstgui editor either.

But I agree and you are right: for somebody (especially newbie) using straight vstsdk/vstgui it is just not possible out of the box. But if you want to put in the effort, you can. My framework can be used, and since it is 100% free and open source, the code can be looked at and/or reused.

For what it is worth, the ability to have a view, whose rendering depend on more than 1 parameter, seems to be an extremely common use case and might be worth considering an addition for a future VSTGUI release…