[PD-dev] dsp_tick() in d_ugen.c

Jarbas Jacome jandila at gmail.com
Wed Dec 6 22:56:37 CET 2006


Hello, brothers! Tudo beleza?

I'm trying to understand the DSP scheduling. I think my questions are
similar to Tim Blechmann ones two years before:
http://lists.puredata.info/pipermail/pd-dev/2004-04/002407.html

Please, help me:

someone calls canvas_dodsp function (question 1: who? when?)

g_canvas.c
canvas_dodsp (...)
{
    /* create a new "DSP graph" object to use in sorting this canvas.
    dc = ugen_start_graph(...);

    /* finally, sort them and add them to the DSP chain */
    ugen_done_graph(dc);
}

d_ugen.c
ugen_done_graph (...)
{
    ugendoit() for each unit
}

ugen_doit (...)
{

    calls mess1(&u->u_obj->ob_pd, gensym("dsp"), insig) --> question
2: This is calling dsp_add() to add each dsp object perform function
in dsp_chain. Isnt it?

question 3: So, does it call "canvas_dodsp" when the object is the
canvas? (If yes this answers question 1). :D

}

But my main doubt is:

question 4: where is the code which finally execute the dsp
calculations, i. e. the code which call the perform functions of each
object?

I think is this one, called by Pd main loop:
m_scheduler()
which calls sched_tick()
which calls dsp_tick()

void dsp_tick(void)
{
    if (dsp_chain)
    {
        t_int *ip;
        for (ip = dsp_chain; *ip; ) ip = (*(t_perfroutine)(*ip))(ip);
---> chain execution?
        dsp_phase++;
    }
}

is it correct?

THANX, BRO!

j.jR.




More information about the Pd-dev mailing list