[Solved] Can't fill up AbstractFifo - (totalSize - 1) is the max allowed?

Hi,

What is the reason for AbstractFifo not allowing all of the “slots” to be filled up (maximum is the capacity - 1)?

void AbstractFifo::prepareToWrite (int numToWrite, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const noexcept
{
    ...
    numToWrite = jmin (numToWrite, freeSpace - 1);
    ...
}
2 Likes

Thanks @chkn!
I’m sorry, I don’t know how I didn’t see that when I searched.

PS: maybe the variables need to be renamed, “freeSpace” is little-bit misleading

A dumb question, btw - can’t this all be resolved by adding 1 to the the freeSpace? (I mean if the implementation changed in this way not manually doing so when instantiating or resizing the fifo)