1

I'm programming a Steinberg VST-Plugin in XCode 4.6.

I've already implemented a Highpass-filter which works correctly. Now I'm trying to do some nonlinear distortion with a quadratic function. After I implemented the few lines below and loaded the plugin into the host, I get immediatly an Output from the plugin - you can hear nothing, but the meter is up high.

I really can't imagine why. The processReplacing function where the math takes place should only be called when playing sound, not when the plugin is loaded. When I remove the few lines of code below, everything is okay and sounds right, so I assume it has nothing to do with the rest of the plugin-code.

The problem takes place in two hosts, so its probably not a VST-bug. Has anybody ever experienced a similar problem?

Many Thanks, Fabian

void Exciter::processReplacing(float** inputs, float** outputs, VstInt32 sampleFrames){

  for(int i = 0; i < sampleFrames; i++) {

    tempsample = inputs[0][i];


//Exciter - Transformation in positive region, quadratic distortion and backscaling

    tempsample = tempsample + 1.0f;        
    tempsample = powf(tempsample, 2.0f);
    tempsample = tempsample / 2.0f;
    tempsample -= 1.0f;        


//Mix-Knob: Dry/Wet ------------------------------------------------

    outputs[0][i] = mix*(tempsample) + (1-mix)*inputs[0][i];

EDIT: I added logfile-outputs to each function and it occurs, that the processReplacing function is called permanently, not only when playback is turned on ... But why?

fzpf
  • 11
  • 2

1 Answers1

3

You pretty much answered the question yourself with your edit. processReplacing is called repeatedly. This is part of the VST specification.

VST plug-ins are targeted for real time effects processing. Don't confuse or misinterpret this as lookahead. By real time, I mean inserting the plug-in into a channel and playing an instrument while the DAW is recording. So you can see that in order to mitigate latency, the host is always sending the plug-in an audio buffer (whether it's silence or not).

Chris
  • 556
  • 1
  • 4
  • 18
  • Thanks! I thought that the processReplacing would be only called when the DAW does record and/or playback, but not when the DAW is stopped. Do you know what the DAW sends to the plugin, when playback/recording is stopped? A samplebuffer full of zeroes? Many Thanks, Fabian – fzpf May 23 '13 at 18:02
  • Yes, it's a buffer full of zeroes. – Chris May 23 '13 at 19:47