View Single Post
Old 06-21-2015, 11:42 AM   #8
Human being with feelings
Join Date: Jun 2015
Posts: 348

Originally Posted by Tale View Post
Sure. Implement FIFO queues (i.e. a buffer with head and tail) instead of plain buffers...
So why is this? I thought my buffers were operating in circular fashion (like ring buffers) and should work? I can't see where the problem is.

I think my code does exactly this, although it doesn't add/remove, but rather rewrites:

1. The host sends 63 samples, so add them to the input queue.
2. You need 64 samples, so you can't process them yet.
3. The output queue is still empty, so output 63 initial zeros.
4. The host sends 63 samples, so add them to the input queue.
5. Process 64 samples (63 from step 1 + 1 from step 4), remove these from the input queue, and add 64 processed samples to the output queue.
6. The input queue now holds 63+63-64=62 samples, which is too little to process another block (if it would be enough, then you would have to repeat step 5).
7. There are more than 63 samples in the output queue, so thee is no need for initial zeros anymore.
8. Output 63 samples, and remove these from the output queue.

It doesn't?

Last edited by mviljamaa; 06-21-2015 at 12:04 PM.
mviljamaa is offline   Reply With Quote