Hi,
So my question is: Can I somehow, after handling my "open" message, force the "dsp" method to be called?
No. As you said yourself, the dsp method is automatically called when the audio graph changes.
However, my external accepts an "open" message which might allocate a new internal buffer, and I would like Pd to call my dsp function in order to update a few pointers so that the "perform" function can access the new buffer.
If the buffer can change, you shouldn't directly pass it to the perform method. Instead you should pass the object which contains the buffer, then the perform method will always see the most recent state.
Generally, most externals pass the object, the individual signals and finally the vector size.
Will the "perform" function be called even if the "open" handler isn't finished yet?
No, all methods are executed *synchronously*.
Or can I somehow tell Pd that it should stop calling my "perform" function for a little bit while I allocate a new buffer
No. If you don't want your method to block Pd, you would have to use some sort of multithreading. But most externals don't care, so don't worry about it for now.
Christof
On 20.11.2020 19:37, Matthias Geier wrote:
Dear list.
I'm working on a Pd external (https://github.com/AudioSceneDescriptionFormat/asdf-rust/tree/master/pure-da...) which uses class_addmethod() with gensym("dsp") to register a "dsp" function.
I guess this function is called whenever the audio graph changes, and that works fine.
However, my external accepts an "open" message which might allocate a new internal buffer, and I would like Pd to call my dsp function in order to update a few pointers so that the "perform" function can access the new buffer.
So my question is: Can I somehow, after handling my "open" message, force the "dsp" method to be called?
And a related question: What happens when my handling of the "open" message takes longer than expected? Will the "perform" function be called even if the "open" handler isn't finished yet?
Or can I somehow tell Pd that it should stop calling my "perform" function for a little bit while I allocate a new buffer and then tell it to call the "dsp" function and afterwards resume calling the "perform" function?
BTW, with "perform" function I mean the function that has been registered with dsp_addv().
cheers, Matthias
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list