AudioSampleBuffer operator=


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)
  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 = input;

The plugin crashes in the memcpy call inside the copy constructor code.
I’ve notified that input.allocatedData is NULL.


ooh - yes, there seems to be a bug in operator=

Sorry about that, I’ve checked in a fixed version now. Thanks for spotting it!


Thanx Jules for the fix