Thanks Seb and Miller. Good suggestion, I've played with both approaches in the Max version actually. I'll start simple, but thanks for sharing your code Seb, I may move to that later (or add it as another option).
thank again! iain On Mon, Jun 7, 2021 at 3:12 PM Miller Puckette via Pd-dev < [email protected]> wrote: > Seb's way is more work than mine but can achieve much higher performance. > (Incidentally, it's the approack Barry Vercoe took in his synthetic > performer > of 1984 - the 4X gave him, I think, 256 "clocks" and he just used one of > them > to wake him up every millisecond. > > > cheers > Miller > On Mon, Jun 07, 2021 at 09:09:37PM +0000, Sebastian Shader via Pd-dev > wrote: > > In my WIP pdlua scripting library?? > https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_sebshader_lscoreI&d=DwIFaQ&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=fs1umRNWvWKgFPdv579MPzkVXMxlZbPGudp3p96wYcw&s=cOIw7ZYTWKm1EDsWEvU0kO3j05p6m0dXi0R1vNIKRws&e= > use 1 clock from pdlua for timing but then use my own > heap/priority-queue-based scheduler as a wrapper for it.So if I need a new > delay/clock I add it to my own scheduling queue, and then the priority > queue pops the (next time - current time) for the??underlying t_clock that > pdlua uses every time a delay occurs.(and then the clocks are used for > delays within coroutine yields so you can write music)In my case I also > need a lot more manipulations of the scheduling queues though (my next > project is to have 1 scheduling queue peraccelerando/ritardando group so a > tree of descendants of an ancestor coroutine that sprouted them can > accelerando/ritardando together) > > -Seb > > > > -----Original Message----- > > > > Date: Sun, 6 Jun 2021 18:52:17 -0700 > > From: Miller Puckette <[email protected]> > > To: Iain Duncan <[email protected]> > > Cc: pd-dev <[email protected]> > > Subject: Re: [PD-dev] Creating delayed functions in Pd external? > > Message-ID: <[email protected]> > > Content-Type: text/plain; charset=us-ascii > > > > Well, Pd's own scheduler for clocks keeps them in a linked list and > chases > > down it to set and unset them.?? So if you did anything smart for the > > scheme callbacks Pd would see to it that it's still linear time in the > > number of active callbacks. > > > > cheers > > M > > > > On Sun, Jun 06, 2021 at 06:22:41PM -0700, Iain Duncan wrote: > > > Thanks Miller. That brings up one more question.. ;-) > > > > > > In Scheme for Max, the way I do it is I keep a hash-table in C going > > > with keys that are created on Scheme delay calls, so that one can > cancel > > > clocks by fetching them from the hashtable. In Max, there's a > > > cross-platform hash-table implementation that I'm using. Is there > something > > > similar for Pd, or if not, is there an approach you would recommend for > > > keeping a key-value store in C for the clocks by a symbolic key? I > guess a > > > good question might be if this is even necessary, given there can't be > > > *that* many clocks scheduled for the future. And association list type > > > thing might do just as well. > > > > > > thanks for the help, it's going well, now that I can finally work on > it! > > > ought to have a first alpha folks can play with in the next couple of > weeks. > > > iain > > > > > > > > > > > > On Sun, Jun 6, 2021 at 5:36 PM Miller Puckette <[email protected]> wrote: > > > > > > > clock() is the only mechanism - for repeats, the easiest thing is > often > > > > to just re-use a clock() and re-set it each time it goes off (as in > > > > the metro obejct).?? You can indeed create clock obejcts on the fly - > > > > that's what pipe does.?? But you'll want to keep track of them so > you can > > > > cancel them if the owning object goes away. > > > > > > > > cheers > > > > M > > > > > > > > On Sun, Jun 06, 2021 at 05:16:09PM -0700, Iain Duncan wrote: > > > > > Ah fantastic, thanks. I was looking in pipe and not seeing it, but > was > > > > > probably just lost in other new details and not seeing the forest > for the > > > > > trees. :-) > > > > > > > > > > Couple of follow ups: > > > > > - is there a separate facility for making a repeated callback (ie > not > > > > > one-shot), or does one just do both with clock? > > > > > - is it safe to make clocks as we need them (ie during a method > call, not > > > > > necessarily at object instantiation time), or is this the kind of > thing > > > > > where for real time use one needs to make a clock pool and a pool > manager > > > > > and all that? > > > > > > > > > > thanks! > > > > > iain > > > > > > > > > > On Sun, Jun 6, 2021 at 5:12 PM Miller Puckette <[email protected]> > wrote: > > > > > > > > > > > Yep, clock_delay() .?? Simples example is in Pd's "delay" object, > > > > x_time.c > > > > > > > > > > > > cheers > > > > > > Miller > > > > > > > > > > > > On Sun, Jun 06, 2021 at 04:21:46PM -0700, Iain Duncan wrote: > > > > > > > Hi folks, I'm hoping someone can point me in the right > direction > > > > here. > > > > > > I'm > > > > > > > porting Scheme for Max to pure data and I'm stuck figuring out > how > > > > to get > > > > > > > delayed functions going. In Max, the SDK has a facility to make > > > > register > > > > > > a > > > > > > > callback to executed at some point in the future, a few > different > > > > ways. > > > > > > Is > > > > > > > there a Pd equivalent, and if so, could anyone point me at > resources > > > > or > > > > > > > code for it??? I basically just need to be able to have a > callback > > > > fire > > > > > > off > > > > > > > at the right time with one argument, which can be void pointer > to the > > > > > > rest > > > > > > > of the stuff i want to get. > > > > > > > > > > > > > > thanks! > > > > > > > iain > > > > > > > > > > > > > _______________________________________________ > > > > > > > Pd-dev mailing list > > > > > > > [email protected] > > > > > > > > > > > > > > > > > > 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= > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > -- > > > > > > > > -- > > > > > > > > > > > > ------------------------------ > > > > Subject: Digest Footer > > > > _______________________________________________ > > Pd-dev mailing list > > [email protected] > > > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev&d=DwIFaQ&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=fs1umRNWvWKgFPdv579MPzkVXMxlZbPGudp3p96wYcw&s=c7iLNoyLqCFNz1tGOEEPXIR7Tslxiqw9VOa1xGoP_8E&e= > > > > > > ------------------------------ > > > > End of Pd-dev Digest, Vol 194, Issue 4 > > ************************************** > > > _______________________________________________ > > Pd-dev mailing list > > [email protected] > > > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=fs1umRNWvWKgFPdv579MPzkVXMxlZbPGudp3p96wYcw&s=c7iLNoyLqCFNz1tGOEEPXIR7Tslxiqw9VOa1xGoP_8E&e= > > > -- > > > > _______________________________________________ > Pd-dev mailing list > [email protected] > https://lists.puredata.info/listinfo/pd-dev >
_______________________________________________ Pd-dev mailing list [email protected] https://lists.puredata.info/listinfo/pd-dev
