Page 1 of 1

DPF to VST data problem ?

Posted: Sat Aug 24, 2019 2:20 pm
by marbangens
Hey, sometimes when I create more then 1 vst's in the daw, they crash.
What happens is that I hear a click then the audio on that channel is dead.
The Ui still works and running more then one standalone jack works fine.

what could cause this? :?
I tried google but I don't understand the problem or what to look for
https://github.com/martinbangens/DistoT ... toTVUI.hpp

Re: DPF to VST data problem ?

Posted: Sat Aug 24, 2019 2:35 pm
by jpcima
It's typical of a dsp which produces NaN values or infinity at some point, and this math error propagates to the output signal and cuts the sound.

Re: DPF to VST data problem ?

Posted: Sat Aug 24, 2019 5:25 pm
by Michael Willis
Like jpcima says, it might be a problem with NaN or infinite. Look at UNDENORMAL from freeverb3 or SR2_UNDENORMAL from libsamplerate for the countermeasure.

It is also possible that you are using global or static variables, in which case multiple instances of your plugin will contend over the same memory.

Also you need to be very careful with pointers. If you are using pointers and anything goes wrong, it can corrupt memory and cause any manner of bad behavior or crash your plugin and the DAW with it.

Re: DPF to VST data problem ?

Posted: Sat Aug 24, 2019 7:08 pm
by marbangens
Thanks :D gonna look into it :D

Re: DPF to VST data problem ?

Posted: Sun Aug 25, 2019 11:08 am
by marbangens
Don't get any NuN or Inf from std::fpclassify() like this

Code: Select all

float CheckForBadEggs(double input){
    switch(std::fpclassify(input)) {
        case FP_INFINITE:
	  had_Inf = true;
	  return 0.0;
        case FP_NAN:
	  had_NuN = true;
	  return 0.0;

        default:
	  return 0.0;
   }
}
That code would work for checking that correctly right?
I think it's a pointer problem. Here is a good video I think explains this
https://www.youtube.com/watch?v=iNuTwvD6ciI

Re: DPF to VST data problem ?

Posted: Sun Aug 25, 2019 9:40 pm
by jpcima
Did you take in account the flag -ffast-math which DPF has as default? maybe try to build in DEBUG=true.

A reason is that, under fast-math optimization, the compiler can consider anormal values as not happening.
It can allow itself to remove isnan() checks, and produce simpler assembly for fpclassify().

You can compare yourself between -O2 -ffast-math, and with only -O2
https://godbolt.org/z/sYcmMP

Re: DPF to VST data problem ?

Posted: Mon Aug 26, 2019 12:36 pm
by marbangens
I got this with DEBUG=true

Code: Select all

had_NuN=1
seems to be from the one vst of 3 that failed
I can't really separate them.
so something like this

Code: Select all

        // Wet knob final blend in
         outFinalL = (sigL1*0.0001*fWet) + sigDryL1 - (sigDryL1*0.0001*fWet);
         outFinalR = (sigR2*0.0001*fWet) + sigDryR2 - (sigDryR2*0.0001*fWet);
would brake the vst? I Haven't seen any problems with the jack stand alone version, why is that different?
wont the host separate them in ram or it has nothing to do with it?

Re: DPF to VST data problem ?

Posted: Fri Aug 30, 2019 12:43 pm
by marbangens
I found the problem :D

Code: Select all

sig = sig * (2*gain);
  
  if (sig < 0.000000001f and sig > -0.000000001f){
   sig = sin(sig);
  }
  sig = sig + sin(0.000000000000000000000000001f);
Don't do that :lol:
but now one of them was created with full volume :lol:
oh man...