Hi to all,
I need to keep a copy of the input AudioSampleBuffer of the VST plugin, so the editor can draw a waveform preview.
So I instanciate an AudioSampleBuffer in the prepareToPlay method:
void MyFilter::prepareToPlay (double sampleRate, int samplesPerBlock)
{
...
deleteAndZero(m_pLastInputBuffer);
m_pLastInputBuffer = new AudioSampleBuffer(m_nInputs, samplesPerBlock);
...
}
In the proceccBlock callback I do as follows:
void MyFilter::processBlock (const AudioSampleBuffer& input,
AudioSampleBuffer& output,
const bool accumulateOutput,
MidiBuffer& /*midiMessages*/)
{
m_pLastInputBuffer->clear();
*m_pLastInputBuffer = input;
...
}
The plugin crashes in the memcpy call inside the copy constructor code.
I’ve notified that input.allocatedData is NULL.