[PD-dev] Polling: Execute a function every X ms from within the external.

Kyriakos Charalampides kcharalampides at icloud.com
Thu Apr 29 18:12:41 CEST 2021


I recently started learning how to write some custom pd externals. It has been quite fun until now, but its been a few days I am stuck in a loop. I want to read a buffer coming from an external device every 1 ms. I could do that with a metro but this can cause several issues with this buffer. 

My initial though was to use a for loop but this was obviously a horrible idea since pd will stuck in the for loop and hang. Then I though to use a clock to execute my reading function but all examples with clock and clock_delay seem to be based on for and while loops. What I would really like to achieve is to execute the reading function every 1ms and interrupt this process every time that  a new message is coming from pd. 

Any tips or ideas will be highly appreciated. 

All best,
Kyr




More information about the Pd-dev mailing list