[PD-dev] interrupting a method

Julian Villegas julovi at yahoo.com
Sun May 14 08:33:21 CEST 2006


   Hi,

I'm new to Pd, and I'm trying to write an external and thanks to johannes' HOWTO, the process hasn't been so painful. However, I haven't found how to solve this problem (I looked the source code of the timer, pipe, and line objects that do something alike, but I'm not sure if it will work):
I receive a list by one inlet and perform some computation with the data until a new list arrives or the execution reach a time limit defined by the user as a parameter of the object. 
The method should put whatever value it got to one outlet if it reach the deadline, and wait for new data to arrive. If data arrives before the deadline, the method should abort the ongoing computation and start doing it again with the new data.
I tried this simple example to see if the mechanism will work:

void foo(t_interrupt *x){
    int i=0;
    double timenow = clock_getlogicaltime(); 
    post("timenow =  %f",timenow);
    while(i<=10000)
    {
        i++;
        post("now  =  %f",clock_gettimesince(timenow));        
    }
}

but I only get 0.0000 as outputs... Furthermore, I'm not sure if it will work. Should I make a class that implements the calculation in its own thread? or Pd's scheduling methods will do the job?... 

Any help will be highly appreciated, I've spent in this quite a long time now...

Thanks in advance.


Julian Villegas

University of Aizu
Synthetic Worlds Laboratory
Aizu - Wakamatsu Fukushima
Japan 965 - 8580

Me pregunto de un modo pensativo
Que significa ser colombiano?
No se le respondi. Es un acto de fe
                                        JLB.
		
---------------------------------
Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20060513/eb5aa9ce/attachment.htm>


More information about the Pd-dev mailing list