Parameter updates get lost between controller and processor using performEdit

SDK for VST 3 audio plug-in and host development.
Post Reply
mike13
Posts: 2
Joined: Tue Oct 15, 2019 4:08 pm

Parameter updates get lost between controller and processor using performEdit

Post by mike13 » Sat Oct 19, 2019 10:56 am

Hi,

While developing a VST3 instrument plugin, I'm stuck with a major issue:

When notifying the host from the controller side using performEdit, some messages get lost in the forwarding and don't reach the processor.
I checked that all parameter changes occur on the controller side. Calls for performEdit are correctly performed every time.
However, on the Processor side, sometimes parameter updates don't appear in the process() method when parsing data.inputParameterChanges.
This happens in different DAWs, with different VST3 SDK versions.

Do you have any recommendation on how properly debug this, or maybe a simple example ?

User avatar
pongasoft
Posts: 88
Joined: Sun Mar 11, 2018 5:57 pm
Location: Las Vegas, USA
Contact:

Re: Parameter updates get lost between controller and processor using performEdit

Post by pongasoft » Sat Oct 19, 2019 2:03 pm

I have never experienced this problem. Are you sure you call:

Code: Select all

beginEdit(id);

then 

performEdit(id);
performEdit(id);
performEdit(id);
...

then

endEdit(id);
I have encapsulated this sequence in a Editor concept, so that I don't really have to think about it (beginEdit is done in constructor and endEdit in destructor).


Although now that I look at the code, it seems I also call setParamNormalized (see setValue method) in addition to performEdit.

Yan

mike13
Posts: 2
Joined: Tue Oct 15, 2019 4:08 pm

Re: Parameter updates get lost between controller and processor using performEdit

Post by mike13 » Sun Oct 20, 2019 11:58 am

Here is the code called from the Controller when setting a parameter from any of my UI widgets (slider, button, ...):

Code: Select all

// Notify a parameter changed -----
        
if(setParamNormalized(tag, value) != Steinberg::kResultOk) {
    printf("Fail to call set param normalized in Controller::SetParameter\n");
    return false;
}

// Transmit value to host -----

EditController::beginEdit(tag);
Steinberg::tresult result = EditController::performEdit(tag, getParamNormalized(tag));
EditController::endEdit(tag);

if(result != Steinberg::kResultOk) {
    printf("Perform Edit failed, param: %d, value: %f\n", paramId, value);
    return false;
}
From the Processor process() method:

Code: Select all

Steinberg::int32 num_params_changed = data.inputParameterChanges->getParameterCount();
            
// Process each param
for(Steinberg::int32 index = 0; index < num_params_changed; ++index) {
    
    Steinberg::Vst::IParamValueQueue* paramQueue = data.inputParameterChanges->getParameterData(index);
    
    if(!paramQueue) {
        continue;
    }
    
    uint32_t param_id = paramQueue->getParameterId();
    Steinberg::int32 num_points = paramQueue->getPointCount();
    
    // Process each param value change
    for(Steinberg::int32 point=0; point < num_points; ++point) {
        
        Steinberg::Vst::ParamValue value = 0.f;
        Steinberg::int32 sampleOffset = 0;
        
        if(paramQueue->getPoint(point, sampleOffset, value) == Steinberg::kResultTrue) {
            if(param_id >= mParamIdToEngineParamIndexTable.size()) {
                printf("ERROR: out of range param id: %d\n", param_id);
                continue;
            }
            
            uint32_t engine_param_idx = mParamIdToEngineParamIndexTable[param_id];
            mAudioEngine->SetParameter(engine_param_idx, static_cast<float>(value));
        }
    }
}
These are directly inspired from the samples included in the VST3 SDK public.sdk section.
Am i doing something wrong here ?

Post Reply