Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19155
Modified Files: Tag: desiredata s_audio_oss.c Log Message: removed prefixes of t_oss_dev
Index: s_audio_oss.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio_oss.c,v retrieving revision 1.6.4.2.2.2.2.5 retrieving revision 1.6.4.2.2.2.2.6 diff -C2 -d -r1.6.4.2.2.2.2.5 -r1.6.4.2.2.2.2.6 *** s_audio_oss.c 9 Jul 2007 19:59:42 -0000 1.6.4.2.2.2.2.5 --- s_audio_oss.c 10 Jul 2007 06:13:33 -0000 1.6.4.2.2.2.2.6 *************** *** 45,56 ****
/* our device handles */ ! typedef struct _oss_dev { ! int d_fd; ! unsigned int d_space; /* bytes available for writing/reading */ ! int d_bufsize; /* total buffer size in blocks for this device */ ! int d_dropcount; /* # of buffers to drop for resync (output only) */ ! unsigned int d_nchannels; /* number of channels for this device */ ! unsigned int d_bytespersamp; /* bytes per sample (2 for 16 bit, 4 for 32) */ ! } t_oss_dev;
static t_oss_dev linux_dacs[OSS_MAXDEV]; --- 45,56 ----
/* our device handles */ ! struct t_oss_dev { ! int fd; ! unsigned int space; /* bytes available for writing/reading */ ! int bufsize; /* total buffer size in blocks for this device */ ! int dropcount; /* # of buffers to drop for resync (output only) */ ! unsigned int nchannels; /* number of channels for this device */ ! unsigned int bytespersamp; /* bytes per sample (2 for 16 bit, 4 for 32) */ ! };
static t_oss_dev linux_dacs[OSS_MAXDEV]; *************** *** 122,127 **** void oss_configure(t_oss_dev *dev, int srate, int dac, int skipblocksize) { /* IOhannes */ ! int orig, param, fd = dev->d_fd, wantformat; ! int nchannels = dev->d_nchannels; audio_buf_info ainfo; /* IOhannes : pd is very likely to crash if different formats are used on multiple soundcards */ --- 122,127 ---- void oss_configure(t_oss_dev *dev, int srate, int dac, int skipblocksize) { /* IOhannes */ ! int orig, param, fd = dev->fd, wantformat; ! int nchannels = dev->nchannels; audio_buf_info ainfo; /* IOhannes : pd is very likely to crash if different formats are used on multiple soundcards */ *************** *** 129,141 **** if (oss_32bit && (ioctl(fd,SNDCTL_DSP_GETFMTS,¶m) >= 0) && (param & AFMT_S32_BLOCKED)) { wantformat = AFMT_S32_BLOCKED; ! dev->d_bytespersamp = 4; } else { wantformat = AFMT_S16_NE; ! dev->d_bytespersamp = 2; } param = wantformat;
if (sys_verbose) ! post("bytes per sample = %d", dev->d_bytespersamp); if (ioctl(fd, SNDCTL_DSP_SETFMT, ¶m) == -1) fprintf(stderr,"OSS: Could not set DSP format\n"); --- 129,141 ---- if (oss_32bit && (ioctl(fd,SNDCTL_DSP_GETFMTS,¶m) >= 0) && (param & AFMT_S32_BLOCKED)) { wantformat = AFMT_S32_BLOCKED; ! dev->bytespersamp = 4; } else { wantformat = AFMT_S16_NE; ! dev->bytespersamp = 2; } param = wantformat;
if (sys_verbose) ! post("bytes per sample = %d", dev->bytespersamp); if (ioctl(fd, SNDCTL_DSP_SETFMT, ¶m) == -1) fprintf(stderr,"OSS: Could not set DSP format\n"); *************** *** 160,168 **** /* post("adv_samples %d", sys_advance_samples); */ nfragment = int(sys_schedadvance * 44100.e-6 / linux_fragsize); ! fragbytes = linux_fragsize * (dev->d_bytespersamp * nchannels); logfragsize = ilog2(fragbytes); if (fragbytes != (1 << logfragsize)) post("warning: OSS takes only power of 2 blocksize; using %d", ! (1 << logfragsize)/(dev->d_bytespersamp * nchannels)); if (sys_verbose) post("setting nfrags = %d, fragsize %d\n", nfragment, fragbytes);
--- 160,168 ---- /* post("adv_samples %d", sys_advance_samples); */ nfragment = int(sys_schedadvance * 44100.e-6 / linux_fragsize); ! fragbytes = linux_fragsize * (dev->bytespersamp * nchannels); logfragsize = ilog2(fragbytes); if (fragbytes != (1 << logfragsize)) post("warning: OSS takes only power of 2 blocksize; using %d", ! (1 << logfragsize)/(dev->bytespersamp * nchannels)); if (sys_verbose) post("setting nfrags = %d, fragsize %d\n", nfragment, fragbytes);
*************** *** 189,201 **** if (ioctl(fd, SOUND_PCM_GETOSPACE,&ainfo) < 0) fprintf(stderr,"OSS: ioctl on output device failed"); ! dev->d_bufsize = ainfo.bytes;
! defect = sys_advance_samples * (dev->d_bytespersamp * nchannels) ! - dev->d_bufsize - OSS_XFERSIZE(nchannels, dev->d_bytespersamp); if (defect > 0) { ! if (sys_verbose || defect > (dev->d_bufsize >> 2)) fprintf(stderr, "OSS: requested audio buffer size %d limited to %d\n", ! sys_advance_samples * (dev->d_bytespersamp * nchannels), dev->d_bufsize); ! sys_advance_samples = (dev->d_bufsize-OSS_XFERSAMPS(nchannels)) / (dev->d_bytespersamp*nchannels); } } --- 189,201 ---- if (ioctl(fd, SOUND_PCM_GETOSPACE,&ainfo) < 0) fprintf(stderr,"OSS: ioctl on output device failed"); ! dev->bufsize = ainfo.bytes;
! defect = sys_advance_samples * (dev->bytespersamp * nchannels) ! - dev->bufsize - OSS_XFERSIZE(nchannels, dev->bytespersamp); if (defect > 0) { ! if (sys_verbose || defect > (dev->bufsize >> 2)) fprintf(stderr, "OSS: requested audio buffer size %d limited to %d\n", ! sys_advance_samples * (dev->bytespersamp * nchannels), dev->bufsize); ! sys_advance_samples = (dev->bufsize-OSS_XFERSAMPS(nchannels)) / (dev->bytespersamp*nchannels); } } *************** *** 229,233 **** linux_nindevs = linux_noutdevs = 0; /* mark devices unopened */ ! for (int i=0; i<OSS_MAXDEV; i++) linux_adcs[i].d_fd = linux_dacs[i].d_fd = -1;
/* open output devices */ --- 229,233 ---- linux_nindevs = linux_noutdevs = 0; /* mark devices unopened */ ! for (int i=0; i<OSS_MAXDEV; i++) linux_adcs[i].fd = linux_dacs[i].fd = -1;
/* open output devices */ *************** *** 259,263 **** post("couldn't set audio device flags"); if (sys_verbose) post("opened %s for reading and writing\n", devname); ! linux_adcs[inindex].d_fd = fd; } } --- 259,263 ---- post("couldn't set audio device flags"); if (sys_verbose) post("opened %s for reading and writing\n", devname); ! linux_adcs[inindex].fd = fd; } } *************** *** 289,294 **** close(fd); } else { ! linux_dacs[linux_noutdevs].d_nchannels = gotchans; ! linux_dacs[linux_noutdevs].d_fd = fd; oss_configure(&linux_dacs[linux_noutdevs], rate, 1, 0);
--- 289,294 ---- close(fd); } else { ! linux_dacs[linux_noutdevs].nchannels = gotchans; ! linux_dacs[linux_noutdevs].fd = fd; oss_configure(&linux_dacs[linux_noutdevs], rate, 1, 0);
*************** *** 296,300 **** outchannels += gotchans; if (inindex >= 0) { ! linux_adcs[inindex].d_nchannels = gotchans; chin[inindex] = gotchans; } --- 296,300 ---- outchannels += gotchans; if (inindex >= 0) { ! linux_adcs[inindex].nchannels = gotchans; chin[inindex] = gotchans; } *************** *** 317,322 **** sys_setalarm(1000000); /* perhaps it's already open from the above? */ ! if (linux_dacs[n].d_fd >= 0) { ! fd = linux_adcs[n].d_fd; alreadyopened = 1; } else { --- 317,322 ---- sys_setalarm(1000000); /* perhaps it's already open from the above? */ ! if (linux_dacs[n].fd >= 0) { ! fd = linux_adcs[n].fd; alreadyopened = 1; } else { *************** *** 331,335 **** if (sys_verbose) post("opened %s for reading only\n", devname); } ! linux_adcs[linux_nindevs].d_fd = fd;
gotchans = oss_setchannels(fd, (wantchannels>OSS_MAXCHPERDEV)?OSS_MAXCHPERDEV:wantchannels, devname); --- 331,335 ---- if (sys_verbose) post("opened %s for reading only\n", devname); } ! linux_adcs[linux_nindevs].fd = fd;
gotchans = oss_setchannels(fd, (wantchannels>OSS_MAXCHPERDEV)?OSS_MAXCHPERDEV:wantchannels, devname); *************** *** 341,345 **** }
! linux_adcs[linux_nindevs].d_nchannels = gotchans; oss_configure(linux_adcs+linux_nindevs, rate, 0, alreadyopened); inchannels += gotchans; --- 341,345 ---- }
! linux_adcs[linux_nindevs].nchannels = gotchans; oss_configure(linux_adcs+linux_nindevs, rate, 0, alreadyopened); inchannels += gotchans; *************** *** 359,363 **** if (linux_nindevs) { if (sys_verbose) fprintf(stderr,("OSS: issuing first ADC 'read' ... ")); ! 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"); --- 359,363 ---- if (linux_nindevs) { if (sys_verbose) fprintf(stderr,("OSS: issuing first ADC 'read' ... ")); ! read(linux_adcs[0].fd, buf, linux_adcs[0].bytespersamp * linux_adcs[0].nchannels * sys_dacblocksize); if (sys_verbose) fprintf(stderr, "...done.\n"); *************** *** 366,372 **** for (i = 0; i < linux_noutdevs; i++) { t_oss_dev &d = linux_dacs[i]; ! memset(buf, 0, d.d_bytespersamp * d.d_nchannels * sys_dacblocksize); for (int j = 0; j < sys_advance_samples/sys_dacblocksize; j++) ! write(d.d_fd, buf, d.d_bytespersamp * d.d_nchannels * sys_dacblocksize); } sys_setalarm(0); --- 366,372 ---- for (i = 0; i < linux_noutdevs; i++) { t_oss_dev &d = linux_dacs[i]; ! memset(buf, 0, d.bytespersamp * d.nchannels * sys_dacblocksize); for (int j = 0; j < sys_advance_samples/sys_dacblocksize; j++) ! write(d.fd, buf, d.bytespersamp * d.nchannels * sys_dacblocksize); } sys_setalarm(0); *************** *** 378,383 **** void oss_close_audio() { int i; ! for (i=0;i<linux_nindevs ;i++) close(linux_adcs[i].d_fd); ! for (i=0;i<linux_noutdevs;i++) close(linux_dacs[i].d_fd); linux_nindevs = linux_noutdevs = 0; } --- 378,383 ---- void oss_close_audio() { int i; ! for (i=0;i<linux_nindevs ;i++) close(linux_adcs[i].fd); ! for (i=0;i<linux_noutdevs;i++) close(linux_dacs[i].fd); linux_nindevs = linux_noutdevs = 0; } *************** *** 388,402 **** /* query audio devices for "available" data size. */ static void oss_calcspace() { - int dev; audio_buf_info ainfo; ! for (dev=0; dev < linux_noutdevs; dev++) { ! if (ioctl(linux_dacs[dev].d_fd, SOUND_PCM_GETOSPACE,&ainfo) < 0) fprintf(stderr,"OSS: ioctl on output device %d failed",dev); ! linux_dacs[dev].d_space = ainfo.bytes; } ! for (dev = 0; dev < linux_nindevs; dev++) { ! if (ioctl(linux_adcs[dev].d_fd, SOUND_PCM_GETISPACE,&ainfo) < 0) ! fprintf(stderr, "OSS: ioctl on input device %d, fd %d failed", dev, linux_adcs[dev].d_fd); ! linux_adcs[dev].d_space = ainfo.bytes; } } --- 388,401 ---- /* query audio devices for "available" data size. */ static void oss_calcspace() { audio_buf_info ainfo; ! for (int dev=0; dev<linux_noutdevs; dev++) { ! if (ioctl(linux_dacs[dev].fd, SOUND_PCM_GETOSPACE,&ainfo) < 0) fprintf(stderr,"OSS: ioctl on output device %d failed",dev); ! linux_dacs[dev].space = ainfo.bytes; } ! for (int dev=0; dev<linux_nindevs; dev++) { ! if (ioctl(linux_adcs[dev].fd, SOUND_PCM_GETISPACE,&ainfo) < 0) ! fprintf(stderr, "OSS: ioctl on input device %d, fd %d failed", dev, linux_adcs[dev].fd); ! linux_adcs[dev].space = ainfo.bytes; } } *************** *** 405,410 **** if (!oss_blockmode) { oss_calcspace(); ! for (int dev=0; dev < linux_noutdevs; dev++) fprintf(stderr, "dac %d space %d\n", dev, linux_dacs[dev].d_space); ! for (int dev=0; dev < linux_nindevs; dev++) fprintf(stderr, "adc %d space %d\n", dev, linux_adcs[dev].d_space); } } --- 404,409 ---- if (!oss_blockmode) { oss_calcspace(); ! for (int dev=0; dev < linux_noutdevs; dev++) fprintf(stderr, "dac %d space %d\n", dev, linux_dacs[dev].space); ! for (int dev=0; dev < linux_nindevs; dev++) fprintf(stderr, "adc %d space %d\n", dev, linux_adcs[dev].space); } } *************** *** 414,459 ****
static void oss_doresync() { ! int dev, zeroed = 0; char buf[OSS_MAXSAMPLEWIDTH * sys_dacblocksize * OSS_MAXCHPERDEV]; audio_buf_info ainfo;
/* 1. if any input devices are ahead (have more than 1 buffer stored), drop one or more buffers worth */ ! for (dev = 0; dev < linux_nindevs; dev++) { t_oss_dev d = linux_adcs[dev]; ! if (d.d_space == 0) { ! linux_adcs_read(d.d_fd, buf, OSS_XFERSIZE(d.d_nchannels, d.d_bytespersamp)); ! } else while (d.d_space > OSS_XFERSIZE(d.d_nchannels, d.d_bytespersamp)) { ! linux_adcs_read(d.d_fd, buf, OSS_XFERSIZE(d.d_nchannels, d.d_bytespersamp)); ! if (ioctl(d.d_fd, SOUND_PCM_GETISPACE, &ainfo) < 0) { ! fprintf(stderr, "OSS: ioctl on input device %d, fd %d failed", dev, d.d_fd); break; } ! d.d_space = ainfo.bytes; } }
/* 2. if any output devices are behind, feed them zeros to catch them up */ ! for (dev = 0; dev < linux_noutdevs; dev++) { t_oss_dev d = linux_dacs[dev]; ! while (d.d_space > d.d_bufsize - sys_advance_samples*d.d_nchannels*d.d_bytespersamp) { if (!zeroed) { ! for (unsigned int i = 0; i < OSS_XFERSAMPS(d.d_nchannels); i++) buf[i] = 0; zeroed = 1; } ! linux_dacs_write(d.d_fd, buf, OSS_XFERSIZE(d.d_nchannels, d.d_bytespersamp)); ! if (ioctl(d.d_fd, SOUND_PCM_GETOSPACE, &ainfo) < 0) { ! fprintf(stderr, "OSS: ioctl on output device %d, fd %d failed", dev, d.d_fd); break; } ! d.d_space = ainfo.bytes; } } /* 3. if any DAC devices are too far ahead, plan to drop the number of frames which will let the others catch up. */ ! for (dev = 0; dev < linux_noutdevs; dev++) { t_oss_dev d = linux_dacs[dev]; ! if (d.d_space > d.d_bufsize - (sys_advance_samples - 1) * d.d_nchannels * d.d_bytespersamp) { ! d.d_dropcount = sys_advance_samples - 1 - (d.d_space - d.d_bufsize) / (d.d_nchannels * d.d_bytespersamp); ! } else d.d_dropcount = 0; } } --- 413,458 ----
static void oss_doresync() { ! int zeroed = 0; char buf[OSS_MAXSAMPLEWIDTH * sys_dacblocksize * OSS_MAXCHPERDEV]; audio_buf_info ainfo;
/* 1. if any input devices are ahead (have more than 1 buffer stored), drop one or more buffers worth */ ! for (int dev=0; dev<linux_nindevs; dev++) { t_oss_dev d = linux_adcs[dev]; ! if (d.space == 0) { ! linux_adcs_read(d.fd, buf, OSS_XFERSIZE(d.nchannels, d.bytespersamp)); ! } else while (d.space > OSS_XFERSIZE(d.nchannels, d.bytespersamp)) { ! linux_adcs_read(d.fd, buf, OSS_XFERSIZE(d.nchannels, d.bytespersamp)); ! if (ioctl(d.fd, SOUND_PCM_GETISPACE, &ainfo) < 0) { ! fprintf(stderr, "OSS: ioctl on input device %d, fd %d failed", dev, d.fd); break; } ! d.space = ainfo.bytes; } }
/* 2. if any output devices are behind, feed them zeros to catch them up */ ! for (int dev=0; dev<linux_noutdevs; dev++) { t_oss_dev d = linux_dacs[dev]; ! while (d.space > d.bufsize - sys_advance_samples*d.nchannels*d.bytespersamp) { if (!zeroed) { ! for (unsigned int i = 0; i < OSS_XFERSAMPS(d.nchannels); i++) buf[i] = 0; zeroed = 1; } ! linux_dacs_write(d.fd, buf, OSS_XFERSIZE(d.nchannels, d.bytespersamp)); ! if (ioctl(d.fd, SOUND_PCM_GETOSPACE, &ainfo) < 0) { ! fprintf(stderr, "OSS: ioctl on output device %d, fd %d failed", dev, d.fd); break; } ! d.space = ainfo.bytes; } } /* 3. if any DAC devices are too far ahead, plan to drop the number of frames which will let the others catch up. */ ! for (int dev=0; dev<linux_noutdevs; dev++) { t_oss_dev d = linux_dacs[dev]; ! if (d.space > d.bufsize - (sys_advance_samples - 1) * d.nchannels * d.bytespersamp) { ! d.dropcount = sys_advance_samples - 1 - (d.space - d.bufsize) / (d.nchannels * d.bytespersamp); ! } else d.dropcount = 0; } } *************** *** 461,465 **** int oss_send_dacs() { float *fp1, *fp2; ! int i, j, dev, rtnval = SENDDACS_YES; char buf[OSS_MAXSAMPLEWIDTH * sys_dacblocksize * OSS_MAXCHPERDEV]; t_oss_int16 *sp; --- 460,464 ---- int oss_send_dacs() { float *fp1, *fp2; ! int i, j, rtnval = SENDDACS_YES; char buf[OSS_MAXSAMPLEWIDTH * sys_dacblocksize * OSS_MAXCHPERDEV]; t_oss_int16 *sp; *************** *** 467,471 **** /* the maximum number of samples we should have in the ADC buffer */ int idle = 0; - int thischan; double timeref, timenow;
--- 466,469 ---- *************** *** 476,486 **** output device has fewer than (sys_advance_samples) blocks buffered already. */ oss_calcspace(); ! for (dev=0; dev < linux_noutdevs; dev++) { t_oss_dev d = linux_dacs[dev]; ! if (d.d_dropcount || (d.d_bufsize - d.d_space > sys_advance_samples * d.d_bytespersamp * d.d_nchannels)) idle = 1; } ! for (dev=0; dev < linux_nindevs; dev++) { t_oss_dev d = linux_adcs[dev]; ! if (d.d_space < OSS_XFERSIZE(d.d_nchannels, d.d_bytespersamp)) idle = 1; } } --- 474,484 ---- output device has fewer than (sys_advance_samples) blocks buffered already. */ oss_calcspace(); ! for (int dev=0; dev<linux_noutdevs; dev++) { t_oss_dev d = linux_dacs[dev]; ! if (d.dropcount || (d.bufsize - d.space > sys_advance_samples * d.bytespersamp * d.nchannels)) idle = 1; } ! for (int dev=0; dev<linux_nindevs; dev++) { t_oss_dev d = linux_adcs[dev]; ! if (d.space < OSS_XFERSIZE(d.nchannels, d.bytespersamp)) idle = 1; } } *************** *** 491,498 **** distinguish between the two by waiting 2 msec and asking again. There should be an error flag we could check instead; look for this someday... */ ! for (dev = 0;dev < linux_nindevs; dev++) if (linux_adcs[dev].d_space == 0) { sys_microsleep(sys_sleepgrain); /* tb: changed to sys_sleepgrain */ oss_calcspace(); ! if (linux_adcs[dev].d_space != 0) continue; /* here's the bad case. Give up and resync. */ sys_log_error(ERR_DATALATE); --- 489,496 ---- distinguish between the two by waiting 2 msec and asking again. There should be an error flag we could check instead; look for this someday... */ ! for (int dev=0; dev<linux_nindevs; dev++) if (linux_adcs[dev].space == 0) { sys_microsleep(sys_sleepgrain); /* tb: changed to sys_sleepgrain */ oss_calcspace(); ! if (linux_adcs[dev].space != 0) continue; /* here's the bad case. Give up and resync. */ sys_log_error(ERR_DATALATE); *************** *** 505,515 **** input device should have more than one buffer readable and no output device should have less than sys_advance_samples-1 */ ! for (dev=0; dev < linux_noutdevs; dev++) { t_oss_dev d = linux_dacs[dev]; ! if (!d.d_dropcount && (d.d_bufsize - d.d_space < (sys_advance_samples - 2)*d.d_bytespersamp*d.d_nchannels)) goto badsync; } ! for (dev=0; dev < linux_nindevs; dev++) ! if (linux_adcs[dev].d_space > 3 * OSS_XFERSIZE(linux_adcs[dev].d_nchannels, linux_adcs[dev].d_bytespersamp)) goto badsync;
/* return zero to tell the scheduler we're idle. */ --- 503,513 ---- input device should have more than one buffer readable and no output device should have less than sys_advance_samples-1 */ ! for (int dev=0; dev<linux_noutdevs; dev++) { t_oss_dev d = linux_dacs[dev]; ! if (!d.dropcount && (d.bufsize - d.space < (sys_advance_samples - 2)*d.bytespersamp*d.nchannels)) goto badsync; } ! for (int dev=0; dev<linux_nindevs; dev++) ! if (linux_adcs[dev].space > 3 * OSS_XFERSIZE(linux_adcs[dev].nchannels, linux_adcs[dev].bytespersamp)) goto badsync;
/* return zero to tell the scheduler we're idle. */ *************** *** 523,533 **** /* do output */ timeref = sys_getrealtime(); ! for (dev=0, thischan = 0; dev < linux_noutdevs; dev++) { t_oss_dev d = linux_dacs[dev]; ! int nchannels = d.d_nchannels; ! if (d.d_dropcount) d.d_dropcount--; else { ! if (d.d_bytespersamp == 4) { ! fp1 = sys_soundout + sys_dacblocksize*thischan; for (i = sys_dacblocksize * nchannels, lp = (t_oss_int32 *)buf; i--; fp1++, lp++) { float f = *fp1 * 2147483648.; --- 521,531 ---- /* do output */ timeref = sys_getrealtime(); ! for (int dev=0, thischan = 0; dev < linux_noutdevs; dev++) { t_oss_dev d = linux_dacs[dev]; ! int nchannels = d.nchannels; ! if (d.dropcount) d.dropcount--; else { ! fp1 = sys_soundout + sys_dacblocksize*thischan; ! if (d.bytespersamp == 4) { for (i = sys_dacblocksize * nchannels, lp = (t_oss_int32 *)buf; i--; fp1++, lp++) { float f = *fp1 * 2147483648.; *************** *** 535,539 **** } } else { - fp1 = sys_soundout + sys_dacblocksize*thischan; for (i = sys_dacblocksize, sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels) { for (j=0, fp2 = fp1; j<nchannels; j++, fp2 += sys_dacblocksize) { --- 533,536 ---- *************** *** 545,549 **** } } ! linux_dacs_write(d.d_fd, buf, OSS_XFERSIZE(nchannels, d.d_bytespersamp)); if ((timenow = sys_getrealtime()) - timeref > 0.002) { if (!oss_blockmode) sys_log_error(ERR_DACSLEPT); else rtnval = SENDDACS_SLEPT; --- 542,546 ---- } } ! linux_dacs_write(d.fd, buf, OSS_XFERSIZE(nchannels, d.bytespersamp)); if ((timenow = sys_getrealtime()) - timeref > 0.002) { if (!oss_blockmode) sys_log_error(ERR_DACSLEPT); else rtnval = SENDDACS_SLEPT; *************** *** 555,561 **** memset(sys_soundout, 0, sys_outchannels * (sizeof(float) * sys_dacblocksize));
! for (dev = 0, thischan = 0; dev < linux_nindevs; dev++) { ! int nchannels = linux_adcs[dev].d_nchannels; ! linux_adcs_read(linux_adcs[dev].d_fd, buf, OSS_XFERSIZE(nchannels, linux_adcs[dev].d_bytespersamp)); if ((timenow = sys_getrealtime()) - timeref > 0.002) { if (!oss_blockmode) sys_log_error(ERR_ADCSLEPT); else rtnval = SENDDACS_SLEPT; --- 552,558 ---- memset(sys_soundout, 0, sys_outchannels * (sizeof(float) * sys_dacblocksize));
! for (int dev=0, thischan = 0; dev < linux_nindevs; dev++) { ! int nchannels = linux_adcs[dev].nchannels; ! linux_adcs_read(linux_adcs[dev].fd, buf, OSS_XFERSIZE(nchannels, linux_adcs[dev].bytespersamp)); if ((timenow = sys_getrealtime()) - timeref > 0.002) { if (!oss_blockmode) sys_log_error(ERR_ADCSLEPT); else rtnval = SENDDACS_SLEPT; *************** *** 563,567 **** timeref = timenow; fp1 = sys_soundin + thischan*sys_dacblocksize; ! if (linux_adcs[dev].d_bytespersamp == 4) { for (i = sys_dacblocksize*nchannels, lp = (t_oss_int32 *)buf; i--; fp1++, lp++) *fp1 = float(*lp)*float(1./2147483648.); --- 560,564 ---- timeref = timenow; fp1 = sys_soundin + thischan*sys_dacblocksize; ! if (linux_adcs[dev].bytespersamp == 4) { for (i = sys_dacblocksize*nchannels, lp = (t_oss_int32 *)buf; i--; fp1++, lp++) *fp1 = float(*lp)*float(1./2147483648.);