Re: [PD-dev] why must one never send a message from a perform routine ?

2023-08-21 Thread Christof Ressi
To expand on Miller's reply: Conceptually, messaging and DSP are two separate domains. Sending a message from a perform routine violates this separation. Instead you should use a clock with delay 0 to defer the message to the begin of the next scheduler tick. Miller already mentioned the

Re: [PD-dev] why must one never send a message from a perform routine ?

2023-08-21 Thread Joseph Larralde
Hmm, I see ... unfortunately my random bug is totally unrelated to this weakness of my code. Thanks Miller for the explanation and pointers to examples ! And thanks Claude for the extra example. I'll check all my objects to see if there are other ones I can consolidate. Cheers ! Joseph Le

Re: [PD-dev] why must one never send a message from a perform routine ?

2023-08-21 Thread Claude Heiland-Allen
See bang~ in pure-data/src/d_misc.c for an example that uses a clock to send a message from DSP. On 21/08/2023 18:02, Miller Puckette wrote: The built-in objects "delay", "metro" and "pipe" use clocks in various ways. On 8/21/23 18:02, Joseph Larralde wrote: I just read in an answer from

Re: [PD-dev] why must one never send a message from a perform routine ?

2023-08-21 Thread Miller Puckette
Hi Joseph - If you send a message from within the DSP chain that causes the chain itself to be rebuilt it will crash Pd.  That's not a thread problem, but a (sort of) reentrancy problem.  If you're the only user of your object you can simply avoid doing that, but if you're publishing your

[PD-dev] why must one never send a message from a perform routine ?

2023-08-21 Thread Joseph Larralde
Howdy, I just read in an answer from Christof to Alexandre : "never ever send a Pd message directly from a perform routine ! Always use a clock !" But I never took the time to deeply understand Pd's inner working and am not sure why it is bad practice. Not sure what could be the consequences