Login / Register  0 items | $0.00 New
214 posts since 30 Oct, 2010

Postby Oden; Sun Aug 27, 2017 3:25 am Implementing sample accurate automation in vst3

Is there an example of how sample accurate automation should be implemented so as to not waste too much memory/CPU? I checked the VST3 SDK examples and no examples or information was provided, rather interesting considering that the sample accurate automation was a major selling point of the vst3 standard.
Jeff McClintock
266 posts since 30 Jan, 2005, from New Zealand

Postby Jeff McClintock; Thu Aug 31, 2017 3:06 pm Re: Implementing sample accurate automation in vst3

The gist of it is: The VST3 process method is passed a list of parameter updates, you can iterate that list to access the updates one at a time, something like....

Code: Select all
   if (data.inputParameterChanges)
      int32 paramChangeCount = data.inputParameterChanges->getParameterCount ();
      for (int32 index = 0; index < paramChangeCount; index++)
         IParamValueQueue* queue = data.inputParameterChanges->getParameterData (index);
         if (queue && queue->getParameterId () >= 0 )
            int32 valueChangeCount = queue->getPointCount ();
            ParamValue value;
            int32 sampleOffset;

            if (queue->getPoint (valueChangeCount-1, sampleOffset, value) == kResultTrue)
               int id = queue->getParameterId();

               if( id < ProgramChangeParameterId)
                  //_RPTW1( _CRT_WARN, L"Processor : %f\n", value );
                                                // HERE is where I act upon the paramter change...
                  synthEditProject.setParameterNormalizedDsp( sampleOffset, id, value );

In addition to this, you need to break up the audio processing into sub-sections. For example, say the DAW is calling process() with numSamples = 128 and a parameter-change event arrives with a timestamp of say "30". This means you need to process 30 sampleframes as usual, then process the parameter-change, then resume where you left off and process the remaining 98 sampleFrames.

Hope that makes sense,

Moderator: Moderators (Main)

Return to DSP and Plug-in Development