python-sounddevice icon indicating copy to clipboard operation
python-sounddevice copied to clipboard

Asking for a feature of the callback

Open rako233 opened this issue 4 years ago • 1 comments

To write the code in an OOP style, I had a problem to inject a queue into the callback. I did this with a closure with success.

But the success ended when using sounddevice with multiprocessing.process. I could use the callback when the callback was a static method without the wrapper of the closure. This lacks of course a reference to a queue.

So my proposal is to add a parameter for the callback, providing a python reference for a queue or another object instance, which can be provided by instancing a Stream.

rako233 avatar Jul 18 '21 20:07 rako233

Can you please give a minimal example where a closure cannot be used?

This can either be a broken example with the current API or a fictitious example with the suggested new API.

mgeier avatar Jul 19 '21 19:07 mgeier