[PD-dev] Calling a method periodically

Greg Surges surgesg at gmail.com
Sat Mar 22 17:14:14 CET 2008


Thanks,

I've posted the code at
http://www.uwm.edu/~gssurges/histogram.c<http://www.uwm.edu/%7Egssurges/histogram.c>

Hope it makes sense...

-Greg

On Sat, Mar 22, 2008 at 11:06 AM, Hans-Christoph Steiner <hans at eds.org>
wrote:

>
> If you post the code, it would be much easier to tell what's happening.
>  My guess is that you can only have one delay set for a given clock, so like
> this:
>
> - 76 sets the timer
> - 32 resets the timer with new info
>
> Therefore the timer callback set by 76 never gets called.  (Something like
> that, it's still morning here ;)
>
> .hc
>
> On Mar 21, 2008, at 11:24 PM, Greg Surges wrote:
>
> 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/ <http://www.uwm.edu/%7Egssurges/>
>
>
>
>
>
>
> ----------------------------------------------------------------------------
>
> You can't steal a gift. Bird gave the world his music, and if you can hear
> it, you can have it. - Dizzy Gillespie
>
>
>
>


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


More information about the Pd-dev mailing list