IIRFilter kills PlugInHost


#1

Hallo,

 

I want to create a Filterbank PlugIn. At the Moment I have only a high at one, and a lowpass on the second channel. Compiling etc is working but I can only start the PlugIn with the PlugInHost if I take out the "processSamples"-lines in the Code. Else the debugger gives "Unhandled exception at 0x5a01e5c6 (TestPlugIn.dll) in plugin Host.exe: 0xC0000005: Access Violation when writing to 0xcdcdce75 position." and stops in juce_Atomic.h at line 376. Unfortunetly, I don't know what that's supposed to mean. 

Has someone any suggestions?

Thx derLippe

void TestPlugInAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{
    // Use this method as the place to do any pre-playback
    // initialisation that you need..

    double fGr = 1000;
    lowFilter->makeLowPass(sampleRate,fGr);
    highFilter->makeHighPass(sampleRate,fGr);
   



void TestPlugInAudioProcessor::releaseResources()

{
    // When playback stops, you can use this as an opportunity to free up any
    // spare memory, etc.

   

}



void TestPlugInAudioProcessor::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);
       
    }    


    AudioSampleBuffer filterBuffer(2, buffer.getNumSamples());
    filterBuffer.copyFrom(0,0,buffer.getSampleData(0),buffer.getNumSamples(),(float) algorithm.getWichtung()[3]/10);
    filterBuffer.copyFrom(1,0,buffer.getSampleData(1),buffer.getNumSamples(),(float) algorithm.getWichtung()[4]/10);
    lowFilter->processSamples((float*) filterBuffer.getSampleData(0,0),filterBuffer.getNumSamples());
    highFilter->processSamples((float*) filterBuffer.getSampleData(1,0),filterBuffer.getNumSamples());

    buffer.clear();

    buffer.copyFrom(0, 0, filterBuffer, 0, 0, buffer.getNumSamples());
    buffer.copyFrom(1, 0, filterBuffer, 1, 0, buffer.getNumSamples());
 

        buffer.applyGain (0, 0, buffer.getNumSamples(),algorithm.getWichtung()[1]/10);        
        buffer.applyGain (1, 0, buffer.getNumSamples(),algorithm.getWichtung()[2]/10);
        // ..do something to the ...
       
    // 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());
    }
}