best polling strategy
I have an MSP object which perform envelope extraction on its input.
All the necessary calculations are carried out in the perform loop at
the sampling rate, however I don’t really need the output of my object
to be at the sampling rate since the envelope of the signal can be
sampled at a much lower rate by the Max scheduler without any problems.
To this goal, I have created a clock so that the object can be polled
at a specified interval.
Therefore, every time a polling interval goes by, the object performs
some calculations (a square root in this case) and outputs a value.
Now my question is:
would it be best to create a ‘start’, ‘stop’ and ‘interval’ methods to
make my clock user controllable like many objects do, or could I also
call my clock_delay function (with an argument of 0) in the perform
routine just at the end and outside of the perform loop ?
I am thinking about the latter solution because the value I need to
output won’t be updated until the end of the perform loop anyway.
Both methods seem to work, however I am not sure if the latter would be
a good strategy. I am thinking specifically about the case when many
objects are to be instantiated in a patch. In this case they will all
concurrently call the clock function, causing calculations to be
performed at the same time at the end of each audio vector.
Could that cause potential problems ?
Thanks for any insight.
Apologies to John Pitcairn for hijacking threads. It won’t happen
THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207.
____________________________________________________________________________________Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.