diff --git a/extra/makefile b/extra/makefile index 56e59bed8e8e98210e925013b76e41a698df0c22..bc913aca44e29f2c765174d849a3eb7c6be9d5ee 100644 --- a/extra/makefile +++ b/extra/makefile @@ -19,7 +19,7 @@ PDNTLIB = $(PDNTLDIR)\libc.lib \ .c.dll: cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c - link /dll /export:$(CSYM)_setup $*.obj $(PDNTLIB) + link /nologo /dll /export:$(CSYM)_setup $*.obj $(PDNTLIB) # ----------------------- IRIX 5.x ----------------------- diff --git a/src/configure.in b/src/configure.in index e328f6aac3c8ab4ccee1057c751372e592fb9e5b..b13379c799f2dd23bb07bf7d410f8d3c1fc40826 100644 --- a/src/configure.in +++ b/src/configure.in @@ -251,7 +251,6 @@ dnl This should be fixed so Pd can use ALSA shared libraries where appropriate. LDFLAGS=$LDFLAGS" -lrt -ljack" fi - echo MORECFLAGS --------------- $MORECFLAGS OSNUMBER=0 fi diff --git a/src/m_sched.c b/src/m_sched.c index 035c0b271d42447cb191b9f49ad514201c7ae2fe..549d3470820c67359c4f9a6f3d21f1bf042e1780 100644 --- a/src/m_sched.c +++ b/src/m_sched.c @@ -28,6 +28,8 @@ int sys_schedblocksize = DEFDACBLKSIZE; int sys_usecsincelastsleep(void); int sys_sleepgrain; +int sched_reopenmeplease = 0; /* request from s_audio for deferred reopen */ + typedef void (*t_clockmethod)(void *client); struct _clock @@ -342,10 +344,13 @@ void sched_set_using_audio(int flag) sched_referencerealtime = sys_getrealtime(); sched_referencelogicaltime = clock_getlogicaltime(); } - if (flag == SCHED_AUDIO_CALLBACK && sched_useaudio != SCHED_AUDIO_CALLBACK) + if (flag == SCHED_AUDIO_CALLBACK && + sched_useaudio != SCHED_AUDIO_CALLBACK) sys_quit = SYS_QUIT_RESTART; - if (flag != SCHED_AUDIO_CALLBACK && sched_useaudio == SCHED_AUDIO_CALLBACK) - post("sorry, can't turn off callbacks yet; restart Pd"); /* not right yet! */ + if (flag != SCHED_AUDIO_CALLBACK && + sched_useaudio == SCHED_AUDIO_CALLBACK) + post("sorry, can't turn off callbacks yet; restart Pd"); + /* not right yet! */ sys_time_per_dsp_tick = (TIMEUNITPERSEC) * ((double)sys_schedblocksize) / sys_dacsr; diff --git a/src/s_audio.c b/src/s_audio.c index b00c0dd6575172a1845eaebbaeece5939aa49ef5..79d56dc94cbc9a3c2feed16c3f947307dad082dd 100644 --- a/src/s_audio.c +++ b/src/s_audio.c @@ -39,7 +39,7 @@ int sys_outchannels; int sys_advance_samples; /* scheduler advance in samples */ int sys_blocksize = 0; /* audio I/O block size in sample frames */ int sys_audioapi = API_DEFAULT; - +int sys_audioapiopened = -1; /* save last API opened for later closing */ static int sys_meters; /* true if we're metering */ static float sys_inmax; /* max input amplitude */ static float sys_outmax; /* max output amplitude */ @@ -68,6 +68,7 @@ static int audio_advance; static int audio_callback; void sched_audio_callbackfn(void); +extern int sched_reopenmeplease; static int audio_isopen(void) { @@ -339,32 +340,33 @@ void sys_close_audio(void) if (!audio_isopen()) return; #ifdef USEAPI_PORTAUDIO - if (sys_audioapi == API_PORTAUDIO) + if (sys_audioapiopened == API_PORTAUDIO) pa_close_audio(); else #endif #ifdef USEAPI_JACK - if (sys_audioapi == API_JACK) + if (sys_audioapiopened == API_JACK) jack_close_audio(); else #endif #ifdef USEAPI_OSS - if (sys_audioapi == API_OSS) + if (sys_audioapiopened == API_OSS) oss_close_audio(); else #endif #ifdef USEAPI_ALSA - if (sys_audioapi == API_ALSA) + if (sys_audioapiopened == API_ALSA) alsa_close_audio(); else #endif #ifdef USEAPI_MMIO - if (sys_audioapi == API_MMIO) + if (sys_audioapiopened == API_MMIO) mmio_close_audio(); else #endif post("sys_close_audio: unknown API %d", sys_audioapi); sys_inchannels = sys_outchannels = 0; + sys_audioapiopened = -1; sched_set_using_audio(SCHED_AUDIO_NONE); } @@ -426,12 +428,14 @@ void sys_reopen_audio( void) { audio_state = 0; sched_set_using_audio(SCHED_AUDIO_NONE); + sys_audioapiopened = -1; } else { audio_state = 1; sched_set_using_audio( (callback ? SCHED_AUDIO_CALLBACK : SCHED_AUDIO_POLL)); + sys_audioapiopened = sys_audioapi; } sys_vgui("set pd_whichapi %d\n", (outcome == 0 ? sys_audioapi : 0)); } @@ -732,13 +736,14 @@ void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) if (newcallback < 0) newcallback = 0; - if (audio_callback == newcallback) + if (!audio_callback && !newcallback) sys_close_audio(); sys_set_audio_settings(nindev, newaudioindev, nindev, newaudioinchan, noutdev, newaudiooutdev, noutdev, newaudiooutchan, newrate, newadvance, (newcallback >= 0 ? newcallback : 0)); - if (audio_callback == newcallback) + if (!audio_callback && !newcallback) sys_reopen_audio(); + else sched_reopenmeplease = 1; } void sys_listdevs(void ) diff --git a/src/s_audio_pa.c b/src/s_audio_pa.c index f05c41d853b1d297e08d89a825ece7b0c1fa05d6..2638597d12422cdeefc588aec8b87af28ab33001 100644 --- a/src/s_audio_pa.c +++ b/src/s_audio_pa.c @@ -36,10 +36,10 @@ static int pa_lowlevel_callback(const void *inputBuffer, int i; unsigned int j; float *fbuf, *fp2, *fp3, *soundiop; - if (framesPerBuffer != DEFDACBLKSIZE) - { - fprintf(stderr, "ignoring buffer size %d\n", framesPerBuffer); - return; + if (framesPerBuffer != DEFDACBLKSIZE) + { + fprintf(stderr, "ignoring buffer size %d\n", framesPerBuffer); + return 0; } if (inputBuffer != NULL) { @@ -51,6 +51,8 @@ static int pa_lowlevel_callback(const void *inputBuffer, } else memset((void *)pa_soundin, 0, framesPerBuffer * pa_inchans * sizeof(float)); + memset((void *)pa_soundout, 0, + framesPerBuffer * pa_outchans * sizeof(float)); (*pa_callback)(); if (outputBuffer != NULL) { @@ -60,7 +62,6 @@ static int pa_lowlevel_callback(const void *inputBuffer, for (j = 0, fp3 = fp2; j < framesPerBuffer; j++, fp3 += pa_outchans) *fp3 = *soundiop++; } - return 0; } diff --git a/src/s_print.c b/src/s_print.c index 1d7695d1e63c6348c00a0fd4dafd4d8705b90047..23bacff27760c89428e8c3f27e68714985582eca 100644 --- a/src/s_print.c +++ b/src/s_print.c @@ -77,8 +77,8 @@ void postatom(int argc, t_atom *argv) int i; for (i = 0; i < argc; i++) { - char buf[80]; - atom_string(argv+i, buf, 80); + char buf[MAXPDSTRING]; + atom_string(argv+i, buf, MAXPDSTRING); poststring(buf); } }