AbstractFifo and copying data to another thread for processing


#1

I'm moving some code into a seperate processing thread. I am using AbstractFifo to gather incoming audio into a buffer. The processing thread then calls 'readFromFifo' (like in the example) with a `float *` to store the data (which has alread been allocated), and I am using FloatVectorOperations::copy to copy the data, e.g.:

    void readFromFifo (float* data, int numSamples) noexcept
    {
        int start1, size1, start2, size2;

        fifo.prepareToRead (numSamples, start1, size1, start2, size2);

        if (size1 > 0)
            FloatVectorOperations::copy (data, floatSampleBuffer + start1, size1);

        if (size2 > 0)
            FloatVectorOperations::copy (data + size1, floatSampleBuffer + start2, size2);

        if (size1+size2 >= bufferSize)
            fifo.finishedRead (size1 + size2);

        DBG ("read " << (size1 + size2) << " samples\n");

    }

I have a strange issue, where if I do the calculation (as it was previously) from a class inheriting from AudioDeviceIOCallback, triggered by a Timer, it works as expected. However, doing it from another thread seems to act is if there is no data. 

I have checked that there is data going in and being copied, and that it is new data each time.

I'm still getting my head around thread safe FIFO stuff, any pointers appreciated