how do you get the number of samples written to the buffer using the acquireCustomPlaybackData function? When sleeping in a loop for example for 10ms at a time and feeding the function with a buffersize of 480 (@48000 samples per second, 1 channel) I would lose data at some point as the sleep function doesn't sleep exactly 10ms and the function itself has some execution time, too.

I had the idea that you could feed a buffer larger than the required 480 samples (500 for example), memset the buffer to some extreme value and then searching how many samples were written, but even this approach is not perfect.