Strange DSP behavior


#1

I made Hello World plugin with IntroJucer.

The only change I made in code was this line (in ProcessReplacing):


(*channelData) *= 0.;

 

void FocustestAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)

{

    // This is the place where you'd normally do the guts of your plugin's

    // audio processing...

    for (int channel = 0; channel < getNumInputChannels(); ++channel)

    {

        float* channelData = buffer.getSampleData (channel);


        int remain = buffer.getNumSamples();

        

    

        for(int i = 0; i < remain;i++)

        {

            

        (*channelData) *= 0.;

        

        }

        

        // ..do something to the data...

    }


    // In case we have more outputs than inputs, we'll clear any output

    // channels that didn't contain input data, (because these aren't

    // guaranteed to be empty - they may contain garbage).

    for (int i = getNumInputChannels(); i < getNumOutputChannels(); ++i)

    {

        buffer.clear (i, 0, buffer.getNumSamples());

    }

}

 

 

And very funny stuff happend in Wavelab... I don't understand why my plugin is producing spikes and noise. I thought this code should produce silence, but it doesn't.

The same stuff happens in Reaper.

Here is what Juce produces:

 

And here is bypass (source file):

 

And when I make a change in the code - a simple attenuator:

(*channelData) *= 0.5;

 

I get this:

 

Am I doing anything wrong?? I thought that dsp in Juce is as clear as in vst? Just getting samples and doin' stuff to them.


#2

Sorry... such a bug I made... not moving pointer.
Too tired to develop. Sorry for making trash on forum


#3

Maybe try modifying all the samples in the buffer, rather than just the first one..