Sorry, one more note: In libpd, sched_tick is currently calling in the PROCESS macro in the context of the audio callback (in z_libpd.c). The function sched_tick handles all timed objects (such as metro) and therefore triggers all kinds of message processing downstream, where also memory operations commonly happen. In this sense, calling sys_domicrosleep at the end of PROCESS does not make the situation worse than it is right now.
gr~~~
2013/1/21 Thomas Grill gr@grrrr.org
2013/1/21 padawan12@obiwannabe.co.uk padawan12@obiwannabe.co.uk
**
On 21 January 2013 at 14:57 Thomas Grill gr@grrrr.org wrote:
I am not sure whether using memory management functions in an audio callback is a problem
Yikes!
http://www.rossbencina.com/code/real-time-audio-programming-101-time-waits-f...
You (and Ross) are certainly right. Someone has to find a better solution, maybe using an extra thread that is signalled by the audio callback. For libpd that should be easier (because it's very clean right now) than for Vanilla Pd. gr~~~
-- Thomas Grill http://grrrr.org