On Sat, 2004-03-27 at 05:24, Tim Goetze wrote:
i've decided not to mess with either python
locking or its memory
allocator. instead, an asynchronous scheme is employed: C++ RT audio
callbacks write to a lock-free FIFO and signal there is sample data to
process (this is done by writing a trigger to a UNIX pipe on which the
python audio thread sleeps). a second FIFO holds the results of python
audio processing. the callback code doesn't wait for the python DSP
code to complete, instead it fetches processed data from the second
FIFO right away and returns to Jack/PA/the LADSPA host/your native
audio code. all this is possible without acquiring any locks.
For what its worth, I have written a python module for jack which works
almost exactly in this manner. (GPL; online at
http://www.a2hd.com/software).
In my implementation the audio buffer, on the Py end, is a numpy array
of type 'f'. When python is not able to keep up, either InputSyncError
or OutputSyncError will be raised by the process call (depending on
which FIFO had an underflow).
Unfortunately python does not appear to be sufficiently fast for any
significant realtime work, in my experience its far less useful than one
might imagine.
--
Andrew (Andy) W. Schmeder <andy(a)a2hd.com>