Dear all,
I am dusting off an unfinished project, so I may have asked this question already, but I've completely forgotten about it by now.
I am trying to develop a Pd dsp extern that has a listen thread in it. I am streaming data from another application and copying it into a buffer in the listen thread. The tilde_perform function (the function housing the dsp loop) simply reads out of that buffer.
The index of the read point in the buffer is updated in the listen (background) thread.
There should never be a race condition because I only read once and write once. The data might be wrong, but there should always be something available to read.
I have tried doing this with and without mutex locking (on the listen thread, the dsp function, and both) but it seems to crash no matter what. I have done this successfully with non-dsp externs, and if I don't do anything in the listen thread except sleep, there is no crash. Any clues as to how to make this work?
Cheers,
David