[PD-dev] Calling a method periodically

Greg Surges surgesg at gmail.com
Sat Mar 22 04:24:52 CET 2008


Thanks all,

I'm still stuck. Is there a way to interleave calls to clock_delay()?

I'll explain what I mean:

I'm coding (trying to, anyway) a histogram object. I'm using integers from
input to increment the values stored in an array. For example, if 76 is
received as input, the value in the array at index 76 is incremented. This
way, there's a running total of the frequency with which a number occurs.

The problem is, I want the histogram to have a time window. So, a specified
amount of time after an index is incremented, it should decrement
automatically. I'm calling clock_delay() in the array incrementing function,
which calls the decrementing function after the specified "decay" time.
However, if you have two or more inputs before the decay time is up, only
the most recent call from clock_delay() completes.

What's happening is:
(Decay time of 2 seconds)
76 is input at 0:00
32 is input at 0:015

32 decrements at 0:035


What I want to happen is:
(Decay time is 2 seconds)
76 is input at 0:00
32 is input at 0:015

76 decrements at 0:02
32 decrements at 0:035

Can anyone help me with a way around this?

Thanks again, this community has been really friendly and helpful as I start
out learning.

-Greg Surges

http://www.uwm.edu/~gssurges/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20080321/c49caa88/attachment.htm>


More information about the Pd-dev mailing list