Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31666/src
Modified Files: Tag: devel_0_38 s_audio_asio.cpp Log Message: - adapted for new sys_dacblksize variable - better use more conservative ringbuffer input code
Index: s_audio_asio.cpp =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/s_audio_asio.cpp,v retrieving revision 1.1.4.12 retrieving revision 1.1.4.13 diff -C2 -d -r1.1.4.12 -r1.1.4.13 *** s_audio_asio.cpp 18 Nov 2004 09:19:48 -0000 1.1.4.12 --- s_audio_asio.cpp 18 Nov 2004 22:27:08 -0000 1.1.4.13 *************** *** 516,535 **** }
! /* for clipping: */ ! extern "C" t_int *clip_perform(t_int *w);
! #if SIMD_CHKCNT(sys_dacblocksize) ! inline void copyblock(t_sample *dst,t_sample *src) { copyvec_simd(dst,src,sys_dacblocksize); } ! inline void zeroblock(t_sample *dst) { zerovec_simd(dst,sys_dacblocksize); } ! inline void clipblock(t_int *w) { clip_perf_simd(w); } ! #else ! inline void copyblock(t_sample *dst,t_sample *src) { memcpy(dst,src,sys_dacblocksize*sizeof(t_sample)); } ! inline void zeroblock(t_sample *dst) { memset(dst,0,sys_dacblocksize*sizeof(t_sample)); } ! inline void clipblock(t_int *w) { clip_perform(w); } ! #endif
/* called on every dac~ send */ int asio_send_dacs(void) { t_sample * sp; /* sample pointer */ int i, j; --- 516,555 ---- }
! /**************************************************************************/ ! /* some function pointers for eventual fast copying when SIMD is possible */
! static void copyvec_nrm(t_sample *dst,t_sample *src,int n) { memcpy(dst,src,n*sizeof(t_sample)); } ! static void zerovec_nrm(t_sample *dst,int n) { memset(dst,0,n*sizeof(t_sample)); } ! ! static void (*_copyvec)(t_sample *dst,t_sample *src,int n) = ©vec_nrm; ! static void (*_zerovec)(t_sample *dst,int n) = &zerovec_nrm; ! static t_int *(*_clipperf)(t_int *w) = &clip_perform; ! ! inline void copyblock(t_sample *dst,t_sample *src) { _copyvec(dst,src,sys_dacblocksize); } ! inline void zeroblock(t_sample *dst) { _zerovec(dst,sys_dacblocksize); } ! inline void clipblock(t_int *w) { _clipperf(w); } ! ! static void setblockops() ! { ! if(SIMD_CHKCNT(sys_dacblocksize)) { ! // urgh... ugly cast ! _copyvec = (void (*)(t_sample *,t_sample *,int))©vec_simd; ! _zerovec = &zerovec_simd; ! _clipperf = &clip_perf_simd; ! } ! else { ! _copyvec = ©vec_nrm; ! _zerovec = &zerovec_nrm; ! _clipperf = &clip_perform; ! } ! } ! ! /*************************************************************************/
/* called on every dac~ send */ int asio_send_dacs(void) { + setblockops(); + t_sample * sp; /* sample pointer */ int i, j; *************** *** 551,554 **** --- 571,575 ---- { /* clipping here, we are sure, we can use simd instructions */ + /* TG: are we? can sys_dacblocksize be < 16, with onset and size then not SIMD-able? */ t_float lo = -1.f; t_float hi = 1.f; *************** *** 558,562 **** clipargs[3] = (t_int)&lo; clipargs[4] = (t_int)&hi; ! clipargs[5] = (t_int)DEFDACBLKSIZE; clipblock(clipargs); --- 579,583 ---- clipargs[3] = (t_int)&lo; clipargs[4] = (t_int)&hi; ! clipargs[5] = (t_int)sys_dacblocksize; clipblock(clipargs); *************** *** 570,578 **** for (j = 0; j < sys_inchannels; j++) { /* we should be able to read from the ringbuffer on a different position * to reduce latency for asio buffer sizes that aren't multiples of 64... */ ! #if 1 ! int offset = asio_bufsize + DEFDACBLKSIZE; ! offset += DEFDACBLKSIZE - offset % DEFDACBLKSIZE;
if (asio_ringbuffer_inoffset < offset) --- 591,599 ---- for (j = 0; j < sys_inchannels; j++) { + #if 0 /* we should be able to read from the ringbuffer on a different position * to reduce latency for asio buffer sizes that aren't multiples of 64... */ ! int offset = asio_bufsize + sys_dacblocksize; ! offset += sys_dacblocksize - offset % sys_dacblocksize;
if (asio_ringbuffer_inoffset < offset) *************** *** 583,587 **** else memcpy(sp, asio_ringbuffer[i+j] + asio_ringbuffer_inoffset - offset, 64*sizeof(t_sample)); ! #else /* working but higher latency */ copyblock(sp, asio_ringbuffer[i+j] + asio_ringbuffer_inoffset); #endif --- 604,609 ---- else memcpy(sp, asio_ringbuffer[i+j] + asio_ringbuffer_inoffset - offset, 64*sizeof(t_sample)); ! #else ! /* working but higher latency */ copyblock(sp, asio_ringbuffer[i+j] + asio_ringbuffer_inoffset); #endif *************** *** 1164,1165 **** --- 1186,1188 ----
#endif /* USEAPI_ASIO */ +