Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10552
Modified Files: Tag: devel_0_39 g_canvas.c m_sched.c s_audio.c s_audio_jack.c s_inter.c s_loader.c Log Message: smoother scheduler changes switch dsp off during loading of files / externals
Index: s_loader.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_loader.c,v retrieving revision 1.4.4.5.2.1 retrieving revision 1.4.4.5.2.2 diff -C2 -d -r1.4.4.5.2.1 -r1.4.4.5.2.2 *** s_loader.c 12 Jul 2005 15:11:11 -0000 1.4.4.5.2.1 --- s_loader.c 14 Jul 2005 23:17:33 -0000 1.4.4.5.2.2 *************** *** 54,57 **** --- 54,58 ---- t_xxx makeout = NULL; int fd; + int dspstate = canvas_suspend_dsp(); #ifdef MSW HINSTANCE ntdll; *************** *** 73,77 **** dirbuf, &nameptr, MAXPDSTRING, 1)) < 0) { ! return (0); } } --- 74,79 ---- dirbuf, &nameptr, MAXPDSTRING, 1)) < 0) { ! canvas_resume_dsp(dspstate); ! return (0); } } *************** *** 119,122 **** --- 121,125 ---- post("%s: couldn't load", filename); class_set_extern_dir(&s_); + canvas_resume_dsp(dspstate); return (0); } *************** *** 144,147 **** --- 147,151 ---- post("%s: couldn't load (%s)", filename,errcode); class_set_extern_dir(&s_); + canvas_resume_dsp(dspstate); return 0; } *************** *** 157,160 **** --- 161,165 ---- NSLinkEditError(&c, &err, &fname, &errt); post("link error %d %s %s", err, fname, errt); + canvas_resume_dsp(dspstate); return 0; } *************** *** 170,177 **** post("load_object: Symbol "%s" not found", symname); class_set_extern_dir(&s_); ! return 0; } (*makeout)(); class_set_extern_dir(&s_); return (1); } --- 175,184 ---- post("load_object: Symbol "%s" not found", symname); class_set_extern_dir(&s_); ! canvas_resume_dsp(dspstate); ! return 0; } (*makeout)(); class_set_extern_dir(&s_); + canvas_resume_dsp(dspstate); return (1); }
Index: m_sched.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_sched.c,v retrieving revision 1.5.4.35.2.3 retrieving revision 1.5.4.35.2.4 diff -C2 -d -r1.5.4.35.2.3 -r1.5.4.35.2.4 *** m_sched.c 13 Jul 2005 22:49:39 -0000 1.5.4.35.2.3 --- m_sched.c 14 Jul 2005 23:17:33 -0000 1.5.4.35.2.4 *************** *** 421,425 **** void dsp_tick(void);
! static int sched_usedacs = 1; static double sched_referencerealtime, sched_referencelogicaltime; double sys_time_per_dsp_tick; --- 421,425 ---- void dsp_tick(void);
! static int sched_usedacs = 0; static double sched_referencerealtime, sched_referencelogicaltime; double sys_time_per_dsp_tick; *************** *** 500,508 **** sys_update_sleepgrain();
sys_initmidiqueue();
while (!sys_quit) { ! if (!sys_callbackscheduler) while (sys_keepsched) { --- 500,510 ---- sys_update_sleepgrain();
+ sched_set_using_dacs(0); /* tb: dsp is switched off */ + sys_initmidiqueue();
while (!sys_quit) { ! if (!sys_callbackscheduler || !sched_usedacs) while (sys_keepsched) { *************** *** 583,586 **** --- 585,589 ----
sys_pollmidiqueue(); + sys_setmiditimediff(0, 1e-6 * sys_schedadvance); if (run_clock_callbacks(sys_time))
Index: s_inter.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_inter.c,v retrieving revision 1.5.4.10.2.3 retrieving revision 1.5.4.10.2.4 diff -C2 -d -r1.5.4.10.2.3 -r1.5.4.10.2.4 *** s_inter.c 13 Jul 2005 22:49:39 -0000 1.5.4.10.2.3 --- s_inter.c 14 Jul 2005 23:17:33 -0000 1.5.4.10.2.4 *************** *** 1396,1400 **** } ! sys_microsleep(6e7); /* and sleep for another 60 seconds */ } } --- 1396,1400 ---- } ! sys_microsleep(1.5e7); /* and sleep for another 15 seconds */ } }
Index: s_audio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v retrieving revision 1.5.4.16 retrieving revision 1.5.4.16.2.1 diff -C2 -d -r1.5.4.16 -r1.5.4.16.2.1 *** s_audio.c 15 May 2005 19:03:37 -0000 1.5.4.16 --- s_audio.c 14 Jul 2005 23:17:33 -0000 1.5.4.16.2.1 *************** *** 445,448 **** --- 445,450 ---- post("sys_close_audio: unknown API %d", sys_audioapi); sys_inchannels = sys_outchannels = 0; + + sched_set_using_dacs(0); /* tb: dsp is switched off */ }
*************** *** 898,912 **** { if (!audio_isopen()) ! sys_reopen_audio(); } else { if (audio_isopen()) - { sys_close_audio(); - sched_set_using_dacs(0); - } } ! audio_state = onoff; }
--- 900,913 ---- { if (!audio_isopen()) ! sys_reopen_audio(); } else { if (audio_isopen()) sys_close_audio(); } ! sched_set_using_dacs(onoff); ! sys_setscheduler(sys_getscheduler()); /* tb: reset scheduler */ ! audio_state = onoff; }
Index: s_audio_jack.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio_jack.c,v retrieving revision 1.5.4.8.2.1 retrieving revision 1.5.4.8.2.2 diff -C2 -d -r1.5.4.8.2.1 -r1.5.4.8.2.2 *** s_audio_jack.c 12 Jul 2005 15:11:10 -0000 1.5.4.8.2.1 --- s_audio_jack.c 14 Jul 2005 23:17:33 -0000 1.5.4.8.2.2 *************** *** 84,87 **** --- 84,89 ---- static void (*zeroblock)(t_sample *dst,int n);
+ extern int canvas_dspstate; + static int cb_process (jack_nframes_t nframes, void *arg) { *************** *** 89,92 **** --- 91,106 ---- int timeout = nframes * 1e6 / sys_dacsr; + if (canvas_dspstate == 0) + { + for (j = 0; j < sys_outchannels; j++) + { + t_sample * out = jack_port_get_buffer (output_port[j], nframes); + zeroblock(out, dspticks_per_jacktick * sys_dacblocksize); + } + + sys_time += sys_time_per_dsp_tick; + return 0; + } + int status = sys_timedlock(timeout); *************** *** 482,486 **** { int i; - sys_setscheduler(0); jack_deactivate(jack_client); jack_started = 0; --- 496,499 ----
Index: g_canvas.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_canvas.c,v retrieving revision 1.4.4.1.2.3 retrieving revision 1.4.4.1.2.4 diff -C2 -d -r1.4.4.1.2.3 -r1.4.4.1.2.4 *** g_canvas.c 12 Jul 2005 15:11:07 -0000 1.4.4.1.2.3 --- g_canvas.c 14 Jul 2005 23:17:33 -0000 1.4.4.1.2.4 *************** *** 50,54 **** extern t_pd *newest; t_class *canvas_class; ! static int canvas_dspstate; /* whether DSP is on or off */ t_canvas *canvas_editing; /* last canvas to start text edting */ t_canvas *canvas_whichfind; /* last canvas we did a find in */ --- 50,54 ---- extern t_pd *newest; t_class *canvas_class; ! int canvas_dspstate; /* whether DSP is on or off */ t_canvas *canvas_editing; /* last canvas to start text edting */ t_canvas *canvas_whichfind; /* last canvas we did a find in */