sorry i just noticed that.I was just trying to show you the way i record and play it.
In my buttonclicked method i just toggle a flag. 0 or 1. That’s it. In my process block i do something like this
void FreezeAudioProcessor::processBlock (AudioBuffer< float >& buffer, MidiBuffer& midiMessages)
const int totalNumInputChannels = getTotalNumInputChannels();
const int totalNumOutputChannels = getTotalNumOutputChannels();
for ( int i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
buffer.clear (i, 0, buffer.getNumSamples());
for (int channel = 0; channel<totalNumInputChannels; ++channel)
const float* bufferData = buffer.getReadPointer (channel);
const float* freezeBufferData = mFreezeBuffer.getReadPointer (channel);
// copy the data from main buffer
// fill it back with freezebuffer
// when i uncomment getFromFreezeBuffer i get a bad access memory error.
mWritePos += bufferLength;// to move to next 512 samples
mWritePos %= freezeBufferLength ;// to go back to the beginning
Yes i was working with PIC,Atmel and STM