Commit 58a885c9 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

report userful value for "dsp-status" method of [pdinfo] by ignorning suspend/resume states

parent 210c4465
......@@ -1539,7 +1539,7 @@ static void canvas_dsp(t_canvas *x, t_signal **sp)
}
/* this routine starts DSP for all root canvases. */
static void canvas_start_dsp(void)
static void canvas_dostart_dsp(void)
{
t_canvas *x;
if (pd_this->pd_dspstate)
......@@ -1556,7 +1556,13 @@ static void canvas_start_dsp(void)
pd_bang(gensym("pd-dsp-started")->s_thing);
}
static void canvas_stop_dsp(void)
static void canvas_start_dsp(void)
{
pd_this->pd_dspstate_user = 1;
canvas_dostart_dsp();
}
static void canvas_dostop_dsp(void)
{
if (pd_this->pd_dspstate)
{
......@@ -1568,6 +1574,12 @@ static void canvas_stop_dsp(void)
}
}
static void canvas_stop_dsp(void)
{
pd_this->pd_dspstate_user = 0;
canvas_dostop_dsp();
}
/* DSP can be suspended before, and resumed after, operations which
might affect the DSP chain. For example, we suspend before loading and
resume afterward, so that DSP doesn't get resorted for every DSP object
......@@ -1577,14 +1589,14 @@ int canvas_suspend_dsp(void)
{
//fprintf(stderr,"canvas_suspend_dsp %d\n", rval);
int rval = pd_this->pd_dspstate;
if (rval) canvas_stop_dsp();
if (rval) canvas_dostop_dsp();
return (rval);
}
void canvas_resume_dsp(int oldstate)
{
//fprintf(stderr,"canvas_resume_dsp %d\n", oldstate);
if (oldstate) canvas_start_dsp();
if (oldstate) canvas_dostart_dsp();
}
/* this is equivalent to suspending and resuming in one step. */
......
......@@ -64,6 +64,7 @@ struct _pdinstance
int pd_dspchainsize; /* number of elements in DSP chain */
t_canvas *pd_canvaslist; /* list of all root canvases */
int pd_dspstate; /* whether DSP is on or off */
int pd_dspstate_user; /* dsp state excluding temporary suspensions */
t_signal *pd_signals; /* list of signals used by DSP chain */
t_symbol *pd_midiin_sym; /* symbols bound to incoming MIDI... */
t_symbol *pd_sysexin_sym;
......
......@@ -469,6 +469,7 @@ static t_pdinstance *pdinstance_donew(int useprefix)
x->pd_dspchainsize = 0;
x->pd_canvaslist = 0;
x->pd_dspstate = 0;
x->pd_dspstate_user = 0;
x->pd_midiin_sym = midi_gensym(midiprefix, "#midiin");
x->pd_sysexin_sym = midi_gensym(midiprefix, "#sysexin");
x->pd_notein_sym = midi_gensym(midiprefix, "#notein");
......
......@@ -535,10 +535,13 @@ void pdinfo_dir(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv)
info_out((t_text *)x, s, 1, at);
}
/* Instead of reporting the actual value for dsp when it's temporarily
suspended, we report what it will be when dsp is resumed. This way the
user can get a meaningful value at load time. */
void pdinfo_dsp(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv)
{
t_atom at[1];
SETFLOAT(at, (t_float)pd_getdspstate());
SETFLOAT(at, (t_float)(pd_this->pd_dspstate_user));
info_out((t_text *)x, s, 1, at);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment