Cog Audio: Implement virtual ring buffer function to read buffered bytes count

CQTexperiment
Christopher Snowhill 2022-01-12 23:16:13 -08:00
parent d1b519d59d
commit 52b17bd4d8
2 changed files with 4 additions and 3 deletions

View File

@ -68,7 +68,8 @@
// Checks if the buffer is empty or not. This is safe in any thread.
- (BOOL)isEmpty;
- (UInt32)bufferLength;
// Return amount buffered
- (UInt32)bufferedLength;
// Read operations:

View File

@ -73,9 +73,9 @@ static void deallocateVirtualBuffer(void *buffer, UInt32 bufferLength);
}
- (UInt32)bufferLength
- (UInt32)bufferedLength
{
return bufferLength;
return atomic_load_explicit(&bufferFilled, memory_order_relaxed);
}
//