Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12807/src
Modified Files: CHANGELOG.txt configure.in m_pd.h m_sched.c makefile.nt s_audio.c s_audio_mmio.c s_audio_pa.c s_audio_pablio.c s_file.c s_inter.c s_main.c s_midi_pm.c s_stuff.h t_tkcmd.c u_main.tk x_arithmetic.c Removed Files: makefile.dependencies Log Message: Download and adjust sources for new portaudio, portmidi. Add experimental callback scheduling.
Index: x_arithmetic.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/x_arithmetic.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** x_arithmetic.c 15 Aug 2006 04:54:15 -0000 1.4 --- x_arithmetic.c 18 Aug 2007 23:32:44 -0000 1.5 *************** *** 582,588 **** { t_atan2 *x = (t_atan2 *)pd_new(atan2_class); - static int warned; - if (!warned) - post("warning: atan2 inlets switched from Pd 0.37 to 0.38"), warned=1; floatinlet_new(&x->x_ob, &x->x_f); x->x_f = 0; --- 582,585 ----
Index: configure.in =================================================================== RCS file: /cvsroot/pure-data/pd/src/configure.in,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** configure.in 2 Aug 2007 00:33:50 -0000 1.24 --- configure.in 18 Aug 2007 23:32:43 -0000 1.25 *************** *** 41,45 **** AC_ARG_ENABLE(setuid, [ --enable-setuid install as setuid (linux)], setuid=$enableval) ! AC_ARG_ENABLE(fftw, [ --enable-fftw use FFTW package], fftw=$enableval)
--- 41,45 ---- AC_ARG_ENABLE(setuid, [ --enable-setuid install as setuid (linux)], setuid=$enableval) ! AC_ARG_ENABLE(fftw, [ --enable-fftw use FFTW package], fftw=$enableval)
*************** *** 186,192 **** CPPFLAGS="-DDL_OPEN -DPA_USE_OSS -DUNIX -DUNISTD\ -DUSEAPI_OSS \ - -I../portaudio/pa_common -I../portaudio/pablio \ - -I../portmidi/pm_common \ - -I../portmidi/pm_linux \ -fno-strict-aliasing" SYSSRC="s_midi_oss.c s_audio_oss.c" --- 186,189 ---- *************** *** 198,227 **** fi
- if test x$portaudio == "xyes"; - - then ! CPPFLAGS=$CPPFLAGS" -DUSEAPI_PORTAUDIO -DPA19" SYSSRC="s_audio_pa.c \ s_audio_pablio.c \ s_audio_paring.c \ ! ../portaudio/pa_common/pa_allocation.c \ ! ../portaudio/pa_common/pa_converters.c \ ! ../portaudio/pa_common/pa_cpuload.c \ ! ../portaudio/pa_common/pa_dither.c \ ! ../portaudio/pa_common/pa_front.c \ ! ../portaudio/pa_common/pa_process.c \ ! ../portaudio/pa_common/pa_skeleton.c \ ! ../portaudio/pa_common/pa_stream.c \ ! ../portaudio/pa_common/pa_trace.c \ ! ../portaudio/pa_unix/pa_unix_hostapis.c \ ! ../portaudio/pa_unix/pa_unix_util.c \ ! ../portaudio/pa_unix_oss/pa_unix_oss.c "$SYSSRC if test x$alsa == "xyes"; then ! SYSSRC=$SYSSRC" ../portaudio/pa_linux_alsa/pa_linux_alsa.c" ! CPPFLAGS=$CPPFLAGS" -Wno-error" ! fi fi if test x$setuid == "xyes"; --- 195,233 ---- fi
if test x$portaudio == "xyes"; then ! CPPFLAGS=$CPPFLAGS" -DUSEAPI_PORTAUDIO -DHAVE_SYS_SOUNDCARD_H \ ! -Wno-error \ ! -I../portaudio/include -I../portaudio/src/common \ ! -I../portaudio/src/os/unix/ \ ! -I../portmidi/pm_common \ ! -I../portmidi/pm_linux" SYSSRC="s_audio_pa.c \ s_audio_pablio.c \ s_audio_paring.c \ ! ../portaudio/src/common/pa_allocation.c \ ! ../portaudio/src/common/pa_converters.c \ ! ../portaudio/src/common/pa_cpuload.c \ ! ../portaudio/src/common/pa_dither.c \ ! ../portaudio/src/common/pa_front.c \ ! ../portaudio/src/common/pa_process.c \ ! ../portaudio/src/common/pa_skeleton.c \ ! ../portaudio/src/common/pa_stream.c \ ! ../portaudio/src/common/pa_trace.c \ ! ../portaudio/src/common/pa_debugprint.c \ ! ../portaudio/src/common/pa_ringbuffer.c \ ! ../portaudio/src/os/unix/pa_unix_hostapis.c \ ! ../portaudio/src/os/unix/pa_unix_util.c \ ! ../portaudio/src/hostapi/oss/pa_unix_oss.c "$SYSSRC if test x$alsa == "xyes"; then ! SYSSRC="../portaudio/src/hostapi/alsa/pa_linux_alsa.c "$SYSSRC ! CPPFLAGS=$CPPFLAGS" -DPA_USE_ALSA" ! fi ! if test x$jack == "xyes"; ! then ! SYSSRC="../portaudio/src/hostapi/jack/pa_jack.c "$SYSSRC ! CPPFLAGS=$CPPFLAGS" -DPA_USE_JACK" ! fi fi if test x$setuid == "xyes"; *************** *** 258,265 **** EXT=pd_darwin CPPFLAGS="-DDL_OPEN -DMACOSX -DUNISTD -I/usr/X11R6/include \ ! -I../portaudio/pa_common -I../portaudio/pablio \ -I../portmidi/pm_common -I../portmidi/pm_mac \ -I../portmidi/porttime \ ! -DUSEAPI_PORTAUDIO -DPA19 -DPA_USE_COREAUDIO" if test `uname -r` = 7.9.0; then --- 264,272 ---- EXT=pd_darwin CPPFLAGS="-DDL_OPEN -DMACOSX -DUNISTD -I/usr/X11R6/include \ ! -I../portaudio/include -I../portaudio/src/common \ ! -I../portaudio/src/os/mac_osx/ \ -I../portmidi/pm_common -I../portmidi/pm_mac \ -I../portmidi/porttime \ ! -DUSEAPI_PORTAUDIO -DPA19 -DPA_USE_COREAUDIO -DNEWBUFFER" if test `uname -r` = 7.9.0; then *************** *** 275,290 **** s_audio_pablio.c \ s_audio_paring.c \ ! ../portaudio/pa_common/pa_allocation.c \ ! ../portaudio/pa_common/pa_converters.c \ ! ../portaudio/pa_common/pa_cpuload.c \ ! ../portaudio/pa_common/pa_dither.c \ ! ../portaudio/pa_common/pa_front.c \ ! ../portaudio/pa_common/pa_process.c \ ! ../portaudio/pa_common/pa_skeleton.c \ ! ../portaudio/pa_common/pa_stream.c \ ! ../portaudio/pa_common/pa_trace.c \ ! ../portaudio/pa_unix/pa_unix_util.c \ ! ../portaudio/pa_mac_core/pa_mac_core.c \ ! ../portaudio/pa_mac/pa_mac_hostapis.c \ ../portmidi/pm_mac/pmmac.c \ ../portmidi/pm_mac/pmmacosxcm.c \ --- 282,301 ---- s_audio_pablio.c \ s_audio_paring.c \ ! ../portaudio/src/common/pa_allocation.c \ ! ../portaudio/src/common/pa_converters.c \ ! ../portaudio/src/common/pa_cpuload.c \ ! ../portaudio/src/common/pa_dither.c \ ! ../portaudio/src/common/pa_front.c \ ! ../portaudio/src/common/pa_process.c \ ! ../portaudio/src/common/pa_skeleton.c \ ! ../portaudio/src/common/pa_stream.c \ ! ../portaudio/src/common/pa_trace.c \ ! ../portaudio/src/common/pa_debugprint.c \ ! ../portaudio/src/common/pa_ringbuffer.c \ ! ../portaudio/src/os/unix/pa_unix_util.c \ ! ../portaudio/src/os/mac_osx/pa_mac_hostapis.c \ ! ../portaudio/src/hostapi/coreaudio/pa_mac_core.c \ ! ../portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c \ ! ../portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.c \ ../portmidi/pm_mac/pmmac.c \ ../portmidi/pm_mac/pmmacosxcm.c \ *************** *** 336,340 **** EXT=dll MORECFLAGS="-DUSEAPI_PORTAUDIO -DPA19 -DMSW -DPA_NO_DS -DPD_INTERNAL \ ! -I../portaudio/pa_common -I../portaudio/pablio \ -mwindows -mms-bitfields "$MORECFLAGS PDLIB=$PDLIB" -lwsock32 -lwinmm -lole32 -lstdc++" --- 347,352 ---- EXT=dll MORECFLAGS="-DUSEAPI_PORTAUDIO -DPA19 -DMSW -DPA_NO_DS -DPD_INTERNAL \ ! -I../portaudio/include -I../portaudio/src/common \ ! -I../portaudio/src/os/win/ \ -mwindows -mms-bitfields "$MORECFLAGS PDLIB=$PDLIB" -lwsock32 -lwinmm -lole32 -lstdc++" *************** *** 342,359 **** SYSSRC="s_audio_pa.c s_audio_pablio.c s_audio_paring.c \ s_audio_mmio.c s_midi_mmio.c \ ! ../portaudio/pa_common/pa_allocation.c \ ! ../portaudio/pa_common/pa_converters.c \ ! ../portaudio/pa_common/pa_cpuload.c \ ! ../portaudio/pa_common/pa_dither.c \ ! ../portaudio/pa_common/pa_front.c \ ! ../portaudio/pa_common/pa_process.c \ ! ../portaudio/pa_common/pa_skeleton.c \ ! ../portaudio/pa_common/pa_stream.c \ ! ../portaudio/pa_common/pa_trace.c \ ! ../portaudio/pa_win/pa_win_util.c \ ! ../portaudio/pa_win/pa_win_hostapis.c \ ! ../portaudio/pa_win_wmme/pa_win_wmme.c" ! ASIOSRC="../portaudio/pa_asio/iasiothiscallresolver.cpp \ ! ../portaudio/pa_asio/pa_asio.cpp ../asio/asio.cpp \ ../asio/asiodrivers.cpp ../asio/asiolist.cpp" STRIPFLAG="--strip-unneeded" --- 354,374 ---- SYSSRC="s_audio_pa.c s_audio_pablio.c s_audio_paring.c \ s_audio_mmio.c s_midi_mmio.c \ ! ../portaudio/src/common/pa_allocation.c \ ! ../portaudio/src/common/pa_converters.c \ ! ../portaudio/src/common/pa_cpuload.c \ ! ../portaudio/src/common/pa_dither.c \ ! ../portaudio/src/common/pa_front.c \ ! ../portaudio/src/common/pa_process.c \ ! ../portaudio/src/common/pa_skeleton.c \ ! ../portaudio/src/common/pa_stream.c \ ! ../portaudio/src/common/pa_trace.c \ ! ../portaudio/src/common/pa_debugprint.c \ ! ../portaudio/src/common/pa_ringbuffer.c \ ! ../portaudio/src/os/win/pa_win_util.c \ ! ../portaudio/src/os/win/pa_win_hostapis.c \ ! ../portaudio/src/os/win/pa_x86_plain_converters.c \ ! ../portaudio/src/hostapi/wmme/pa_win_wmme.c" ! ASIOSRC="../portaudio/src/hostapi/asio/iasiothiscallresolver.cpp \ ! ../portaudio/src/hostapi/pa_asio/asio.cpp ../asio/asio.cpp \ ../asio/asiodrivers.cpp ../asio/asiolist.cpp" STRIPFLAG="--strip-unneeded" *************** *** 383,398 **** fi
- # extra flags for alpha machines - if test `uname -m | awk '{print $1}'` = alpha; - then - MORECFLAGS=$MORECFLAGS" -mieee -mcpu=ev56" - fi - - # test for compaq compiler---not sure what this does or how to test it. - if test x$CC == xccc; - then - MORECFLAGS=$MORECFLAGS" -g3 -D__COMPAQC__ -arch host" - fi - ## JMZ{ ## this does not do very much, but i guess it is a good idea to use it... --- 398,401 ----
Index: s_main.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_main.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** s_main.c 20 Jul 2007 03:25:20 -0000 1.30 --- s_main.c 18 Aug 2007 23:32:44 -0000 1.31 *************** *** 32,36 **** int sys_startgui(const char *guipath); int sys_rcfile(void); ! int m_scheduler(void); void sys_addhelppath(char *p); #ifdef USEAPI_ALSA --- 32,36 ---- int sys_startgui(const char *guipath); int sys_rcfile(void); ! int m_mainloop(void); void sys_addhelppath(char *p); #ifdef USEAPI_ALSA *************** *** 44,47 **** --- 44,48 ---- int sys_hipriority = -1; /* -1 = don't care; 0 = no; 1 = yes */ int sys_guisetportnumber; /* if started from the GUI, this is the port # */ + int sys_nosleep = 0; /* skip all "sleep" calls and spin instead */
char *sys_guicmd; *************** *** 61,64 **** --- 62,66 ---- static int sys_main_srate; static int sys_main_advance; + static int sys_main_callback; static int sys_listplease;
*************** *** 70,74 ****
/* here the "-1" counts signify that the corresponding vector hasn't been ! specified in command line arguments; sys_open_audio will detect this and fill things in. */ static int sys_nsoundin = -1; --- 72,76 ----
/* here the "-1" counts signify that the corresponding vector hasn't been ! specified in command line arguments; sys_set_audio_settings will detect it and fill things in. */ static int sys_nsoundin = -1; *************** *** 82,86 **** static int sys_choutlist[MAXAUDIOOUTDEV];
- int sys_nosleep = 0; /* skip all "sleep" calls and spin instead */ t_sample* get_sys_soundout() { return sys_soundout; } t_sample* get_sys_soundin() { return sys_soundin; } --- 84,87 ---- *************** *** 314,318 **** sys_reopen_audio(); /* run scheduler until it quits */ ! return (m_scheduler()); } } --- 315,319 ---- sys_reopen_audio(); /* run scheduler until it quits */ ! return (m_mainloop()); } } *************** *** 581,584 **** --- 582,590 ---- argc -= 2; argv += 2; } + else if (!strcmp(*argv, "-callback")) + { + sys_main_callback = 1; + argc--; argv++; + } else if (!strcmp(*argv, "-blocksize")) { *************** *** 900,904 **** int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; ! int nchindev, nchoutdev, rate, advance; int nmidiindev = 0, midiindev[MAXMIDIINDEV]; int nmidioutdev = 0, midioutdev[MAXMIDIOUTDEV]; --- 906,910 ---- int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; ! int nchindev, nchoutdev, rate, advance, callback; int nmidiindev = 0, midiindev[MAXMIDIINDEV]; int nmidioutdev = 0, midioutdev[MAXMIDIOUTDEV]; *************** *** 936,940 **** of argument parsing, and store them again. */ sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &advance); if (sys_nchin >= 0) { --- 942,946 ---- of argument parsing, and store them again. */ sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback); if (sys_nchin >= 0) { *************** *** 982,987 **** if (sys_main_srate) rate = sys_main_srate; ! sys_open_audio(naudioindev, audioindev, nchindev, chindev, ! naudiooutdev, audiooutdev, nchoutdev, choutdev, rate, advance, 0); sys_open_midi(nmidiindev, midiindev, nmidioutdev, midioutdev, 0); } --- 988,996 ---- if (sys_main_srate) rate = sys_main_srate; ! if (sys_main_callback) ! callback = sys_main_callback; ! sys_set_audio_settings(naudioindev, audioindev, nchindev, chindev, ! naudiooutdev, audiooutdev, nchoutdev, choutdev, rate, advance, ! callback); sys_open_midi(nmidiindev, midiindev, nmidioutdev, midioutdev, 0); }
Index: u_main.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** u_main.tk 2 Aug 2007 00:33:50 -0000 1.27 --- u_main.tk 18 Aug 2007 23:32:44 -0000 1.28 *************** *** 3480,3484 **** global audio_outchan1 audio_outchan2 audio_outchan3 audio_outchan4 global audio_outenable1 audio_outenable2 audio_outenable3 audio_outenable4 ! global audio_sr audio_advance
pd [concat pd audio-dialog \ --- 3480,3484 ---- global audio_outchan1 audio_outchan2 audio_outchan3 audio_outchan4 global audio_outenable1 audio_outenable2 audio_outenable3 audio_outenable4 ! global audio_sr audio_advance audio_callback
pd [concat pd audio-dialog \ *************** *** 3501,3504 **** --- 3501,3505 ---- $audio_sr \ $audio_advance \ + $audio_callback \ ;] } *************** *** 3544,3548 **** inchan1 inchan2 inchan3 inchan4 \ outdev1 outdev2 outdev3 outdev4 \ ! outchan1 outchan2 outchan3 outchan4 sr advance multi longform} { global audio_indev1 audio_indev2 audio_indev3 audio_indev4 global audio_inchan1 audio_inchan2 audio_inchan3 audio_inchan4 --- 3545,3550 ---- inchan1 inchan2 inchan3 inchan4 \ outdev1 outdev2 outdev3 outdev4 \ ! outchan1 outchan2 outchan3 outchan4 sr advance multi callback \ ! longform} { global audio_indev1 audio_indev2 audio_indev3 audio_indev4 global audio_inchan1 audio_inchan2 audio_inchan3 audio_inchan4 *************** *** 3551,3555 **** global audio_outchan1 audio_outchan2 audio_outchan3 audio_outchan4 global audio_outenable1 audio_outenable2 audio_outenable3 audio_outenable4 ! global audio_sr audio_advance global audio_indevlist audio_outdevlist global pd_indev pd_outdev --- 3553,3557 ---- global audio_outchan1 audio_outchan2 audio_outchan3 audio_outchan4 global audio_outenable1 audio_outenable2 audio_outenable3 audio_outenable4 ! global audio_sr audio_advance audio_callback global audio_indevlist audio_outdevlist global pd_indev pd_outdev *************** *** 3585,3589 **** set audio_sr $sr set audio_advance $advance ! toplevel $id wm title $id {audio} --- 3587,3591 ---- set audio_sr $sr set audio_advance $advance ! set audio_callback $callback toplevel $id wm title $id {audio} *************** *** 3598,3604 **** button $id.buttonframe.ok -text {OK}\ -command "audio_ok $id" ! pack $id.buttonframe.cancel -side left -expand 1 ! pack $id.buttonframe.apply -side left -expand 1 ! pack $id.buttonframe.ok -side left -expand 1
# sample rate and advance --- 3600,3607 ---- button $id.buttonframe.ok -text {OK}\ -command "audio_ok $id" ! button $id.buttonframe.save -text {Save all settings}\ ! -command "audio_apply $id ; pd pd save-preferences \;" ! pack $id.buttonframe.cancel $id.buttonframe.apply $id.buttonframe.ok \ ! $id.buttonframe.save -side left -expand 1
# sample rate and advance *************** *** 3611,3615 **** entry $id.srf.x2 -textvariable audio_advance -width 4 pack $id.srf.l1 $id.srf.x1 $id.srf.l2 $id.srf.x2 -side left ! # input device 1 frame $id.in1f --- 3614,3622 ---- entry $id.srf.x2 -textvariable audio_advance -width 4 pack $id.srf.l1 $id.srf.x1 $id.srf.l2 $id.srf.x2 -side left ! if {$audio_callback >= 0} { ! checkbutton $id.srf.x3 -variable audio_callback \ ! -text {use callbacks} -anchor e ! pack $id.srf.x3 -side left ! } # input device 1 frame $id.in1f
Index: s_stuff.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_stuff.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** s_stuff.h 15 Aug 2006 04:54:15 -0000 1.10 --- s_stuff.h 18 Aug 2007 23:32:44 -0000 1.11 *************** *** 72,79 **** extern int sys_schedadvance; extern int sys_sleepgrain; ! void sys_open_audio(int naudioindev, int *audioindev, int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, ! int srate, int advance, int enable); void sys_reopen_audio( void); void sys_close_audio(void); --- 72,79 ---- extern int sys_schedadvance; extern int sys_sleepgrain; ! void sys_set_audio_settings(int naudioindev, int *audioindev, int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, ! int srate, int advance, int callback); void sys_reopen_audio( void); void sys_close_audio(void); *************** *** 140,144 **** #define ERR_RESYNC 3 #define ERR_DATALATE 4 ! void sched_set_using_dacs(int flag);
/* s_inter.c */ --- 140,148 ---- #define ERR_RESYNC 3 #define ERR_DATALATE 4 ! ! #define SCHED_AUDIO_NONE 0 ! #define SCHED_AUDIO_POLL 1 ! #define SCHED_AUDIO_CALLBACK 2 ! void sched_set_using_audio(int flag);
/* s_inter.c */ *************** *** 206,212 **** #endif
int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, t_sample *soundout, int framesperbuf, int nbuffers, ! int indeviceno, int outdeviceno); void pa_close_audio(void); int pa_send_dacs(void); --- 210,218 ---- #endif
+ typedef void (*t_audiocallback)(void); + int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, t_sample *soundout, int framesperbuf, int nbuffers, ! int indeviceno, int outdeviceno, t_audiocallback callback); void pa_close_audio(void); int pa_send_dacs(void); *************** *** 246,250 **** void jack_listdevs(void);
! void mmio_open_audio(int naudioindev, int *audioindev, int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, int rate); --- 252,256 ---- void jack_listdevs(void);
! int mmio_open_audio(int naudioindev, int *audioindev, int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, int rate); *************** *** 270,278 **** int *pnaudioindev, int *paudioindev, int *chindev, int *pnaudiooutdev, int *paudiooutdev, int *choutdev, ! int *prate, int *padvance); void sys_save_audio_params( int naudioindev, int *audioindev, int *chindev, int naudiooutdev, int *audiooutdev, int *choutdev, ! int rate, int advance);
/* s_file.c */ --- 276,284 ---- int *pnaudioindev, int *paudioindev, int *chindev, int *pnaudiooutdev, int *paudiooutdev, int *choutdev, ! int *prate, int *padvance, int *callback); void sys_save_audio_params( int naudioindev, int *audioindev, int *chindev, int naudiooutdev, int *audiooutdev, int *choutdev, ! int rate, int advance, int callback);
/* s_file.c */
Index: s_inter.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_inter.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** s_inter.c 20 Jul 2007 03:25:20 -0000 1.19 --- s_inter.c 18 Aug 2007 23:32:44 -0000 1.20 *************** *** 1081,1084 **** --- 1081,1088 ---- /* Perform the same search among system applications. */ strcpy(filename, + "/usr/bin/wish"); + if (stat(filename, &statbuf) >= 0) + goto foundit; + strcpy(filename, "/Applications/Utilities/Wish Shell.app/Contents/MacOS/Wish Shell"); if (stat(filename, &statbuf) >= 0)
Index: CHANGELOG.txt =================================================================== RCS file: /cvsroot/pure-data/pd/src/CHANGELOG.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CHANGELOG.txt 8 Sep 2006 23:45:30 -0000 1.5 --- CHANGELOG.txt 18 Aug 2007 23:32:43 -0000 1.6 *************** *** 3,6 **** --- 3,10 ---- for original notes on source stype and organization.
+ 0.41.0 + + add support for callback-based audio I/O; changes in + 0.40.0
Index: makefile.nt =================================================================== RCS file: /cvsroot/pure-data/pd/src/makefile.nt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** makefile.nt 20 Jul 2007 03:25:20 -0000 1.10 --- makefile.nt 18 Aug 2007 23:32:44 -0000 1.11 *************** *** 39,55 ****
PADIR = ..\portaudio ! INCPA = -I$(PADIR) -I$(PADIR)\pa_common -I$(PADIR)\pablio -I..\lib\asio ! SRCPA = $(PADIR)/pa_common/pa_stream.c \ ! $(PADIR)/pa_common/pa_trace.c \ ! $(PADIR)/pa_common/pa_skeleton.c \ ! $(PADIR)/pa_common/pa_process.c \ ! $(PADIR)/pa_common/pa_front.c \ ! $(PADIR)/pa_common/pa_dither.c \ ! $(PADIR)/pa_common/pa_cpuload.c \ ! $(PADIR)/pa_common/pa_converters.c \ ! $(PADIR)/pa_common/pa_allocation.c \ ! $(PADIR)/pa_win/pa_win_util.c \ ! $(PADIR)/pa_win/pa_win_hostapis.c \ ! $(PADIR)/pa_win_wmme/pa_win_wmme.c # $(PADIR)/pa_win_wdmks/pa_win_wdmks.c
--- 39,56 ----
PADIR = ..\portaudio ! INCPA = -I$(PADIR)\include -I$(PADIR)\src\common -I..\lib\asio ! PASRC = $(PADIR)\src ! SRCPA = $(PASRC)/common/pa_stream.c \ ! $(PASRC)/common/pa_trace.c \ ! $(PASRC)/common/pa_skeleton.c \ ! $(PASRC)/common/pa_process.c \ ! $(PASRC)/common/pa_front.c \ ! $(PASRC)/common/pa_dither.c \ ! $(PASRC)/common/pa_cpuload.c \ ! $(PASRC)/common/pa_converters.c \ ! $(PASRC)/common/pa_allocation.c \ ! $(PASRC)/os/win/pa_win_hostapis.c \ ! $(PASRC)/os/win/pa_win_util.c \ ! $(PASRC)/hostapi/wmme/pa_win_wmme.c # $(PADIR)/pa_win_wdmks/pa_win_wdmks.c
*************** *** 64,73 **** PAOBJ = pa_stream.obj pa_trace.obj pa_skeleton.obj pa_process.obj \ pa_front.obj pa_dither.obj pa_cpuload.obj pa_converters.obj \ ! pa_allocation.obj pa_win_util.obj pa_win_hostapis.obj pa_asio.obj \ pa_win_wmme.obj # pa_win_wdmks.obj
PMDIR = ..\portmidi ! INCPM = -I$(PMDIR)\pm_common -I$(PMDIR)\pm_win -I$(PMDIR)\porttime SRCPM = $(PADIR)/pm_common/portmidi.c \ $(PMDIR)/pm_common/pmutil.c \ --- 65,74 ---- PAOBJ = pa_stream.obj pa_trace.obj pa_skeleton.obj pa_process.obj \ pa_front.obj pa_dither.obj pa_cpuload.obj pa_converters.obj \ ! pa_allocation.obj pa_win_hostapis.obj pa_win_util.obj pa_asio.obj \ pa_win_wmme.obj # pa_win_wdmks.obj
PMDIR = ..\portmidi ! INCPM = -I$(PMDIR)\pm_common -I$(PMDIR)\pm_win -I$(PMDIR)\porttime -DNEWBUFFER SRCPM = $(PADIR)/pm_common/portmidi.c \ $(PMDIR)/pm_common/pmutil.c \ *************** *** 128,162 ****
# explicit rules to compile portaudio sources: ! pa_stream.obj: $(PADIR)\pa_common\pa_stream.c ! cl /c $(ALLCF) $(PADIR)\pa_common\pa_stream.c ! pa_trace.obj: $(PADIR)\pa_common\pa_trace.c ! cl /c $(ALLCF) $(PADIR)\pa_common\pa_trace.c ! pa_skeleton.obj: $(PADIR)\pa_common\pa_skeleton.c ! cl /c $(ALLCF) $(PADIR)\pa_common\pa_skeleton.c ! pa_process.obj: $(PADIR)\pa_common\pa_process.c ! cl /c $(ALLCF) $(PADIR)\pa_common\pa_process.c ! pa_front.obj: $(PADIR)\pa_common\pa_front.c ! cl /c $(ALLCF) $(PADIR)\pa_common\pa_front.c ! pa_dither.obj: $(PADIR)\pa_common\pa_dither.c ! cl /c $(ALLCF) $(PADIR)\pa_common\pa_dither.c ! pa_cpuload.obj: $(PADIR)\pa_common\pa_cpuload.c ! cl /c $(ALLCF) $(PADIR)\pa_common\pa_cpuload.c ! pa_converters.obj: $(PADIR)\pa_common\pa_converters.c ! cl /c $(ALLCF) $(PADIR)\pa_common\pa_converters.c ! pa_allocation.obj: $(PADIR)\pa_common\pa_allocation.c ! cl /c $(ALLCF) $(PADIR)\pa_common\pa_allocation.c
! pa_win_util.obj: $(PADIR)\pa_win\pa_win_util.c ! cl /c $(ALLCF) $(PADIR)\pa_win\pa_win_util.c ! pa_win_hostapis.obj: $(PADIR)\pa_win\pa_win_hostapis.c ! cl /c $(ALLCF) $(PADIR)\pa_win\pa_win_hostapis.c ! pa_win_wmme.obj: $(PADIR)\pa_win_wmme\pa_win_wmme.c ! cl /c $(ALLCF) $(PADIR)\pa_win_wmme\pa_win_wmme.c pa_win_wdmks.obj: $(PADIR)\pa_win_wdmks\pa_win_wdmks.c cl /c $(ALLCF) \ -DWINVER=0x400 -DKSAUDIO_SPEAKER_DIRECTOUT \ $(PADIR)\pa_win_wdmks\pa_win_wdmks.c ! pa_asio.obj: $(PADIR)\pa_asio\pa_asio.cpp ! cl /c $(ALLCF) $(PADIR)\pa_asio\pa_asio.cpp
portmidi.obj: $(PMDIR)\pm_common\portmidi.c --- 129,163 ----
# explicit rules to compile portaudio sources: ! pa_stream.obj: $(PASRC)\common\pa_stream.c ! cl /c $(ALLCF) $(PASRC)\common\pa_stream.c ! pa_trace.obj: $(PASRC)\common\pa_trace.c ! cl /c $(ALLCF) $(PASRC)\common\pa_trace.c ! pa_skeleton.obj: $(PASRC)\common\pa_skeleton.c ! cl /c $(ALLCF) $(PASRC)\common\pa_skeleton.c ! pa_process.obj: $(PASRC)\common\pa_process.c ! cl /c $(ALLCF) $(PASRC)\common\pa_process.c ! pa_front.obj: $(PASRC)\common\pa_front.c ! cl /c $(ALLCF) $(PASRC)\common\pa_front.c ! pa_dither.obj: $(PASRC)\common\pa_dither.c ! cl /c $(ALLCF) $(PASRC)\common\pa_dither.c ! pa_cpuload.obj: $(PASRC)\common\pa_cpuload.c ! cl /c $(ALLCF) $(PASRC)\common\pa_cpuload.c ! pa_converters.obj: $(PASRC)\common\pa_converters.c ! cl /c $(ALLCF) $(PASRC)\common\pa_converters.c ! pa_allocation.obj: $(PASRC)\common\pa_allocation.c ! cl /c $(ALLCF) $(PASRC)\common\pa_allocation.c
! pa_win_hostapis.obj: $(PASRC)\os\win\pa_win_hostapis.c ! cl /c $(ALLCF) $(PASRC)\os\win\pa_win_hostapis.c ! pa_win_util.obj: $(PASRC)\os\win\pa_win_util.c ! cl /c $(ALLCF) $(PASRC)\os\win\pa_win_util.c ! pa_win_wmme.obj: $(PASRC)\hostapi\wmme\pa_win_wmme.c ! cl /c $(ALLCF) $(PASRC)\hostapi\wmme\pa_win_wmme.c pa_win_wdmks.obj: $(PADIR)\pa_win_wdmks\pa_win_wdmks.c cl /c $(ALLCF) \ -DWINVER=0x400 -DKSAUDIO_SPEAKER_DIRECTOUT \ $(PADIR)\pa_win_wdmks\pa_win_wdmks.c ! pa_asio.obj: $(PASRC)\hostapi\asio\pa_asio.cpp ! cl /c $(ALLCF) $(PASRC)\hostapi\asio\pa_asio.cpp
portmidi.obj: $(PMDIR)\pm_common\portmidi.c
--- makefile.dependencies DELETED ---
Index: s_audio_pablio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio_pablio.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** s_audio_pablio.c 4 Oct 2006 19:35:06 -0000 1.8 --- s_audio_pablio.c 18 Aug 2007 23:32:44 -0000 1.9 *************** *** 59,63 **** /************************************************************************/
- #ifdef PA19 static int blockingIOCallback( const void *inputBuffer, void *outputBuffer, /*MSP */ unsigned long framesPerBuffer, --- 59,62 ---- *************** *** 65,73 **** PaStreamCallbackFlags myflags, void *userData ); - #else - static int blockingIOCallback( void *inputBuffer, void *outputBuffer, - unsigned long framesPerBuffer, - PaTimestamp outTime, void *userData ); - #endif static PaError PABLIO_InitFIFO( sys_ringbuf *rbuf, long numFrames, long bytesPerFrame ); static PaError PABLIO_TermFIFO( sys_ringbuf *rbuf ); --- 64,67 ---- *************** *** 80,84 **** * Read and write data only if there is room in FIFOs. */ - #ifdef PA19 static int blockingIOCallback( const void *inputBuffer, void *outputBuffer, /* MSP */ unsigned long framesPerBuffer, --- 74,77 ---- *************** *** 86,94 **** PaStreamCallbackFlags myflags, void *userData ) - #else - static int blockingIOCallback( void *inputBuffer, void *outputBuffer, - unsigned long framesPerBuffer, - PaTimestamp outTime, void *userData ) - #endif { PABLIO_Stream *data = (PABLIO_Stream*)userData; --- 79,82 ---- *************** *** 224,232 **** PABLIO_Stream *aStream; long numFrames; - #ifdef PA19 PaStreamParameters instreamparams, outstreamparams; /* MSP */ - #else - long minNumBuffers; - #endif
/* fprintf(stderr, --- 212,216 ---- *************** *** 237,254 **** if (indeviceno < 0) /* MSP... */ { - #ifdef PA19 indeviceno = Pa_GetDefaultInputDevice(); - #else - indeviceno = Pa_GetDefaultInputDeviceID(); - #endif fprintf(stderr, "using default input device number: %d\n", indeviceno); } if (outdeviceno < 0) { - #ifdef PA19 outdeviceno = Pa_GetDefaultOutputDevice(); - #else - outdeviceno = Pa_GetDefaultOutputDeviceID(); - #endif fprintf(stderr, "using default output device number: %d\n", outdeviceno); } --- 221,230 ---- *************** *** 278,282 **** if( err != paNoError ) goto error;
- #ifdef PA19 numFrames = nbuffers * framesperbuf; /* ...MSP */
--- 254,257 ---- *************** *** 293,307 **** outstreamparams.hostApiSpecificStreamInfo = 0; /* ... MSP */
- #else - /* Warning: numFrames must be larger than amount of data processed per - interrupt inside PA to prevent glitches. */ /* MSP */ - minNumBuffers = Pa_GetMinNumBuffers(framesperbuf, sampleRate); - if (minNumBuffers > nbuffers) - fprintf(stderr, - "warning: number of buffers %d less than recommended minimum %d\n", - (int)nbuffers, (int)minNumBuffers); - #endif - - numFrames = nbuffers * framesperbuf; /* fprintf(stderr, "numFrames %d\n", numFrames); */ --- 268,271 ---- *************** *** 328,332 **** /* Open a PortAudio stream that we will use to communicate with the underlying * audio drivers. */ - #ifdef PA19 err = Pa_OpenStream( &aStream->stream, --- 292,295 ---- *************** *** 338,359 **** blockingIOCallback, aStream ); - #else - err = Pa_OpenStream( - &aStream->stream, - (doRead ? indeviceno : paNoDevice), /* MSP */ - (doRead ? aStream->insamplesPerFrame : 0 ), - format, - NULL, - (doWrite ? outdeviceno : paNoDevice), /* MSP */ - (doWrite ? aStream->outsamplesPerFrame : 0 ), - format, - NULL, - sampleRate, - framesperbuf, /* MSP */ - nbuffers, /* MSP */ - paNoFlag, /* MSP -- portaudio will clip for us */ - blockingIOCallback, - aStream ); - #endif if( err != paNoError ) goto error;
--- 301,304 ----
Index: s_midi_pm.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_midi_pm.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** s_midi_pm.c 2 Aug 2007 00:33:50 -0000 1.7 --- s_midi_pm.c 18 Aug 2007 23:32:44 -0000 1.8 *************** *** 22,26 **** #include "portmidi.h" #include "porttime.h" - #include "pminternal.h"
static PmStream *mac_midiindevlist[MAXMIDIINDEV]; --- 22,25 ----
Index: m_pd.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** m_pd.h 6 Aug 2007 16:39:54 -0000 1.19 --- m_pd.h 18 Aug 2007 23:32:43 -0000 1.20 *************** *** 12,16 **** #define PD_MINOR_VERSION 41 #define PD_BUGFIX_VERSION 0 ! #define PD_TEST_VERSION "test05"
/* old name for "MSW" flag -- we have to take it for the sake of many old --- 12,16 ---- #define PD_MINOR_VERSION 41 #define PD_BUGFIX_VERSION 0 ! #define PD_TEST_VERSION "test06"
/* old name for "MSW" flag -- we have to take it for the sake of many old
Index: m_sched.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_sched.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** m_sched.c 20 Jul 2007 03:25:20 -0000 1.9 --- m_sched.c 18 Aug 2007 23:32:44 -0000 1.10 *************** *** 8,11 **** --- 8,14 ---- #include "m_imp.h" #include "s_stuff.h" + #ifdef MSW + #include <windows.h> + #endif
/* LATER consider making this variable. It's now the LCM of all sample *************** *** 16,20 **** #include "pthread.h"
! static int sys_quit; double sys_time; --- 19,24 ---- #include "pthread.h"
! #define SYS_QUIT_QUIT 1 ! #define SYS_QUIT_RESTART 2 static int sys_quit; double sys_time; *************** *** 327,342 **** void dsp_tick(void);
! static int sched_usedacs = 1; static double sched_referencerealtime, sched_referencelogicaltime; double sys_time_per_dsp_tick;
! void sched_set_using_dacs(int flag) { ! sched_usedacs = flag; ! if (!flag) { sched_referencerealtime = sys_getrealtime(); sched_referencelogicaltime = clock_getlogicaltime(); } sys_time_per_dsp_tick = (TIMEUNITPERSEC) * ((double)sys_schedblocksize) / sys_dacsr; --- 331,351 ---- void dsp_tick(void);
! static int sched_useaudio = SCHED_AUDIO_POLL; static double sched_referencerealtime, sched_referencelogicaltime; double sys_time_per_dsp_tick;
! void sched_set_using_audio(int flag) { ! sched_useaudio = flag; ! if (flag == SCHED_AUDIO_NONE) { sched_referencerealtime = sys_getrealtime(); sched_referencelogicaltime = clock_getlogicaltime(); } + 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! */ + sys_time_per_dsp_tick = (TIMEUNITPERSEC) * ((double)sys_schedblocksize) / sys_dacsr; *************** *** 386,390 **** int (*sys_idlehook)(void);
! int m_scheduler( void) { int idlecount = 0; --- 395,399 ---- int (*sys_idlehook)(void);
! static void m_pollingscheduler( void) { int idlecount = 0; *************** *** 411,415 **** sys_addhist(0); waitfortick: ! if (sched_usedacs) { #ifdef THREAD_LOCKING --- 420,424 ---- sys_addhist(0); waitfortick: ! if (sched_useaudio != SCHED_AUDIO_NONE) { #ifdef THREAD_LOCKING *************** *** 434,437 **** --- 443,451 ---- { static double idletime; + if (sched_useaudio != SCHED_AUDIO_POLL) + { + bug("m_pollingscheduler\n"); + return; + } /* on 32nd idle, start a clock watch; every 32 ensuing idles, check it */ *************** *** 442,446 **** post("audio I/O stuck... closing audio\n"); sys_close_audio(); ! sched_set_using_dacs(0); goto waitfortick; } --- 456,460 ---- post("audio I/O stuck... closing audio\n"); sys_close_audio(); ! sched_set_using_audio(SCHED_AUDIO_NONE); goto waitfortick; } *************** *** 476,480 **** sched_pollformeters(); sys_reportidle(); - #ifdef THREAD_LOCKING sys_unlock(); /* unlock while we idle */ --- 490,493 ---- *************** *** 490,497 **** sys_lock(); #endif - sys_addhist(5); sched_didnothing++; - } } --- 503,508 ---- *************** *** 500,507 **** sys_unlock(); #endif
! return (0); }
/* ------------ thread locking ------------------- */ --- 511,561 ---- sys_unlock(); #endif + }
! void sched_audio_callbackfn(void) ! { ! sys_setmiditimediff(0, 1e-6 * sys_schedadvance); ! sys_addhist(1); ! sched_tick(sys_time + sys_time_per_dsp_tick); ! sys_addhist(2); ! sys_pollmidiqueue(); ! sys_addhist(3); ! sys_pollgui(); ! sys_addhist(5); ! sched_pollformeters(); ! sys_addhist(0); ! } ! ! static void m_callbackscheduler(void) ! { ! sys_initmidiqueue(); ! while (1) ! { ! #ifdef MSW ! Sleep(1000); ! #else ! sleep(1); ! #endif ! if (sys_idlehook) ! sys_idlehook(); ! } }
+ int m_mainloop(void) + { + while (sys_quit != SYS_QUIT_QUIT) + { + if (sched_useaudio == SCHED_AUDIO_CALLBACK) + m_callbackscheduler(); + else m_pollingscheduler(); + if (sys_quit == SYS_QUIT_RESTART) + { + sys_quit = 0; + sys_close_audio(); + sys_reopen_audio(); + } + } + return (0); + }
/* ------------ thread locking ------------------- */ *************** *** 535,538 **** void sys_exit(void) { ! sys_quit = 1; } --- 589,592 ---- void sys_exit(void) { ! sys_quit = SYS_QUIT_QUIT; }
Index: t_tkcmd.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/t_tkcmd.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** t_tkcmd.c 31 Dec 2005 20:55:25 -0000 1.7 --- t_tkcmd.c 18 Aug 2007 23:32:44 -0000 1.8 *************** *** 620,636 **** const char *argv = Tcl_GetVar(interp, "argv", 0); int portno, argno = 0; - /* argument passing seems to be different in MSW as opposed to - unix-likes. Here we check if we got sent a "port number" as an - argument. If so. we're to connect to a previously running pd (i.e., - pd got started first). If not, we start Pd from here. */ - #ifdef MSW if (argv && (portno = atoi(argv)) > 1) - #else - char *firstspace; - if (argv && (firstspace = strchr(argv, ' ')) && (portno = atoi(firstspace)) > 1) - #endif pdgui_setsock(portno); #ifdef DEBUGCONNECT ! debugfd = fopen("/Users/msp/bratwurst", "w"); fprintf(debugfd, "turning stderr back on\n"); fflush(debugfd); --- 620,628 ---- const char *argv = Tcl_GetVar(interp, "argv", 0); int portno, argno = 0; if (argv && (portno = atoi(argv)) > 1) pdgui_setsock(portno); #ifdef DEBUGCONNECT ! pd_portno = portno; ! debugfd = fopen("/tmp/bratwurst", "w"); fprintf(debugfd, "turning stderr back on\n"); fflush(debugfd);
Index: s_audio_mmio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio_mmio.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** s_audio_mmio.c 28 Nov 2004 21:20:42 -0000 1.5 --- s_audio_mmio.c 18 Aug 2007 23:32:44 -0000 1.6 *************** *** 695,699 **** /* ------------------- public routines -------------------------- */
! void mmio_open_audio(int naudioindev, int *audioindev, int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, int rate) --- 695,699 ---- /* ------------------- public routines -------------------------- */
! int mmio_open_audio(int naudioindev, int *audioindev, int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, int rate) *************** *** 725,729 **** if (naudiooutdev > 1 || naudioindev > 1) post("separate audio device choice not supported; using sequential devices."); ! mmio_do_open_audio(); }
--- 725,729 ---- if (naudiooutdev > 1 || naudioindev > 1) post("separate audio device choice not supported; using sequential devices."); ! return (mmio_do_open_audio()); }
Index: s_audio_pa.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio_pa.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** s_audio_pa.c 3 Jun 2006 19:13:07 -0000 1.6 --- s_audio_pa.c 18 Aug 2007 23:32:44 -0000 1.7 *************** *** 24,43 **** static int pa_inchans, pa_outchans; static float *pa_soundin, *pa_soundout;
#define MAX_PA_CHANS 32 #define MAX_SAMPLES_PER_FRAME MAX_PA_CHANS * DEFDACBLKSIZE
! #ifndef PA19 ! #define Pa_GetDeviceCount Pa_CountDevices ! #endif
int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, t_sample *soundout, int framesperbuf, int nbuffers, ! int indeviceno, int outdeviceno) { PaError err; static int initialized; int j, devno, pa_indev = 0, pa_outdev = 0; ! if (!initialized) { --- 24,159 ---- static int pa_inchans, pa_outchans; static float *pa_soundin, *pa_soundout; + static t_audiocallback pa_callback;
#define MAX_PA_CHANS 32 #define MAX_SAMPLES_PER_FRAME MAX_PA_CHANS * DEFDACBLKSIZE
! static int pa_lowlevel_callback(const void *inputBuffer, ! void *outputBuffer, unsigned long framesPerBuffer, ! const PaStreamCallbackTimeInfo *outTime, PaStreamCallbackFlags myflags, ! void *userData) ! { ! int i; ! unsigned int j; ! float *fbuf, *fp2, *fp3, *soundiop; ! if (framesPerBuffer != DEFDACBLKSIZE) ! { ! fprintf(stderr, "ignoring buffer size %d\n", framesPerBuffer); ! return; ! } ! if (inputBuffer != NULL) ! { ! fbuf = (float *)inputBuffer; ! soundiop = pa_soundin; ! for (i = 0, fp2 = fbuf; i < pa_inchans; i++, fp2++) ! for (j = 0, fp3 = fp2; j < framesPerBuffer; j++, fp3 += pa_inchans) ! *soundiop++ = *fp3; ! } ! else memset((void *)pa_soundin, 0, ! framesPerBuffer * pa_inchans * sizeof(float)); ! (*pa_callback)(); ! if (outputBuffer != NULL) ! { ! fbuf = (float *)outputBuffer; ! soundiop = pa_soundout; ! for (i = 0, fp2 = fbuf; i < pa_outchans; i++, fp2++) ! for (j = 0, fp3 = fp2; j < framesPerBuffer; j++, fp3 += pa_outchans) ! *fp3 = *soundiop++; ! } ! ! return 0; ! } ! ! PaError pa_open_callback(double sampleRate, int inchannels, int outchannels, ! int framesperbuf, int nbuffers, int indeviceno, int outdeviceno) ! { ! long bytesPerSample; ! PaError err; ! PABLIO_Stream *pastream; ! long numFrames; ! PaStreamParameters instreamparams, outstreamparams; ! ! if (indeviceno < 0) ! { ! indeviceno = Pa_GetDefaultInputDevice(); ! fprintf(stderr, "using default input device number: %d\n", indeviceno); ! } ! if (outdeviceno < 0) ! { ! outdeviceno = Pa_GetDefaultOutputDevice(); ! fprintf(stderr, "using default output device number: %d\n", outdeviceno); ! } ! /* fprintf(stderr, "nchan %d, flags %d, bufs %d, framesperbuf %d\n", ! nchannels, flags, nbuffers, framesperbuf); */ ! ! /* Allocate PABLIO_Stream structure for caller. */ ! pastream = (PABLIO_Stream *)malloc( sizeof(PABLIO_Stream)); ! if (pastream == NULL) ! return (1); ! memset(pastream, 0, sizeof(PABLIO_Stream)); ! ! /* Determine size of a sample. */ ! bytesPerSample = Pa_GetSampleSize(paFloat32); ! if (bytesPerSample < 0) ! { ! err = (PaError) bytesPerSample; ! goto error; ! } ! pastream->insamplesPerFrame = inchannels; ! pastream->inbytesPerFrame = bytesPerSample * pastream->insamplesPerFrame; ! pastream->outsamplesPerFrame = outchannels; ! pastream->outbytesPerFrame = bytesPerSample * pastream->outsamplesPerFrame; ! ! numFrames = nbuffers * framesperbuf; ! ! instreamparams.device = indeviceno; ! instreamparams.channelCount = inchannels; ! instreamparams.sampleFormat = paFloat32; ! instreamparams.suggestedLatency = nbuffers*framesperbuf/sampleRate; ! instreamparams.hostApiSpecificStreamInfo = 0; ! ! outstreamparams.device = outdeviceno; ! outstreamparams.channelCount = outchannels; ! outstreamparams.sampleFormat = paFloat32; ! outstreamparams.suggestedLatency = nbuffers*framesperbuf/sampleRate; ! outstreamparams.hostApiSpecificStreamInfo = 0; ! ! err = Pa_OpenStream( ! &pastream->stream, ! (inchannels ? &instreamparams : 0), ! (outchannels ? &outstreamparams : 0), ! sampleRate, ! DEFDACBLKSIZE, ! paNoFlag, /* portaudio will clip for us */ ! pa_lowlevel_callback, ! pastream); ! if (err != paNoError) ! goto error; ! ! err = Pa_StartStream(pastream->stream); ! if (err != paNoError) ! { ! fprintf(stderr, "Pa_StartStream failed; closing audio stream...\n"); ! CloseAudioStream( pastream ); ! goto error; ! } ! pa_stream = pastream; ! return paNoError; ! error: ! pa_stream = NULL; ! return err; ! }
int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, t_sample *soundout, int framesperbuf, int nbuffers, ! int indeviceno, int outdeviceno, t_audiocallback callbackfn) { PaError err; static int initialized; int j, devno, pa_indev = 0, pa_outdev = 0; ! ! pa_callback = callbackfn; ! if (callbackfn) ! fprintf(stderr, "callback enabled\n"); if (!initialized) { *************** *** 106,129 **** post("framesperbuf %d, nbufs %d", framesperbuf, nbuffers); } ! if (inchans || outchans) err = OpenAudioStream( &pa_stream, rate, paFloat32, inchans, outchans, framesperbuf, nbuffers, pa_indev, pa_outdev); ! else err = 0; if ( err != paNoError ) { ! fprintf( stderr, "Error number %d occured opening portaudio stream\n", err); fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); Pa_Terminate(); - sys_inchannels = sys_outchannels = 0; return (1); } else if (sys_verbose) post("... opened OK."); - pa_inchans = inchans; - pa_outchans = outchans; - pa_soundin = soundin; - pa_soundout = soundout; return (0); } --- 222,253 ---- post("framesperbuf %d, nbufs %d", framesperbuf, nbuffers); } ! pa_inchans = inchans; ! pa_outchans = outchans; ! pa_soundin = soundin; ! pa_soundout = soundout; ! if (! inchans && !outchans) ! return(0); ! if (callbackfn) ! { ! pa_callback = callbackfn; ! err = pa_open_callback(rate, inchans, outchans, ! framesperbuf, nbuffers, pa_indev, pa_outdev); ! } ! else ! { err = OpenAudioStream( &pa_stream, rate, paFloat32, inchans, outchans, framesperbuf, nbuffers, pa_indev, pa_outdev); ! } if ( err != paNoError ) { ! fprintf(stderr, "Error number %d opening portaudio stream\n", err); fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); Pa_Terminate(); return (1); } else if (sys_verbose) post("... opened OK."); return (0); } *************** *** 236,250 **** fprintf(stderr, "%d inputs, ", pdi->maxInputChannels ); fprintf(stderr, "%d outputs", pdi->maxOutputChannels ); - #ifdef PA19 if ( i == Pa_GetDefaultInputDevice() ) fprintf(stderr, " (Default Input)"); if ( i == Pa_GetDefaultOutputDevice() ) fprintf(stderr, " (Default Output)"); - #else - if ( i == Pa_GetDefaultInputDeviceID() ) - fprintf(stderr, " (Default Input)"); - if ( i == Pa_GetDefaultOutputDeviceID() ) - fprintf(stderr, " (Default Output)"); - #endif fprintf(stderr, "\n"); } --- 360,367 ----
Index: s_audio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** s_audio.c 4 Oct 2006 19:35:06 -0000 1.12 --- s_audio.c 18 Aug 2007 23:32:44 -0000 1.13 *************** *** 30,34 ****
static void audio_getdevs(char *indevlist, int *nindevs, ! char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize);
--- 30,34 ----
static void audio_getdevs(char *indevlist, int *nindevs, ! char *outdevlist, int *noutdevs, int *canmulti, int *cancallback, int maxndev, int devdescsize);
*************** *** 66,69 **** --- 66,72 ---- static int audio_rate; static int audio_advance; + static int audio_callback; + + void sched_audio_callbackfn(void);
static int audio_isopen(void) *************** *** 77,81 **** int *pnaudioindev, int *paudioindev, int *chindev, int *pnaudiooutdev, int *paudiooutdev, int *choutdev, ! int *prate, int *padvance) { int i; --- 80,84 ---- int *pnaudioindev, int *paudioindev, int *chindev, int *pnaudiooutdev, int *paudiooutdev, int *choutdev, ! int *prate, int *padvance, int *pcallback) { int i; *************** *** 90,93 **** --- 93,97 ---- *prate = audio_rate; *padvance = audio_advance; + *pcallback = audio_callback; }
*************** *** 95,99 **** int naudioindev, int *audioindev, int *chindev, int naudiooutdev, int *audiooutdev, int *choutdev, ! int rate, int advance) { int i; --- 99,103 ---- int naudioindev, int *audioindev, int *chindev, int naudiooutdev, int *audiooutdev, int *choutdev, ! int rate, int advance, int callback) { int i; *************** *** 108,111 **** --- 112,116 ---- audio_rate = rate; audio_advance = advance; + audio_callback = callback; }
*************** *** 166,177 **** /* ----------------------- public routines ----------------------- */
! /* open audio devices (after cleaning up the specified device and channel ! vectors). The audio devices are "zero based" (i.e. "0" means the first ! one.) We also save the cleaned-up device specification so that we ! can later re-open audio and/or show the settings on a dialog window. */
! void sys_open_audio(int naudioindev, int *audioindev, int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, ! int *choutdev, int rate, int advance, int enable) { int i, *ip; --- 171,182 ---- /* ----------------------- public routines ----------------------- */
! /* set audio device settings (after cleaning up the specified device and ! channel vectors). The audio devices are "zero based" (i.e. "0" means the ! first one.) We can later re-open audio and/or show the settings on a\ ! dialog window. */
! void sys_set_audio_settings(int naudioindev, int *audioindev, int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, ! int *choutdev, int rate, int advance, int callback) { int i, *ip; *************** *** 182,189 ****
char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; ! int indevs = 0, outdevs = 0, canmulti = 0; audio_getdevs(indevlist, &indevs, outdevlist, &outdevs, &canmulti, ! MAXNDEV, DEVDESCSIZE); ! if (sys_externalschedlib) { --- 187,193 ----
char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; ! int indevs = 0, outdevs = 0, canmulti = 0, cancallback = 0; audio_getdevs(indevlist, &indevs, outdevlist, &outdevs, &canmulti, ! &cancallback, MAXNDEV, DEVDESCSIZE); if (sys_externalschedlib) { *************** *** 320,390 **** nrealoutdev++; } - /* if no input or output devices seem to have been specified, - this really means just disable audio, which we now do. */ - if (!inchans && !outchans) - enable = 0; sys_schedadvance = advance * 1000; sys_setchsr(inchans, outchans, rate); sys_log_error(ERR_NOTHING); ! if (enable) ! { ! #ifdef USEAPI_PORTAUDIO ! if (sys_audioapi == API_PORTAUDIO) ! { ! int blksize = (sys_blocksize ? sys_blocksize : 64); ! pa_open_audio(inchans, outchans, rate, sys_soundin, sys_soundout, ! blksize, sys_advance_samples/blksize, ! (naudiooutdev > 0 ? audioindev[0] : 0), ! (naudiooutdev > 0 ? audiooutdev[0] : 0)); ! } ! else ! #endif ! #ifdef USEAPI_JACK ! if (sys_audioapi == API_JACK) ! jack_open_audio((nrealindev > 0 ? realinchans[0] : 0), ! (nrealoutdev > 0 ? realoutchans[0] : 0), rate); ! ! else ! #endif ! #ifdef USEAPI_OSS ! if (sys_audioapi == API_OSS) ! oss_open_audio(nrealindev, realindev, nrealindev, realinchans, ! nrealoutdev, realoutdev, nrealoutdev, realoutchans, rate); ! else ! #endif ! #ifdef USEAPI_ALSA ! /* for alsa, only one device is supported; it may ! be open for both input and output. */ ! if (sys_audioapi == API_ALSA) ! alsa_open_audio(nrealindev, audioindev, nrealindev, realinchans, ! nrealoutdev, audiooutdev, nrealoutdev, realoutchans, rate); ! else ! #endif ! #ifdef USEAPI_SGI ! if (sys_audioapi == API_SGI) ! { ! xtern int sgi_open_audio(int nindev, int *indev, int nchin, ! int *chin, int noutdev, int *outdev, int nchout, int *chout, ! int rate); ! sgi_open_audio(naudioindev, audioindev, nchindev, chindev, ! naudiooutdev, audiooutdev, nchoutdev, choutdev, rate); ! } ! else ! #endif ! #ifdef USEAPI_MMIO ! if (sys_audioapi == API_MMIO) ! mmio_open_audio(nrealindev, audioindev, nrealindev, realinchans, ! nrealoutdev, audiooutdev, nrealoutdev, realoutchans, rate); ! else ! #endif ! post("unknown audio API specified"); ! } ! sys_save_audio_params(naudioindev, audioindev, chindev, ! naudiooutdev, audiooutdev, choutdev, sys_dacsr, advance); ! if (sys_inchannels == 0 && sys_outchannels == 0) ! enable = 0; ! audio_state = enable; ! sys_vgui("set pd_whichapi %d\n", (audio_isopen() ? sys_audioapi : 0)); ! sched_set_using_dacs(enable); }
--- 324,332 ---- nrealoutdev++; } sys_schedadvance = advance * 1000; sys_setchsr(inchans, outchans, rate); sys_log_error(ERR_NOTHING); ! sys_save_audio_params(nrealindev, realindev, realinchans, ! nrealoutdev, realoutdev, realoutchans, sys_dacsr, advance, callback); }
*************** *** 417,428 **** else #endif - #ifdef USEAPI_SGI - if (sys_audioapi == API_SGI) - { - extern void sgi_close_audio(void); - sgi_close_audio(); - } - else - #endif #ifdef USEAPI_MMIO if (sys_audioapi == API_MMIO) --- 359,362 ---- *************** *** 432,435 **** --- 366,370 ---- post("sys_close_audio: unknown API %d", sys_audioapi); sys_inchannels = sys_outchannels = 0; + sched_set_using_audio(SCHED_AUDIO_NONE); }
*************** *** 439,447 **** int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; ! int rate, advance; sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &advance); ! sys_open_audio(naudioindev, audioindev, naudioindev, chindev, ! naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate, advance, 1); }
--- 374,438 ---- int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; ! int rate, advance, callback, outcome = 0; sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback); ! if (!naudioindev && !naudiooutdev) ! { ! sched_set_using_audio(SCHED_AUDIO_NONE); ! return; ! } ! #ifdef USEAPI_PORTAUDIO ! if (sys_audioapi == API_PORTAUDIO) ! { ! int blksize = (sys_blocksize ? sys_blocksize : 64); ! outcome = pa_open_audio((naudioindev > 0 ? chindev[0] : 0), ! (naudiooutdev > 0 ? choutdev[0] : 0), rate, sys_soundin, ! sys_soundout, blksize, sys_advance_samples/blksize, ! (naudioindev > 0 ? audioindev[0] : 0), ! (naudiooutdev > 0 ? audiooutdev[0] : 0), ! (callback ? sched_audio_callbackfn : 0)); ! } ! else ! #endif ! #ifdef USEAPI_JACK ! if (sys_audioapi == API_JACK) ! outcome = jack_open_audio((naudioindev > 0 ? chindev[0] : 0), ! (naudioindev > 0 ? choutdev[0] : 0), rate); ! ! else ! #endif ! #ifdef USEAPI_OSS ! if (sys_audioapi == API_OSS) ! outcome = oss_open_audio(naudioindev, audioindev, naudioindev, ! chindev, naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate); ! else ! #endif ! #ifdef USEAPI_ALSA ! /* for alsa, only one device is supported; it may ! be open for both input and output. */ ! if (sys_audioapi == API_ALSA) ! outcome = alsa_open_audio(naudioindev, audioindev, naudioindev, ! chindev, naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate); ! else ! #endif ! #ifdef USEAPI_MMIO ! if (sys_audioapi == API_MMIO) ! outcome = mmio_open_audio(naudioindev, audioindev, naudioindev, ! chindev, naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate); ! else ! #endif ! post("unknown audio API specified"); ! if (outcome) /* failed */ ! { ! audio_state = 0; ! sched_set_using_audio(SCHED_AUDIO_NONE); ! } ! else ! { ! audio_state = 1; ! sched_set_using_audio( ! (callback ? SCHED_AUDIO_CALLBACK : SCHED_AUDIO_POLL)); ! } ! sys_vgui("set pd_whichapi %d\n", (outcome == 0 ? sys_audioapi : 0)); }
*************** *** 490,501 **** else #endif - #ifdef USEAPI_SGI - if (sys_audioapi == API_SGI) - { - extern int sgi_send_dacs(void); - return (sgi_send_dacs()); - } - else - #endif #ifdef USEAPI_MMIO if (sys_audioapi == API_MMIO) --- 481,484 ---- *************** *** 540,547 ****
static void audio_getdevs(char *indevlist, int *nindevs, ! char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize) { audio_init(); #ifdef USEAPI_PORTAUDIO if (sys_audioapi == API_PORTAUDIO) --- 523,531 ----
static void audio_getdevs(char *indevlist, int *nindevs, ! char *outdevlist, int *noutdevs, int *canmulti, int *cancallback, int maxndev, int devdescsize) { audio_init(); + *cancallback = 0; /* may be overridden by specific API implementation */ #ifdef USEAPI_PORTAUDIO if (sys_audioapi == API_PORTAUDIO) *************** *** 549,552 **** --- 533,537 ---- pa_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, maxndev, devdescsize); + *cancallback = 1; } else *************** *** 576,590 **** else #endif - #ifdef USEAPI_SGI - if (sys_audioapi == API_SGI) - { - extern void sgi_getdevs(char *indevlist, int *nindevs, - char *outdevlist, int *noutdevs, int *canmulti, - int maxndev, int devdescsize); - sgi_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, - maxndev, devdescsize); - } - else - #endif #ifdef USEAPI_MMIO if (sys_audioapi == API_MMIO) --- 561,564 ---- *************** *** 612,619 **** { char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; ! int nindevs = 0, noutdevs = 0, i, canmulti = 0;
audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, ! MAXNDEV, DEVDESCSIZE);
if (!nindevs) --- 586,593 ---- { char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; ! int nindevs = 0, noutdevs = 0, i, canmulti = 0, cancallback = 0;
audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, ! &cancallback, MAXNDEV, DEVDESCSIZE);
if (!nindevs) *************** *** 654,664 **** audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4, audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4; ! int rate, advance; /* these are all the devices on your system: */ char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; ! int nindevs = 0, noutdevs = 0, canmulti = 0, i;
audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, ! MAXNDEV, DEVDESCSIZE);
sys_gui("global audio_indevlist; set audio_indevlist {}\n"); --- 628,638 ---- audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4, audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4; ! int rate, advance, callback; /* these are all the devices on your system: */ char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; ! int nindevs = 0, noutdevs = 0, canmulti = 0, cancallback = 0, i;
audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, ! &cancallback, MAXNDEV, DEVDESCSIZE);
sys_gui("global audio_indevlist; set audio_indevlist {}\n"); *************** *** 673,677 ****
sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &advance);
/* post("naudioindev %d naudiooutdev %d longform %f", --- 647,651 ----
sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback);
/* post("naudioindev %d naudiooutdev %d longform %f", *************** *** 700,709 **** %d %d %d %d %d %d %d %d \ %d %d %d %d %d %d %d %d \ ! %d %d %d %d\n", audioindev1, audioindev2, audioindev3, audioindev4, audioinchan1, audioinchan2, audioinchan3, audioinchan4, audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4, audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4, ! rate, advance, canmulti, (flongform != 0)); gfxstub_deleteforkey(0); gfxstub_new(&glob_pdobject, (void *)glob_audio_properties, buf); --- 674,684 ---- %d %d %d %d %d %d %d %d \ %d %d %d %d %d %d %d %d \ ! %d %d %d %d %d\n", audioindev1, audioindev2, audioindev3, audioindev4, audioinchan1, audioinchan2, audioinchan3, audioinchan4, audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4, audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4, ! rate, advance, canmulti, (cancallback ? callback : -1), ! (flongform != 0)); gfxstub_deleteforkey(0); gfxstub_new(&glob_pdobject, (void *)glob_audio_properties, buf); *************** *** 722,725 **** --- 697,701 ---- int newrate = atom_getintarg(16, argc, argv); int newadvance = atom_getintarg(17, argc, argv); + int newcallback = atom_getintarg(18, argc, argv); int statewas;
*************** *** 754,762 **** } } ! ! sys_close_audio(); ! sys_open_audio(nindev, newaudioindev, nindev, newaudioinchan, noutdev, newaudiooutdev, noutdev, newaudiooutchan, ! newrate, newadvance, 1); }
--- 730,745 ---- } } ! ! if (newcallback < 0) ! newcallback = 0; ! post("callback %d new %d",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)); ! post("callback %d new %d",audio_callback, newcallback) ; ! if (audio_callback == newcallback) ! sys_reopen_audio(); }
*************** *** 783,792 **** else #endif - #ifdef USEAPI_SGI - extern void sgi_listaudiodevs(void); - if (sys_audioapi == API_SGI) - sgi_listaudiodevs(); - else - #endif #ifdef USEAPI_MMIO if (sys_audioapi == API_MMIO) --- 766,769 ---- *************** *** 842,846 **** sys_close_audio(); audio_state = 0; - sched_set_using_dacs(0); } } --- 819,822 ---- *************** *** 857,864 **** { if (audio_isopen()) - { sys_close_audio(); - sched_set_using_dacs(0); - } } audio_state = onoff; --- 833,837 ---- *************** *** 889,895 **** sprintf(buf + strlen(buf), "{portaudio %d} ", API_PORTAUDIO); #endif - #ifdef USEAPI_SGI - sprintf(buf + strlen(buf), "{SGI %d} ", API_SGI); n++; - #endif #endif n++; --- 862,865 ---- *************** *** 902,906 **** if (n < 2) strcpy(buf, "{}"); - }
--- 872,875 ----
Index: s_file.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_file.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** s_file.c 2 Aug 2007 00:33:50 -0000 1.10 --- s_file.c 18 Aug 2007 23:32:44 -0000 1.11 *************** *** 289,293 **** int nmidiindev, midiindev[MAXMIDIINDEV]; int nmidioutdev, midioutdev[MAXMIDIOUTDEV]; ! int i, rate = 0, advance = 0, api, nolib, maxi; char prefbuf[MAXPDSTRING], keybuf[80];
--- 289,293 ---- int nmidiindev, midiindev[MAXMIDIINDEV]; int nmidioutdev, midioutdev[MAXMIDIOUTDEV]; ! int i, rate = 0, advance = 0, callback = 0, api, nolib, maxi; char prefbuf[MAXPDSTRING], keybuf[80];
*************** *** 338,343 **** if (sys_getpreference("audiobuf", prefbuf, MAXPDSTRING)) sscanf(prefbuf, "%d", &advance); ! sys_open_audio(naudioindev, audioindev, naudioindev, chindev, ! naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate, advance, 0);
/* load MIDI preferences */ --- 338,346 ---- if (sys_getpreference("audiobuf", prefbuf, MAXPDSTRING)) sscanf(prefbuf, "%d", &advance); ! if (sys_getpreference("callback", prefbuf, MAXPDSTRING)) ! sscanf(prefbuf, "%d", &callback); ! sys_set_audio_settings(naudioindev, audioindev, naudioindev, chindev, ! naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate, advance, ! callback);
/* load MIDI preferences */ *************** *** 424,428 **** int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; ! int i, rate, advance; char buf1[MAXPDSTRING], buf2[MAXPDSTRING]; int nmidiindev, midiindev[MAXMIDIINDEV]; --- 427,431 ---- int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; ! int i, rate, advance, callback; char buf1[MAXPDSTRING], buf2[MAXPDSTRING]; int nmidiindev, midiindev[MAXMIDIINDEV]; *************** *** 437,441 ****
sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &advance);
sys_putpreference("noaudioin", (naudioindev <= 0 ? "True" : "False")); --- 440,444 ----
sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback);
sys_putpreference("noaudioin", (naudioindev <= 0 ? "True" : "False")); *************** *** 460,463 **** --- 463,469 ---- sys_putpreference("rate", buf1);
+ sprintf(buf1, "%d", callback); + sys_putpreference("callback", buf1); + /* MIDI settings */ sys_get_midi_params(&nmidiindev, midiindev, &nmidioutdev, midioutdev);