<div dir="ltr">Ah, ok. I also just realized (necessity being the mother of and all that) that I can probably be storing these on the scheme side too, as the actual function object is stored there anyway in a hash-table. <div><br></div><div>Related: in Max they recommend using sysmem_newptr instead of malloc, is there a recommended cross-platform Pd replacement for malloc I should be using? </div><div><br></div><div>thanks!</div><div>iain</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 6, 2021 at 6:52 PM Miller Puckette <<a href="mailto:msp@ucsd.edu">msp@ucsd.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Well, Pd's own scheduler for clocks keeps them in a linked list and chases<br>
down it to set and unset them.  So if you did anything smart for the<br>
scheme callbacks Pd would see to it that it's still linear time in the<br>
number of active callbacks.<br>
<br>
cheers<br>
M<br>
<br>
On Sun, Jun 06, 2021 at 06:22:41PM -0700, Iain Duncan wrote:<br>
> Thanks Miller. That brings up one more question.. ;-)<br>
> <br>
> In Scheme for Max, the way I do it is I keep a hash-table in C going<br>
> with keys that are created on Scheme delay calls, so that one can cancel<br>
> clocks by fetching them from the hashtable. In Max, there's a<br>
> cross-platform hash-table implementation that I'm using. Is there something<br>
> similar for Pd, or if not, is there an approach you would recommend for<br>
> keeping a key-value store in C for the clocks by a symbolic key? I guess a<br>
> good question might be if this is even necessary, given there can't be<br>
> *that* many clocks scheduled for the future. And association list type<br>
> thing might do just as well.<br>
> <br>
> thanks for the help, it's going well, now that I can finally work on it!<br>
> ought to have a first alpha folks can play with in the next couple of weeks.<br>
> iain<br>
> <br>
> <br>
> <br>
> On Sun, Jun 6, 2021 at 5:36 PM Miller Puckette <<a href="mailto:msp@ucsd.edu" target="_blank">msp@ucsd.edu</a>> wrote:<br>
> <br>
> > clock() is the only mechanism - for repeats, the easiest thing is often<br>
> > to just re-use a clock() and re-set it each time it goes off (as in<br>
> > the metro obejct).  You can indeed create clock obejcts on the fly -<br>
> > that's what pipe does.  But you'll want to keep track of them so you can<br>
> > cancel them if the owning object goes away.<br>
> ><br>
> > cheers<br>
> > M<br>
> ><br>
> > On Sun, Jun 06, 2021 at 05:16:09PM -0700, Iain Duncan wrote:<br>
> > > Ah fantastic, thanks. I was looking in pipe and not seeing it, but was<br>
> > > probably just lost in other new details and not seeing the forest for the<br>
> > > trees. :-)<br>
> > ><br>
> > > Couple of follow ups:<br>
> > > - is there a separate facility for making a repeated callback (ie not<br>
> > > one-shot), or does one just do both with clock?<br>
> > > - is it safe to make clocks as we need them (ie during a method call, not<br>
> > > necessarily at object instantiation time), or is this the kind of thing<br>
> > > where for real time use one needs to make a clock pool and a pool manager<br>
> > > and all that?<br>
> > ><br>
> > > thanks!<br>
> > > iain<br>
> > ><br>
> > > On Sun, Jun 6, 2021 at 5:12 PM Miller Puckette <<a href="mailto:msp@ucsd.edu" target="_blank">msp@ucsd.edu</a>> wrote:<br>
> > ><br>
> > > > Yep, clock_delay() .  Simples example is in Pd's "delay" object,<br>
> > x_time.c<br>
> > > ><br>
> > > > cheers<br>
> > > > Miller<br>
> > > ><br>
> > > > On Sun, Jun 06, 2021 at 04:21:46PM -0700, Iain Duncan wrote:<br>
> > > > > Hi folks, I'm hoping someone can point me in the right direction<br>
> > here.<br>
> > > > I'm<br>
> > > > > porting Scheme for Max to pure data and I'm stuck figuring out how<br>
> > to get<br>
> > > > > delayed functions going. In Max, the SDK has a facility to make<br>
> > register<br>
> > > > a<br>
> > > > > callback to executed at some point in the future, a few different<br>
> > ways.<br>
> > > > Is<br>
> > > > > there a Pd equivalent, and if so, could anyone point me at resources<br>
> > or<br>
> > > > > code for it?  I basically just need to be able to have a callback<br>
> > fire<br>
> > > > off<br>
> > > > > at the right time with one argument, which can be void pointer to the<br>
> > > > rest<br>
> > > > > of the stuff i want to get.<br>
> > > > ><br>
> > > > > thanks!<br>
> > > > > iain<br>
> > > ><br>
> > > > > _______________________________________________<br>
> > > > > Pd-dev mailing list<br>
> > > > > <a href="mailto:Pd-dev@lists.iem.at" target="_blank">Pd-dev@lists.iem.at</a><br>
> > > > ><br>
> > > ><br>
> > <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=uekrR-wLMB9CDNku0beRkRmoSJoExinRbBSlb0UQknQ&s=98jkGlO1FFE0Ea5fhSopCbZt6bmZH580Y0IUfgX4Rwk&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=uekrR-wLMB9CDNku0beRkRmoSJoExinRbBSlb0UQknQ&s=98jkGlO1FFE0Ea5fhSopCbZt6bmZH580Y0IUfgX4Rwk&e=</a><br>
> > > ><br>
> > > ><br>
> > > > --<br>
> > > ><br>
> ><br>
> > --<br>
> ><br>
<br>
-- <br>
</blockquote></div>