Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1:/tmp/cvs-serv17130
Modified Files: Tag: dacblocksize u_main.tk s_stuff.h s_main.c s_audio_pa.c s_audio_oss.c s_audio_mmio.c s_audio_jack.c s_audio_alsa.c s_audio.c m_sched.c d_dac.c Log Message: added "dacblocksize"-support you can now specify the size of the audio-block for the dac/adc either with the command-line argument "-dacblocksize" or via the audio properties box.
the dacblocksize is the default signal-blocksize of pd.
additionally, the scheduler-blocksize is also set to this value.
Index: u_main.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v retrieving revision 1.1.1.4.2.7 retrieving revision 1.1.1.4.2.7.2.1 diff -C2 -d -r1.1.1.4.2.7 -r1.1.1.4.2.7.2.1 *** u_main.tk 24 Nov 2003 16:27:49 -0000 1.1.1.4.2.7 --- u_main.tk 1 Dec 2003 11:58:41 -0000 1.1.1.4.2.7.2.1 *************** *** 2823,2827 **** global audio_outdev1 audio_outdev2 audio_outdev3 audio_outdev4 global audio_outchan1 audio_outchan2 audio_outchan3 audio_outchan4 ! global audio_sr audio_advance
pd [concat pd audio-dialog \ --- 2823,2827 ---- global audio_outdev1 audio_outdev2 audio_outdev3 audio_outdev4 global audio_outchan1 audio_outchan2 audio_outchan3 audio_outchan4 ! global audio_sr audio_dacblocksize audio_advance
pd [concat pd audio-dialog \ *************** *** 2843,2846 **** --- 2843,2847 ---- $audio_outchan4 \ $audio_sr \ + $audio_dacblocksize \ $audio_advance \ ;] *************** *** 2887,2896 **** inchan1 inchan2 inchan3 inchan4 \ outdevlist 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 global audio_outdev1 audio_outdev2 audio_outdev3 audio_outdev4 global audio_outchan1 audio_outchan2 audio_outchan3 audio_outchan4 ! global audio_sr audio_advance global audio_indevlist audio_outdevlist
--- 2888,2897 ---- inchan1 inchan2 inchan3 inchan4 \ outdevlist outdev1 outdev2 outdev3 outdev4 \ ! outchan1 outchan2 outchan3 outchan4 sr dacblocksize advance multi longform} { global audio_indev1 audio_indev2 audio_indev3 audio_indev4 global audio_inchan1 audio_inchan2 audio_inchan3 audio_inchan4 global audio_outdev1 audio_outdev2 audio_outdev3 audio_outdev4 global audio_outchan1 audio_outchan2 audio_outchan3 audio_outchan4 ! global audio_sr audio_dacblocksize audio_advance global audio_indevlist audio_outdevlist
*************** *** 2912,2915 **** --- 2913,2917 ---- set audio_outchan4 $outchan4 set audio_sr $sr + set audio_dacblocksize $dacblocksize set audio_advance $advance set audio_indevlist $indevlist *************** *** 2940,2944 **** label $id.srf.l2 -text "delay (msec):" 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 --- 2942,2948 ---- label $id.srf.l2 -text "delay (msec):" entry $id.srf.x2 -textvariable audio_advance -width 4 ! label $id.srf.l3 -text "dacblocksize:" ! entry $id.srf.x3 -textvariable audio_dacblocksize -width 4 ! pack $id.srf.l1 $id.srf.x1 $id.srf.l2 $id.srf.x2 $id.srf.l3 $id.srf.x3 -side left
# input device 1
Index: s_stuff.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_stuff.h,v retrieving revision 1.1.1.1.2.5 retrieving revision 1.1.1.1.2.5.2.1 diff -C2 -d -r1.1.1.1.2.5 -r1.1.1.1.2.5.2.1 *** s_stuff.h 25 Nov 2003 19:19:57 -0000 1.1.1.1.2.5 --- s_stuff.h 1 Dec 2003 11:58:41 -0000 1.1.1.1.2.5.2.1 *************** *** 42,45 **** --- 42,46 ----
#define DEFDACBLKSIZE 64 + extern int sys_dacblocksize; extern int sys_schedblocksize; /* audio block size for scheduler */ extern int sys_hipriority; /* real-time flag, true if priority boosted */ *************** *** 50,54 **** extern int sys_advance_samples; /* scheduler advance in samples */ extern int sys_blocksize; /* audio I/O block size in sample frames */ ! extern float sys_dacsr; extern int sys_schedadvance; extern int sys_sleepgrain; --- 51,56 ---- extern int sys_advance_samples; /* scheduler advance in samples */ extern int sys_blocksize; /* audio I/O block size in sample frames */ ! extern float sys_dacsr; /* samplerate */ ! extern int sys_dacblocksize; /* dac~ blocksize */ extern int sys_schedadvance; extern int sys_sleepgrain; *************** *** 56,60 **** int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, ! int srate, int advance, int enable); void sys_close_audio(void);
--- 58,62 ---- int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, ! int srate, int dacblocksize, int advance, int enable); void sys_close_audio(void);
Index: s_main.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_main.c,v retrieving revision 1.1.1.4.2.8 retrieving revision 1.1.1.4.2.8.2.1 diff -C2 -d -r1.1.1.4.2.8 -r1.1.1.4.2.8.2.1 *** s_main.c 18 Nov 2003 10:34:10 -0000 1.1.1.4.2.8 --- s_main.c 1 Dec 2003 11:58:41 -0000 1.1.1.4.2.8.2.1 *************** *** 63,66 **** --- 63,67 ----
static int sys_main_srate = DEFAULTSRATE; + static int sys_main_dacblocksize = DEFDACBLKSIZE; static int sys_main_advance = DEFAULTADVANCE;
*************** *** 259,263 **** sys_open_audio(sys_nsoundin, sys_soundindevlist, sys_nchin, sys_chinlist, sys_nsoundout, sys_soundoutdevlist, sys_nchout, sys_choutlist, ! sys_main_srate, sys_main_advance, 1);
/* run scheduler until it quits */ --- 260,264 ---- sys_open_audio(sys_nsoundin, sys_soundindevlist, sys_nchin, sys_chinlist, sys_nsoundout, sys_soundoutdevlist, sys_nchout, sys_choutlist, ! sys_main_srate, sys_main_dacblocksize, sys_main_advance, 1);
/* run scheduler until it quits */ *************** *** 283,286 **** --- 284,288 ---- "-audiobuf <n> -- specify size of audio buffer in msec\n", "-blocksize <n> -- specify audio I/O block size in sample frames\n", + "-dacblocksize <n>-- specify audio dac~block size in samples\n", "-sleepgrain <n> -- specify number of milliseconds to sleep when idle\n", "-nodac -- suppress audio output\n", *************** *** 486,489 **** --- 488,497 ---- argv += 2; } + else if (!strcmp(*argv, "-dacblocksize") && argc > 1 && + sscanf(argv[1], "%d", &sys_main_dacblocksize) >= 1) + { + argc -= 2; + argv += 2; + } else if (!strcmp(*argv, "-inchannels")) { /* IOhannes */ *************** *** 793,797 **** int sys_getblksize(void) { ! return (DEFDACBLKSIZE); }
--- 801,805 ---- int sys_getblksize(void) { ! return (sys_dacblocksize); }
Index: s_audio_pa.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio_pa.c,v retrieving revision 1.1.1.1.2.5 retrieving revision 1.1.1.1.2.5.2.1 diff -C2 -d -r1.1.1.1.2.5 -r1.1.1.1.2.5.2.1 *** s_audio_pa.c 23 Sep 2003 00:51:50 -0000 1.1.1.1.2.5 --- s_audio_pa.c 1 Dec 2003 11:58:41 -0000 1.1.1.1.2.5.2.1 *************** *** 31,35 ****
#define MAX_PA_CHANS 32 ! #define MAX_SAMPLES_PER_FRAME MAX_PA_CHANS * DEFDACBLKSIZE
int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, --- 31,35 ----
#define MAX_PA_CHANS 32 ! #define MAX_SAMPLES_PER_FRAME MAX_PA_CHANS * sys_dacblocksize
int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, *************** *** 153,166 ****
timebefore = sys_getrealtime(); ! if ((pa_inchans && GetAudioStreamReadable(pa_stream) < DEFDACBLKSIZE) || ! (pa_outchans && GetAudioStreamWriteable(pa_stream) < DEFDACBLKSIZE)) { if (pa_inchans && pa_outchans) { int synced = 0; ! while (GetAudioStreamWriteable(pa_stream) > 2*DEFDACBLKSIZE) { for (j = 0; j < pa_outchans; j++) ! for (i = 0, fp2 = samples + j; i < DEFDACBLKSIZE; i++, fp2 += pa_outchans) { --- 153,166 ----
timebefore = sys_getrealtime(); ! if ((pa_inchans && GetAudioStreamReadable(pa_stream) < sys_dacblocksize) || ! (pa_outchans && GetAudioStreamWriteable(pa_stream) < sys_dacblocksize)) { if (pa_inchans && pa_outchans) { int synced = 0; ! while (GetAudioStreamWriteable(pa_stream) > 2*sys_dacblocksize) { for (j = 0; j < pa_outchans; j++) ! for (i = 0, fp2 = samples + j; i < sys_dacblocksize; i++, fp2 += pa_outchans) { *************** *** 168,177 **** } synced = 1; ! WriteAudioStream(pa_stream, samples, DEFDACBLKSIZE); } ! while (GetAudioStreamReadable(pa_stream) > 2*DEFDACBLKSIZE) { synced = 1; ! ReadAudioStream(pa_stream, samples, DEFDACBLKSIZE); } /* if (synced) --- 168,177 ---- } synced = 1; ! WriteAudioStream(pa_stream, samples, sys_dacblocksize); } ! while (GetAudioStreamReadable(pa_stream) > 2*sys_dacblocksize) { synced = 1; ! ReadAudioStream(pa_stream, samples, sys_dacblocksize); } /* if (synced) *************** *** 182,188 **** if (pa_inchans) { ! ReadAudioStream(pa_stream, samples, DEFDACBLKSIZE); ! for (j = 0, fp1 = pa_soundin; j < pa_inchans; j++, fp1 += DEFDACBLKSIZE) ! for (i = 0, fp2 = samples + j; i < DEFDACBLKSIZE; i++, fp2 += pa_inchans) { --- 182,188 ---- if (pa_inchans) { ! ReadAudioStream(pa_stream, samples, sys_dacblocksize); ! for (j = 0, fp1 = pa_soundin; j < pa_inchans; j++, fp1 += sys_dacblocksize) ! for (i = 0, fp2 = samples + j; i < sys_dacblocksize; i++, fp2 += pa_inchans) { *************** *** 205,210 **** { for (j = 0, fp1 = pa_soundout; j < pa_outchans; j++, ! fp1 += DEFDACBLKSIZE) ! for (i = 0, fp2 = samples + j; i < DEFDACBLKSIZE; i++, fp2 += pa_outchans) { --- 205,210 ---- { for (j = 0, fp1 = pa_soundout; j < pa_outchans; j++, ! fp1 += sys_dacblocksize) ! for (i = 0, fp2 = samples + j; i < sys_dacblocksize; i++, fp2 += pa_outchans) { *************** *** 212,216 **** fp1[i] = 0; } ! WriteAudioStream(pa_stream, samples, DEFDACBLKSIZE); }
--- 212,216 ---- fp1[i] = 0; } ! WriteAudioStream(pa_stream, samples, sys_dacblocksize); }
Index: s_audio_oss.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio_oss.c,v retrieving revision 1.1.1.1.2.4 retrieving revision 1.1.1.1.2.4.2.1 diff -C2 -d -r1.1.1.1.2.4 -r1.1.1.1.2.4.2.1 *** s_audio_oss.c 18 Nov 2003 10:34:10 -0000 1.1.1.1.2.4 --- s_audio_oss.c 1 Dec 2003 11:58:41 -0000 1.1.1.1.2.4.2.1 *************** *** 37,43 **** typedef int32_t t_oss_int32; #define OSS_MAXSAMPLEWIDTH sizeof(t_oss_int32) ! #define OSS_BYTESPERCHAN(width) (DEFDACBLKSIZE * (width)) ! #define OSS_XFERSAMPS(chans) (DEFDACBLKSIZE* (chans)) ! #define OSS_XFERSIZE(chans, width) (DEFDACBLKSIZE * (chans) * (width))
/* GLOBALS */ --- 37,43 ---- typedef int32_t t_oss_int32; #define OSS_MAXSAMPLEWIDTH sizeof(t_oss_int32) ! #define OSS_BYTESPERCHAN(width) (sys_dacblocksize * (width)) ! #define OSS_XFERSAMPS(chans) (sys_dacblocksize* (chans)) ! #define OSS_XFERSIZE(chans, width) (sys_dacblocksize * (chans) * (width))
/* GLOBALS */ *************** *** 189,193 **** { linux_fragsize = OSS_DEFFRAGSIZE; ! while (linux_fragsize > DEFDACBLKSIZE && linux_fragsize * 6 > sys_advance_samples) linux_fragsize = linux_fragsize/2; --- 189,193 ---- { linux_fragsize = OSS_DEFFRAGSIZE; ! while (linux_fragsize > sys_dacblocksize && linux_fragsize * 6 > sys_advance_samples) linux_fragsize = linux_fragsize/2; *************** *** 275,279 **** char devname[20]; int n, i, fd, flags; ! char buf[OSS_MAXSAMPLEWIDTH * DEFDACBLKSIZE * OSS_MAXCHPERDEV]; int num_devs = 0; int wantmore=0; --- 275,279 ---- char devname[20]; int n, i, fd, flags; ! char buf[OSS_MAXSAMPLEWIDTH * sys_dacblocksize * OSS_MAXCHPERDEV]; int num_devs = 0; int wantmore=0; *************** *** 468,472 **** read(linux_adcs[0].d_fd, buf, linux_adcs[0].d_bytespersamp * ! linux_adcs[0].d_nchannels * DEFDACBLKSIZE); if (sys_verbose) fprintf(stderr, "...done.\n"); --- 468,472 ---- read(linux_adcs[0].d_fd, buf, linux_adcs[0].d_bytespersamp * ! linux_adcs[0].d_nchannels * sys_dacblocksize); if (sys_verbose) fprintf(stderr, "...done.\n"); *************** *** 477,485 **** int j; memset(buf, 0, linux_dacs[i].d_bytespersamp * ! linux_dacs[i].d_nchannels * DEFDACBLKSIZE); ! for (j = 0; j < sys_advance_samples/DEFDACBLKSIZE; j++) write(linux_dacs[i].d_fd, buf, linux_dacs[i].d_bytespersamp * ! linux_dacs[i].d_nchannels * DEFDACBLKSIZE); } sys_setalarm(0); --- 477,485 ---- int j; memset(buf, 0, linux_dacs[i].d_bytespersamp * ! linux_dacs[i].d_nchannels * sys_dacblocksize); ! for (j = 0; j < sys_advance_samples/sys_dacblocksize; j++) write(linux_dacs[i].d_fd, buf, linux_dacs[i].d_bytespersamp * ! linux_dacs[i].d_nchannels * sys_dacblocksize); } sys_setalarm(0); *************** *** 551,555 **** { int dev, zeroed = 0, wantsize; ! char buf[OSS_MAXSAMPLEWIDTH * DEFDACBLKSIZE * OSS_MAXCHPERDEV]; audio_buf_info ainfo;
--- 551,555 ---- { int dev, zeroed = 0, wantsize; ! char buf[OSS_MAXSAMPLEWIDTH * sys_dacblocksize * OSS_MAXCHPERDEV]; audio_buf_info ainfo;
*************** *** 631,635 **** long fill; int i, j, dev, rtnval = SENDDACS_YES; ! char buf[OSS_MAXSAMPLEWIDTH * DEFDACBLKSIZE * OSS_MAXCHPERDEV]; t_oss_int16 *sp; t_oss_int32 *lp; --- 631,635 ---- long fill; int i, j, dev, rtnval = SENDDACS_YES; ! char buf[OSS_MAXSAMPLEWIDTH * sys_dacblocksize * OSS_MAXCHPERDEV]; t_oss_int16 *sp; t_oss_int32 *lp; *************** *** 725,730 **** if (linux_dacs[dev].d_bytespersamp == 4) { ! for (i = DEFDACBLKSIZE * nchannels, fp1 = sys_soundout + ! DEFDACBLKSIZE*thischan, lp = (t_oss_int32 *)buf; i--; fp1++, lp++) { --- 725,730 ---- if (linux_dacs[dev].d_bytespersamp == 4) { ! for (i = sys_dacblocksize * nchannels, fp1 = sys_soundout + ! sys_dacblocksize*thischan, lp = (t_oss_int32 *)buf; i--; fp1++, lp++) { *************** *** 736,744 **** else { ! for (i = DEFDACBLKSIZE, fp1 = sys_soundout + ! DEFDACBLKSIZE*thischan, sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels) { ! for (j=0, fp2 = fp1; j<nchannels; j++, fp2 += DEFDACBLKSIZE) { int s = *fp2 * 32767.; --- 736,744 ---- else { ! for (i = sys_dacblocksize, fp1 = sys_soundout + ! sys_dacblocksize*thischan, sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels) { ! for (j=0, fp2 = fp1; j<nchannels; j++, fp2 += sys_dacblocksize) { int s = *fp2 * 32767.; *************** *** 762,766 **** } memset(sys_soundout, 0, ! sys_outchannels * (sizeof(float) * DEFDACBLKSIZE));
/* do input */ --- 762,766 ---- } memset(sys_soundout, 0, ! sys_outchannels * (sizeof(float) * sys_dacblocksize));
/* do input */ *************** *** 783,788 **** if (linux_adcs[dev].d_bytespersamp == 4) { ! for (i = DEFDACBLKSIZE*nchannels, ! fp1 = sys_soundin + thischan*DEFDACBLKSIZE, lp = (t_oss_int32 *)buf; i--; fp1++, lp++) { --- 783,788 ---- if (linux_adcs[dev].d_bytespersamp == 4) { ! for (i = sys_dacblocksize*nchannels, ! fp1 = sys_soundin + thischan*sys_dacblocksize, lp = (t_oss_int32 *)buf; i--; fp1++, lp++) { *************** *** 792,800 **** else { ! for (i = DEFDACBLKSIZE,fp1 = sys_soundin + thischan*DEFDACBLKSIZE, sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels) { for (j=0;j<sys_inchannels;j++) ! fp1[j*DEFDACBLKSIZE] = (float)sp[j]*(float)3.051850e-05; } } --- 792,800 ---- else { ! for (i = sys_dacblocksize,fp1 = sys_soundin + thischan*sys_dacblocksize, sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels) { for (j=0;j<sys_inchannels;j++) ! fp1[j*sys_dacblocksize] = (float)sp[j]*(float)3.051850e-05; } }
Index: s_audio_mmio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio_mmio.c,v retrieving revision 1.1.1.1.2.2 retrieving revision 1.1.1.1.2.2.2.1 diff -C2 -d -r1.1.1.1.2.2 -r1.1.1.1.2.2.2.1 *** s_audio_mmio.c 12 Sep 2003 21:02:15 -0000 1.1.1.1.2.2 --- s_audio_mmio.c 1 Dec 2003 11:58:41 -0000 1.1.1.1.2.2.2.1 *************** *** 28,32 ****
int nt_realdacblksize; ! #define DEFREALDACBLKSIZE (4 * DEFDACBLKSIZE) /* larger underlying bufsize */
#define MAXBUFFER 100 /* number of buffers in use at maximum advance */ --- 28,32 ----
int nt_realdacblksize; ! #define DEFREALDACBLKSIZE (4 * sys_dacblocksize) /* larger underlying bufsize */
#define MAXBUFFER 100 /* number of buffers in use at maximum advance */ *************** *** 502,506 **** int i, n; float maxsamp; ! for (i = 0, n = 2 * nt_nwavein * DEFDACBLKSIZE, maxsamp = nt_inmax; i < n; i++) { --- 502,506 ---- int i, n; float maxsamp; ! for (i = 0, n = 2 * nt_nwavein * sys_dacblocksize, maxsamp = nt_inmax; i < n; i++) { *************** *** 510,514 **** } nt_inmax = maxsamp; ! for (i = 0, n = 2 * nt_nwaveout * DEFDACBLKSIZE, maxsamp = nt_outmax; i < n; i++) { --- 510,514 ---- } nt_inmax = maxsamp; ! for (i = 0, n = 2 * nt_nwaveout * sys_dacblocksize, maxsamp = nt_outmax; i < n; i++) { *************** *** 566,572 **** for (i = 0, sp1 = (short *)(ntsnd_outvec[nda][phase].lpData) + CHANNELS_PER_DEVICE * nt_fill; ! i < 2; i++, fp1 += DEFDACBLKSIZE, sp1++) { ! for (j = 0, fp2 = fp1, sp2 = sp1; j < DEFDACBLKSIZE; j++, fp2++, sp2 += CHANNELS_PER_DEVICE) { --- 566,572 ---- for (i = 0, sp1 = (short *)(ntsnd_outvec[nda][phase].lpData) + CHANNELS_PER_DEVICE * nt_fill; ! i < 2; i++, fp1 += sys_dacblocksize, sp1++) { ! for (j = 0, fp2 = fp1, sp2 = sp1; j < sys_dacblocksize; j++, fp2++, sp2 += CHANNELS_PER_DEVICE) { *************** *** 579,583 **** } memset(sys_soundout, 0, ! (DEFDACBLKSIZE *sizeof(t_sample)*CHANNELS_PER_DEVICE)*nt_nwaveout);
/* vice versa for the input buffer */ --- 579,583 ---- } memset(sys_soundout, 0, ! (sys_dacblocksize *sizeof(t_sample)*CHANNELS_PER_DEVICE)*nt_nwaveout);
/* vice versa for the input buffer */ *************** *** 589,595 **** for (i = 0, sp1 = (short *)(ntsnd_invec[nad][phase].lpData) + CHANNELS_PER_DEVICE * nt_fill; ! i < 2; i++, fp1 += DEFDACBLKSIZE, sp1++) { ! for (j = 0, fp2 = fp1, sp2 = sp1; j < DEFDACBLKSIZE; j++, fp2++, sp2 += CHANNELS_PER_DEVICE) { --- 589,595 ---- for (i = 0, sp1 = (short *)(ntsnd_invec[nad][phase].lpData) + CHANNELS_PER_DEVICE * nt_fill; ! i < 2; i++, fp1 += sys_dacblocksize, sp1++) { ! for (j = 0, fp2 = fp1, sp2 = sp1; j < sys_dacblocksize; j++, fp2++, sp2 += CHANNELS_PER_DEVICE) { *************** *** 599,603 **** }
! nt_fill = nt_fill + DEFDACBLKSIZE; if (nt_fill == nt_realdacblksize) { --- 599,603 ---- }
! nt_fill = nt_fill + sys_dacblocksize; if (nt_fill == nt_realdacblksize) {
Index: s_audio_jack.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio_jack.c,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.5.2.1 diff -C2 -d -r1.1.2.5 -r1.1.2.5.2.1 *** s_audio_jack.c 7 Oct 2003 14:31:45 -0000 1.1.2.5 --- s_audio_jack.c 1 Dec 2003 11:58:41 -0000 1.1.2.5.2.1 *************** *** 334,344 **** fp = sys_soundout; for (j = 0; j < sys_outchannels; j++) { ! memcpy(jack_outbuf + (j * BUF_JACK) + jack_filled,fp, DEFDACBLKSIZE*sizeof(float)); ! fp += DEFDACBLKSIZE; } fp = sys_soundin; for (j = 0; j < sys_inchannels; j++) { ! memcpy(fp, jack_inbuf + (j * BUF_JACK) + jack_filled, DEFDACBLKSIZE*sizeof(float)); ! fp += DEFDACBLKSIZE; }
--- 334,344 ---- fp = sys_soundout; for (j = 0; j < sys_outchannels; j++) { ! memcpy(jack_outbuf + (j * BUF_JACK) + jack_filled,fp, sys_dacblocksize*sizeof(float)); ! fp += sys_dacblocksize; } fp = sys_soundin; for (j = 0; j < sys_inchannels; j++) { ! memcpy(fp, jack_inbuf + (j * BUF_JACK) + jack_filled, sys_dacblocksize*sizeof(float)); ! fp += sys_dacblocksize; }
*************** *** 348,353 **** }
! memset(sys_soundout,0,DEFDACBLKSIZE*sizeof(float)*sys_outchannels); ! jack_filled += DEFDACBLKSIZE; return rtnval; } --- 348,353 ---- }
! memset(sys_soundout,0,sys_dacblocksize*sizeof(float)*sys_outchannels); ! jack_filled += sys_dacblocksize; return rtnval; }
Index: s_audio_alsa.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio_alsa.c,v retrieving revision 1.1.1.1.2.4 retrieving revision 1.1.1.1.2.4.2.1 diff -C2 -d -r1.1.1.1.2.4 -r1.1.1.1.2.4.2.1 *** s_audio_alsa.c 18 Nov 2003 10:34:10 -0000 1.1.1.1.2.4 --- s_audio_alsa.c 1 Dec 2003 11:58:41 -0000 1.1.1.1.2.4.2.1 *************** *** 27,32 **** #define ALSA_SAMPLEWIDTH_16 sizeof(t_alsa_sample16) #define ALSA_SAMPLEWIDTH_32 sizeof(t_alsa_sample32) ! #define ALSA_XFERSIZE16 (signed int)(sizeof(t_alsa_sample16) * DEFDACBLKSIZE) ! #define ALSA_XFERSIZE32 (signed int)(sizeof(t_alsa_sample32) * DEFDACBLKSIZE) #define ALSA_MAXDEV 1 #define ALSA_JITTER 1024 --- 27,32 ---- #define ALSA_SAMPLEWIDTH_16 sizeof(t_alsa_sample16) #define ALSA_SAMPLEWIDTH_32 sizeof(t_alsa_sample32) ! #define ALSA_XFERSIZE16 (signed int)(sizeof(t_alsa_sample16) * sys_dacblocksize) ! #define ALSA_XFERSIZE32 (signed int)(sizeof(t_alsa_sample32) * sys_dacblocksize) #define ALSA_MAXDEV 1 #define ALSA_JITTER 1024 *************** *** 421,427 **** free(alsa_snd_buf); alsa_snd_buf = (void *)malloc( ! sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE * (outchans > inchans ? outchans : inchans)); ! memset(alsa_snd_buf, 0, sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE * (outchans > inchans ? outchans : inchans)); /* make an array of pointers too in case we need them */ --- 421,427 ---- free(alsa_snd_buf); alsa_snd_buf = (void *)malloc( ! sizeof(char) * alsa_samplewidth * sys_dacblocksize * (outchans > inchans ? outchans : inchans)); ! memset(alsa_snd_buf, 0, sizeof(char) * alsa_samplewidth * sys_dacblocksize * (outchans > inchans ? outchans : inchans)); /* make an array of pointers too in case we need them */ *************** *** 431,447 **** sizeof(void *) * (outchans > inchans ? outchans : inchans)); for (i = 0; i < (outchans > inchans ? outchans : inchans); i++) ! alsa_buf_ptrs[i] = (t_alsa_sample32 *)alsa_snd_buf + i * DEFDACBLKSIZE;
// fill the buffer with silence if (outchans) { ! i = (frag_size * nfrags)/DEFDACBLKSIZE + 1; while (i--) { if (alsa_device.outnoninterleave) snd_pcm_writen(alsa_device.outhandle, alsa_buf_ptrs, ! DEFDACBLKSIZE); else snd_pcm_writei(alsa_device.outhandle, alsa_snd_buf, ! DEFDACBLKSIZE); } /* confused about this: */ --- 431,447 ---- sizeof(void *) * (outchans > inchans ? outchans : inchans)); for (i = 0; i < (outchans > inchans ? outchans : inchans); i++) ! alsa_buf_ptrs[i] = (t_alsa_sample32 *)alsa_snd_buf + i * sys_dacblocksize;
// fill the buffer with silence if (outchans) { ! i = (frag_size * nfrags)/sys_dacblocksize + 1; while (i--) { if (alsa_device.outnoninterleave) snd_pcm_writen(alsa_device.outhandle, alsa_buf_ptrs, ! sys_dacblocksize); else snd_pcm_writei(alsa_device.outhandle, alsa_snd_buf, ! sys_dacblocksize); } /* confused about this: */ *************** *** 490,495 **** int outchannels = (sys_outchannels > alsa_outchannels ? alsa_outchannels : sys_outchannels); ! unsigned int intransfersize = DEFDACBLKSIZE; ! unsigned int outtransfersize = DEFDACBLKSIZE;
// get the status --- 490,495 ---- int outchannels = (sys_outchannels > alsa_outchannels ? alsa_outchannels : sys_outchannels); ! unsigned int intransfersize = sys_dacblocksize; ! unsigned int outtransfersize = sys_dacblocksize;
// get the status *************** *** 533,537 **** if (alsa_device.outnoninterleave) { ! int n = outchannels * DEFDACBLKSIZE; for (i = 0, fp1 = fp; i < n; i++) { --- 533,537 ---- if (alsa_device.outnoninterleave) { ! int n = outchannels * sys_dacblocksize; for (i = 0, fp1 = fp; i < n; i++) { *************** *** 539,543 **** ((t_alsa_sample32 *)alsa_snd_buf)[i] = CLIP32(s1); } ! n = alsa_outchannels * DEFDACBLKSIZE; for (; i < n; i++) ((t_alsa_sample32 *)alsa_snd_buf)[i] = 0; --- 539,543 ---- ((t_alsa_sample32 *)alsa_snd_buf)[i] = CLIP32(s1); } ! n = alsa_outchannels * sys_dacblocksize; for (; i < n; i++) ((t_alsa_sample32 *)alsa_snd_buf)[i] = 0; *************** *** 546,552 **** { for (i = 0, fp1 = fp; i < outchannels; i++, ! fp1 += DEFDACBLKSIZE) { ! for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--; j += alsa_outchannels, fp2++) { --- 546,552 ---- { for (i = 0, fp1 = fp; i < outchannels; i++, ! fp1 += sys_dacblocksize) { ! for (j = i, k = sys_dacblocksize, fp2 = fp1; k--; j += alsa_outchannels, fp2++) { *************** *** 559,565 **** else { ! for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DEFDACBLKSIZE) { ! for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--; j += alsa_outchannels, fp2++) { --- 559,565 ---- else { ! for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += sys_dacblocksize) { ! for (j = i, k = sys_dacblocksize, fp2 = fp1; k--; j += alsa_outchannels, fp2++) { *************** *** 599,603 ****
/* zero out the output buffer */ ! memset(sys_soundout, 0, DEFDACBLKSIZE * sizeof(*sys_soundout) * sys_outchannels); if (sys_getrealtime() - timenow > 0.002) --- 599,603 ----
/* zero out the output buffer */ ! memset(sys_soundout, 0, sys_dacblocksize * sizeof(*sys_soundout) * sys_outchannels); if (sys_getrealtime() - timenow > 0.002) *************** *** 643,647 **** if (alsa_device.innoninterleave) { ! int n = inchannels * DEFDACBLKSIZE; for (i = 0, fp1 = fp; i < n; i++) *fp1 = (float) ((t_alsa_sample32 *)alsa_snd_buf)[i] --- 643,647 ---- if (alsa_device.innoninterleave) { ! int n = inchannels * sys_dacblocksize; for (i = 0, fp1 = fp; i < n; i++) *fp1 = (float) ((t_alsa_sample32 *)alsa_snd_buf)[i] *************** *** 651,657 **** { for (i = 0, fp1 = fp; i < inchannels; ! i++, fp1 += DEFDACBLKSIZE) { ! for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--; j += alsa_inchannels, fp2++) *fp2 = (float) ((t_alsa_sample32 *)alsa_snd_buf)[j] --- 651,657 ---- { for (i = 0, fp1 = fp; i < inchannels; ! i++, fp1 += sys_dacblocksize) { ! for (j = i, k = sys_dacblocksize, fp2 = fp1; k--; j += alsa_inchannels, fp2++) *fp2 = (float) ((t_alsa_sample32 *)alsa_snd_buf)[j] *************** *** 662,668 **** else { ! for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DEFDACBLKSIZE) { ! for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--; j += alsa_inchannels, fp2++) *fp2 = (float) ((t_alsa_sample16 *)alsa_snd_buf)[j] --- 662,668 ---- else { ! for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += sys_dacblocksize) { ! for (j = i, k = sys_dacblocksize, fp2 = fp1; k--; j += alsa_inchannels, fp2++) *fp2 = (float) ((t_alsa_sample16 *)alsa_snd_buf)[j] *************** *** 721,733 **** } memset(alsa_snd_buf, 0, ! sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE * sys_outchannels); for (i = 0; i < 1000000; i++) { if (alsa_device.outnoninterleave) result = snd_pcm_writen(alsa_device.outhandle, alsa_buf_ptrs, ! DEFDACBLKSIZE); else result = snd_pcm_writei(alsa_device.outhandle, alsa_snd_buf, ! DEFDACBLKSIZE); ! if (result != (int)DEFDACBLKSIZE) break; } --- 721,733 ---- } memset(alsa_snd_buf, 0, ! sizeof(char) * alsa_samplewidth * sys_dacblocksize * sys_outchannels); for (i = 0; i < 1000000; i++) { if (alsa_device.outnoninterleave) result = snd_pcm_writen(alsa_device.outhandle, alsa_buf_ptrs, ! sys_dacblocksize); else result = snd_pcm_writei(alsa_device.outhandle, alsa_snd_buf, ! sys_dacblocksize); ! if (result != (int)sys_dacblocksize) break; } *************** *** 739,752 **** int i, result; memset(alsa_snd_buf, 0, ! sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE * alsa_outchannels); for (i = 0; i < n; i++) { if (alsa_device.outnoninterleave) result = snd_pcm_writen(alsa_device.outhandle, alsa_buf_ptrs, ! DEFDACBLKSIZE); else result = snd_pcm_writei(alsa_device.outhandle, alsa_snd_buf, ! DEFDACBLKSIZE); #if 0 ! if (result != DEFDACBLKSIZE) post("result %d", result); #endif --- 739,752 ---- int i, result; memset(alsa_snd_buf, 0, ! sizeof(char) * alsa_samplewidth * sys_dacblocksize * alsa_outchannels); for (i = 0; i < n; i++) { if (alsa_device.outnoninterleave) result = snd_pcm_writen(alsa_device.outhandle, alsa_buf_ptrs, ! sys_dacblocksize); else result = snd_pcm_writei(alsa_device.outhandle, alsa_snd_buf, ! sys_dacblocksize); #if 0 ! if (result != sys_dacblocksize) post("result %d", result); #endif *************** *** 760,766 **** { result = snd_pcm_readi(alsa_device.inhandle, alsa_snd_buf, ! DEFDACBLKSIZE); #if 0 ! if (result != DEFDACBLKSIZE) post("result %d", result); #endif --- 760,766 ---- { result = snd_pcm_readi(alsa_device.inhandle, alsa_snd_buf, ! sys_dacblocksize); #if 0 ! if (result != sys_dacblocksize) post("result %d", result); #endif *************** *** 803,807 **** } defect = indelay + outdelay - alsa_buf_samps; ! if (defect < -DEFDACBLKSIZE) { checkit = 1; --- 803,807 ---- } defect = indelay + outdelay - alsa_buf_samps; ! if (defect < -sys_dacblocksize) { checkit = 1;
Index: s_audio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v retrieving revision 1.1.1.1.2.6 retrieving revision 1.1.1.1.2.6.2.1 diff -C2 -d -r1.1.1.1.2.6 -r1.1.1.1.2.6.2.1 *** s_audio.c 18 Nov 2003 10:34:10 -0000 1.1.1.1.2.6 --- s_audio.c 1 Dec 2003 11:58:41 -0000 1.1.1.1.2.6.2.1 *************** *** 24,29 **** typedef long t_pa_sample; #define SYS_SAMPLEWIDTH sizeof(t_pa_sample) ! #define SYS_BYTESPERCHAN (DEFDACBLKSIZE * SYS_SAMPLEWIDTH) ! #define SYS_XFERSAMPS (SYS_DEFAULTCH*DEFDACBLKSIZE) #define SYS_XFERSIZE (SYS_SAMPLEWIDTH * SYS_XFERSAMPS)
--- 24,29 ---- typedef long t_pa_sample; #define SYS_SAMPLEWIDTH sizeof(t_pa_sample) ! #define SYS_BYTESPERCHAN (sys_dacblocksize * SYS_SAMPLEWIDTH) ! #define SYS_XFERSAMPS (SYS_DEFAULTCH*sys_dacblocksize) #define SYS_XFERSIZE (SYS_SAMPLEWIDTH * SYS_XFERSAMPS)
*************** *** 34,37 **** --- 34,41 ---- int sys_audioapi = API_DEFAULT;
+ int sys_dacblocksize; + int sys_schedblocksize; + + static int sys_meters; /* true if we're metering */ static float sys_inmax; /* max input amplitude */ *************** *** 58,61 **** --- 62,66 ---- static int audio_audiochoutdev[MAXAUDIOOUTDEV]; static int audio_rate; + static int audio_dacblocksize; static int audio_advance;
*************** *** 70,74 **** int *pnaudioindev, int *paudioindev, int *chindev, int *pnaudiooutdev, int *paudiooutdev, int *choutdev, ! int *prate, int *padvance) { int i; --- 75,79 ---- int *pnaudioindev, int *paudioindev, int *chindev, int *pnaudiooutdev, int *paudiooutdev, int *choutdev, ! int *prate, int *pdacblocksize, int *padvance) { int i; *************** *** 82,85 **** --- 87,91 ---- choutdev[i] = audio_audiochoutdev[i]; *prate = audio_rate; + *pdacblocksize = audio_dacblocksize; *padvance = audio_advance; } *************** *** 88,92 **** int naudioindev, int *audioindev, int *chindev, int naudiooutdev, int *audiooutdev, int *choutdev, ! int rate, int advance) { int i; --- 94,98 ---- int naudioindev, int *audioindev, int *chindev, int naudiooutdev, int *audiooutdev, int *choutdev, ! int rate, int dacblocksize, int advance) { int i; *************** *** 100,103 **** --- 106,110 ---- audio_audiochoutdev[i] = choutdev[i]; audio_rate = rate; + audio_dacblocksize = dacblocksize; audio_advance = advance; } *************** *** 122,130 **** /* set channels and sample rate. */
! static void sys_setchsr(int chin, int chout, int sr) { int nblk; ! int inbytes = (chin ? chin : 2) * (DEFDACBLKSIZE*sizeof(float)); ! int outbytes = (chout ? chout : 2) * (DEFDACBLKSIZE*sizeof(float));
sys_inchannels = chin; --- 129,147 ---- /* set channels and sample rate. */
! static void sys_setchsr(int chin, int chout, int sr, int dacblocksize) { int nblk; ! int inbytes; ! int outbytes; ! ! if (dacblocksize != (1 << ilog2(dacblocksize))) ! post("warning: adjusting dac~blocksize to power of 2: %d", ! (dacblocksize = (1 << ilog2(dacblocksize)))); ! ! sys_dacblocksize = dacblocksize; ! sys_schedblocksize = dacblocksize; ! ! inbytes = (chin ? chin : 2) * (sys_dacblocksize*sizeof(float)); ! outbytes = (chout ? chout : 2) * (sys_dacblocksize*sizeof(float));
sys_inchannels = chin; *************** *** 132,137 **** sys_dacsr = sr; sys_advance_samples = (sys_schedadvance * sys_dacsr) / (1000000.); ! if (sys_advance_samples < 3 * DEFDACBLKSIZE) ! sys_advance_samples = 3 * DEFDACBLKSIZE;
if (sys_soundin) --- 149,154 ---- sys_dacsr = sr; sys_advance_samples = (sys_schedadvance * sys_dacsr) / (1000000.); ! if (sys_advance_samples < 3 * sys_dacblocksize) ! sys_advance_samples = 3 * sys_dacblocksize;
if (sys_soundin) *************** *** 160,164 **** 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; --- 177,181 ---- void sys_open_audio(int naudioindev, int *audioindev, int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, ! int *choutdev, int rate, int dacblocksize, int advance, int enable) { int i, *ip; *************** *** 167,170 **** --- 184,189 ---- if (rate < 1) rate = SYS_DEFAULTSRATE; + if (dacblocksize < 1) + dacblocksize = DEFDACBLKSIZE; audio_init(); /* Since the channel vector might be longer than the *************** *** 280,284 **** } sys_schedadvance = advance * 1000; ! sys_setchsr(inchans, outchans, rate); sys_log_error(ERR_NOTHING);
--- 299,303 ---- } sys_schedadvance = advance * 1000; ! sys_setchsr(inchans, outchans, rate, dacblocksize); sys_log_error(ERR_NOTHING);
*************** *** 326,330 **** } sys_save_audio_params(naudioindev, audioindev, chindev, ! naudiooutdev, audiooutdev, choutdev, sys_dacsr, advance); audio_state = enable; sys_vgui("set pd_whichapi %d\n", (audio_isopen() ? sys_audioapi : 0)); --- 345,349 ---- } sys_save_audio_params(naudioindev, audioindev, chindev, ! naudiooutdev, audiooutdev, choutdev, sys_dacsr, sys_dacblocksize, advance); audio_state = enable; sys_vgui("set pd_whichapi %d\n", (audio_isopen() ? sys_audioapi : 0)); *************** *** 370,378 **** 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); }
--- 389,398 ---- int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; ! int rate, dacblocksize, advance; sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &dacblocksize, &advance); sys_open_audio(naudioindev, audioindev, naudioindev, chindev, ! naudiooutdev, audiooutdev, naudiooutdev, choutdev, ! rate, dacblocksize, advance, 1); }
*************** *** 383,387 **** int i, n; float maxsamp; ! for (i = 0, n = sys_inchannels * DEFDACBLKSIZE, maxsamp = sys_inmax; i < n; i++) { --- 403,407 ---- int i, n; float maxsamp; ! for (i = 0, n = sys_inchannels * sys_dacblocksize, maxsamp = sys_inmax; i < n; i++) { *************** *** 391,395 **** } sys_inmax = maxsamp; ! for (i = 0, n = sys_outchannels * DEFDACBLKSIZE, maxsamp = sys_outmax; i < n; i++) { --- 411,415 ---- } sys_inmax = maxsamp; ! for (i = 0, n = sys_outchannels * sys_dacblocksize, maxsamp = sys_outmax; i < n; i++) { *************** *** 575,579 **** 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]; --- 595,599 ---- audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4, audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4; ! int rate, dacblocksize, advance; /* these are all the devices on your system: */ char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; *************** *** 605,609 ****
sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &advance);
/* post("naudioindev %d naudiooutdev %d longform %f", --- 625,629 ----
sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &dacblocksize, &advance);
/* post("naudioindev %d naudiooutdev %d longform %f", *************** *** 633,637 **** %s %d %d %d %d %d %d %d %d \ %s %d %d %d %d %d %d %d %d \ ! %d %d %d %d\n", indevliststring, audioindev1, audioindev2, audioindev3, audioindev4, --- 653,657 ---- %s %d %d %d %d %d %d %d %d \ %s %d %d %d %d %d %d %d %d \ ! %d %d %d %d %d\n", indevliststring, audioindev1, audioindev2, audioindev3, audioindev4, *************** *** 640,644 **** audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4, audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4, ! rate, advance, canmulti, (flongform != 0)); gfxstub_deleteforkey(0); gfxstub_new(&glob_pdobject, glob_audio_properties, buf); --- 660,664 ---- audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4, audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4, ! rate, dacblocksize, advance, canmulti, (flongform != 0)); gfxstub_deleteforkey(0); gfxstub_new(&glob_pdobject, glob_audio_properties, buf); *************** *** 650,654 **** int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; ! int rate, advance, audioon, i, nindev, noutdev; int audioindev1, audioinchan1, audiooutdev1, audiooutchan1; int newaudioindev[4], newaudioinchan[4], --- 670,674 ---- int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; ! int rate, dacblocksize, advance, audioon, i, nindev, noutdev; int audioindev1, audioinchan1, audiooutdev1, audiooutchan1; int newaudioindev[4], newaudioinchan[4], *************** *** 656,660 **** /* the new values the dialog came back with: */ int newrate = atom_getintarg(16, argc, argv); ! int newadvance = atom_getintarg(17, argc, argv); int statewas;
--- 676,681 ---- /* the new values the dialog came back with: */ int newrate = atom_getintarg(16, argc, argv); ! int newdacblocksize = atom_getintarg(17, argc, argv); ! int newadvance = atom_getintarg(18, argc, argv); int statewas;
*************** *** 693,697 **** sys_open_audio(nindev, newaudioindev, nindev, newaudioinchan, noutdev, newaudiooutdev, noutdev, newaudiooutchan, ! newrate, newadvance, 1); }
--- 714,718 ---- sys_open_audio(nindev, newaudioindev, nindev, newaudioinchan, noutdev, newaudiooutdev, noutdev, newaudiooutchan, ! newrate, newdacblocksize, newadvance, 1); }
*************** *** 845,854 **** 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_close_audio(); sys_open_audio(naudioindev, audioindev, naudioindev, chindev, ! naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate, advance, 1); } --- 866,876 ---- int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; ! int rate, dacblocksize, advance; sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &dacblocksize, &advance); sys_close_audio(); sys_open_audio(naudioindev, audioindev, naudioindev, chindev, ! naudiooutdev, audiooutdev, naudiooutdev, choutdev, ! rate, dacblocksize, advance, 1); }
Index: m_sched.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_sched.c,v retrieving revision 1.1.1.2.2.6 retrieving revision 1.1.1.2.2.6.2.1 diff -C2 -d -r1.1.1.2.2.6 -r1.1.1.2.2.6.2.1 *** m_sched.c 12 Sep 2003 21:19:04 -0000 1.1.1.2.2.6 --- m_sched.c 1 Dec 2003 11:58:41 -0000 1.1.1.2.2.6.2.1 *************** *** 23,27 **** static double sys_time_per_msec = TIMEUNITPERSEC / 1000.;
- int sys_schedblocksize = DEFDACBLKSIZE; int sys_usecsincelastsleep(void); int sys_sleepgrain; --- 23,26 ----
Index: d_dac.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/d_dac.c,v retrieving revision 1.1.1.2.2.4 retrieving revision 1.1.1.2.2.4.2.1 diff -C2 -d -r1.1.1.2.2.4 -r1.1.1.2.2.4.2.1 *** d_dac.c 6 Aug 2003 15:55:10 -0000 1.1.1.2.2.4 --- d_dac.c 1 Dec 2003 11:58:41 -0000 1.1.1.2.2.4.2.1 *************** *** 49,57 **** { int ch = *ip - 1; ! if ((*sp2)->s_n != DEFDACBLKSIZE) error("dac~: bad vector size"); else if (ch >= 0 && ch < sys_get_outchannels()) ! dsp_add(plus_perform, 4, sys_soundout + DEFDACBLKSIZE*ch, ! (*sp2)->s_vec, sys_soundout + DEFDACBLKSIZE*ch, DEFDACBLKSIZE); } } --- 49,57 ---- { int ch = *ip - 1; ! if ((*sp2)->s_n != sys_dacblocksize) error("dac~: bad vector size"); else if (ch >= 0 && ch < sys_get_outchannels()) ! dsp_add(plus_perform, 4, sys_soundout + sys_dacblocksize*ch, ! (*sp2)->s_vec, sys_soundout + sys_dacblocksize*ch, sys_dacblocksize); } } *************** *** 205,214 **** { int ch = *ip - 1; ! if ((*sp2)->s_n != DEFDACBLKSIZE) error("adc~: bad vector size"); else if (ch >= 0 && ch < sys_get_inchannels()) ! dsp_add_copy(sys_soundin + DEFDACBLKSIZE*ch, ! (*sp2)->s_vec, DEFDACBLKSIZE); ! else dsp_add_zero((*sp2)->s_vec, DEFDACBLKSIZE); } } --- 205,214 ---- { int ch = *ip - 1; ! if ((*sp2)->s_n != sys_dacblocksize) error("adc~: bad vector size"); else if (ch >= 0 && ch < sys_get_inchannels()) ! dsp_add_copy(sys_soundin + sys_dacblocksize*ch, ! (*sp2)->s_vec, sys_dacblocksize); ! else dsp_add_zero((*sp2)->s_vec, sys_dacblocksize); } }