I'm working on generating analog output signals from data stored in one or multiple .mat files.
The current setup works just fine for a single file, but there’s a problem: whenever a new file is loaded, there’s a short pause where no new signal values are sent — basically a gap between files while the data is being read from disk and then another delay for the task.write(data, auto_start=True).
What I’d like to achieve is being able to send data continuously while the next chunk of values is being prepared (I read about circular buffers who could be a solution but can't find much on how to use them).
State of things : I can load one .mat file, generate the corresponding analog output (AO) signal, and then move on to the next one. I’ve read that a circular buffer could solve this by allowing simultaneous read/write access — but I can’t find any concrete examples of how to implement it with AO generation.
My questions : How can I add new samples to the AO buffer while it’s still being used to generate the output? Is there a standard way (or API function) to handle this, e.g. a streaming / continuous mode or queue mechanism for analog output? Any guidance or examples on implementing a circular buffer for continuous AO would be greatly appreciated.
Thanks for helping