I’m developing a VST3 Host on macOS (v12.7, ARM) and was a bit confused about the AGain example plugin’s VU meter.
Once I my host was successfully passing audio through the AGain plugin, I expected the VU Meter in the AGain’s GUI to update automatically, specifically because of this code in again.cpp
//---3) Write outputs parameter changes-----------
IParameterChanges* outParamChanges = data.outputParameterChanges;
// a new value of VuMeter will be send to the host
// (the host will send it back in sync to our controller for updating our editor)
if (outParamChanges && fVuPPMOld != fVuPPM)
{
int32 index = 0;
IParamValueQueue* paramQueue = outParamChanges->addParameterData (kVuPPMId, index);
if (paramQueue)
{
int32 index2 = 0;
paramQueue->addPoint (0, fVuPPM, index2);
}
}
fVuPPMOld = fVuPPM;
But in the SDK sample code for audioclient.cpp
, outputParameterChanges
is initialized to nullptr
, so this code never executes.
After a lot of research with no clear answer, I modified audioclient.cpp so that it provided a valid queue for outputParameterChanges
. Then I added the following code to the postprocess
routine of audioclient.cpp
int32 count = outputParameterChanges.getParameterCount();
for(int32 i=0; i<count; i++) {
IParamValueQueue* q = outputParameterChanges.getParameterData(i);
if (editController != nullptr) {
auto numPoints = q->getPointCount();
if (numPoints > 0) {
Steinberg::int32 sampleOffset;
Steinberg::Vst::ParamValue value;
q->getPoint(numPoints - 1, sampleOffset, value);
editController->setParamNormalized(q->getParameterId(), value);
}
}
}
outputParameterChanges.clearQueue();
At this point the VU Meter in AGain started working.
I did a lot of searching on this topic, and found no clear evidence that what I’m doing above is legit or a lucky hack. I would be happy if someone can confirm that I’m doing the right thing.
Best Wishes,
Mark