paint method and outlets
I’d like to send a bang through an outlet when the painting method is done painting. (of course not at *every* paint method, just sometimes – I handle this with a flag.)
I’m experiencing some troubles. Juce has a bad crash if I send just an outlet_bang in the paint method. Which could probably make sense to me; but I’m experiencing the very same crash also if I use: schedule_delay, qelem_set, defer_low. And I really don’t understand why.
Shortly: I’ve run out of ideas! I’m sure I’m doing something wrong. What should I do in order to have a bang sent when a certain paint method has been completed?
Thanks a lot,
Oops, as usual I didn’t look carefully enough.
The mistake was elsewhere – precisely here: apparently setting weird values for patching_rect makes Max crash:
----------begin_max5_patcher---------- 291.3ociRFsaCBBEF9Z3ofv0NCf110c2dNVZVPEsznfQvD2Z569pGwUcwkzK DC+mygy+2AthQzL6fxQIuQ9ffPWwHDHMJfB6QzF4PdszAoQaTNmrRQilh4UC dPuU5yOqMUe1ox8DVLQvODS3hjcGYGS1S1mDOWiouw16qUd3D4A0Rqw6zeq. MQLKHOko+qV0jKoTxoPnUsbJJe28BCqB1dXyqwreKQW.l0lc4EwA5hNajMPC nu2ok0Kbp1LaTwn1MLdbI5ImVk8lbu1Z1F8z+iwxZqzSitCa3KSZpdBvSSm. mAfO9aKx4ahGeAdPUzZs4uuMfNOpulYmsuKe17yCWxilWnbdsQBShGIwWkyY cQgBBOe02nKZsZiO3AxoUNDeC+ig3JJk -----------end_max5_patcher-----------
Yet, I’m still wandering: am I allowed to use outlets within the paint method, without scheduling or deferring?
I do not recommend making outlet calls in your paint method.
At the moment you will probably find that it works to make such outlet calls, however, this will have the effect of executing parts of the patcher at inappropriate times (i.e. serviced from the main thread, but from the wrong queue) and could cause unexpected behaviors intermittently (which will be *very* hard to track down) and degrade the performance of the Max environment.
I also don’t recommend using schedule_delay(). If you need a high-priority event (which is unlikely if it is a paint notification) then use clock_new() and clock_delay(). For a low-priority event, the qelem is preferable to defer_low().
Thanks Tim, everything is clear. I’ll go with qelem, then.