Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3884
Modified Files: Tag: devel_0_39 SConscript m_atomic.h m_binbuf.c m_sched.c m_simd.c m_simd_sse_gcc.c m_simd_sse_vc.c m_simd_ve_gcc.c s_audio.c s_audio_portaudio.c s_entry.c s_inter.c s_midi_pm.c s_print.c s_stuff.h t_tkcmd.c x_connective.c Log Message: partly recoded SIMD stuff using compiler intrinsics fixes for portaudio interface improved idle processing (esp. timing) experimental code for patcher loading to idle time (#define PD_IDLE_LOADING) postponed audio driver related messages to be serviced in the scheduler loop (not in the audio callback!) various other small fixes
Index: m_binbuf.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_binbuf.c,v retrieving revision 1.4.4.1.2.9 retrieving revision 1.4.4.1.2.10 diff -C2 -d -r1.4.4.1.2.9 -r1.4.4.1.2.10 *** m_binbuf.c 30 Nov 2006 01:43:23 -0000 1.4.4.1.2.9 --- m_binbuf.c 17 Aug 2007 13:56:41 -0000 1.4.4.1.2.10 *************** *** 1303,1307 **** }
! void glob_evalfile(t_pd *ignore, t_symbol *name, t_symbol *dir) { t_pd *x = 0; --- 1303,1307 ---- }
! static t_int _glob_evalfile(t_int *args) { t_pd *x = 0; *************** *** 1312,1315 **** --- 1312,1319 ----
int dspstate = canvas_suspend_dsp(); + + t_symbol *name = (t_symbol *)args[0]; + t_symbol *dir = (t_symbol *)args[1]; + binbuf_evalfile(name, dir); while ((x != s__X.s_thing) && (x = s__X.s_thing)) *************** *** 1317,1319 **** --- 1321,1337 ---- pd_doloadbang(); canvas_resume_dsp(dspstate); + + return 0; + } + + void glob_evalfile(t_pd *ignore, t_symbol *name, t_symbol *dir) + { + t_int args[2]; + args[0] = (t_int)name; + args[1] = (t_int)dir; + #ifdef PD_IDLE_LOADING + sys_callback(_glob_evalfile,args,2); + #else + _glob_evalfile(args); + #endif }
Index: t_tkcmd.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/t_tkcmd.c,v retrieving revision 1.2.4.1.2.10 retrieving revision 1.2.4.1.2.11 diff -C2 -d -r1.2.4.1.2.10 -r1.2.4.1.2.11 *** t_tkcmd.c 14 Jun 2006 01:03:02 -0000 1.2.4.1.2.10 --- t_tkcmd.c 17 Aug 2007 13:56:42 -0000 1.2.4.1.2.11 *************** *** 622,626 **** 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. */ ! #if defined(MSW) || defined(__APPLE__) if (argv && (portno = atoi(argv)) > 1) #else --- 622,626 ---- 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. */ ! #if defined(MSW) if (argv && (portno = atoi(argv)) > 1) #else
Index: m_sched.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_sched.c,v retrieving revision 1.5.4.35.2.21 retrieving revision 1.5.4.35.2.22 diff -C2 -d -r1.5.4.35.2.21 -r1.5.4.35.2.22 *** m_sched.c 23 Nov 2006 05:59:42 -0000 1.5.4.35.2.21 --- m_sched.c 17 Aug 2007 13:56:41 -0000 1.5.4.35.2.22 *************** *** 22,25 **** --- 22,27 ----
#include "assert.h" + #include <stdio.h> + #include <string.h> /* for memcpy */
/* LATER consider making this variable. It's now the LCM of all sample *************** *** 398,405 **** dsp_tick();
! /* rethink: should we really do all this midi messaging in the realtime thread ? */ sys_pollmidiqueue(); sys_setmiditimediff(0, 1e-6 * sys_schedadvance); }
--- 400,409 ---- dsp_tick();
! #if 0 /* rethink: should we really do all this midi messaging in the realtime thread ? */ + /* grrrr: although i like midi to be real-time, it's also done below, in the m_scheduler loops */ sys_pollmidiqueue(); sys_setmiditimediff(0, 1e-6 * sys_schedadvance); + #endif }
*************** *** 419,422 **** --- 423,429 ---- void sys_initmidiqueue( void);
+ void run_all_idle_callbacks(void); + int run_timed_idle_callbacks(int microsecs); + int m_scheduler(void) { *************** *** 433,437 **** sys_update_sleepgrain();
! sched_set_using_dacs(0); /* tb: dsp is switched off */
sys_initmidiqueue(); --- 440,444 ---- sys_update_sleepgrain();
! sched_set_using_dacs(sched_usedacs); /* tb: dsp is switched off */
sys_initmidiqueue(); *************** *** 497,501 **** if (!didsomething) { - sched_pollformeters();
--- 504,507 ---- *************** *** 510,513 **** --- 516,522 ---- while(sys_keepsched) { + double time,rtime; + time = sys_getrealtime(); + /* tb: allow the audio callback to run */ sys_unlock(); *************** *** 518,527 **** sys_setmiditimediff(0, 1e-6 * sys_schedadvance);
if (sys_pollgui()) continue;
! /* do graphics updates and run idle callbacks */ sched_pollformeters(); - } sys_keepsched = 1; --- 527,543 ---- sys_setmiditimediff(0, 1e-6 * sys_schedadvance);
+ rtime = (sys_getrealtime()-time)*1e6; + if(rtime >= 0) /* < 0 can happen when changing drivers etc. */ + { + time = sys_schedadvance/4-rtime; + /* run once at least: use time = 0 if time < 0.... */ + rtime = run_timed_idle_callbacks(time < 0?0:time); + } + if (sys_pollgui()) continue;
! /* do graphics updates */ sched_pollformeters(); } sys_keepsched = 1; *************** *** 573,609 **** #endif
! ! #if 0 ! /* osx doesn't define a pthread_mutex_timedlock ... maybe someday ! it will ... */ ! int sys_timedlock(int microsec) { ! struct timespec timeout; ! int ret; ! struct timeval now; ! ! /* timedlock seems to have a resolution of 1ms */ ! if (microsec < 1e3) ! microsec = 1e3; ! ! gettimeofday(&now,0);
! timeout.tv_sec = now.tv_sec; ! timeout.tv_nsec = (now.tv_usec + microsec) * 1000; ! ! while (timeout.tv_nsec > 1e9) ! { ! timeout.tv_sec += 1; ! timeout.tv_nsec -= 1e9; ! } ! ! ret = pthread_mutex_timedlock(&sys_mutex, &timeout);
! if (ret) ! post("timeout, %d", ret); ! ! return ret; } ! #else
int sys_timedlock(int microsec) --- 589,621 ---- #endif
! /* grrrr.org { */ ! #ifdef __APPLE__ ! /* osx doesn't define a pthread_mutex_timedlock ... */ ! static int pthread_mutex_timedlock(pthread_mutex_t *__restrict mutex, const struct timespec *__restrict abs_timeout) { ! int result; ! struct timeval tv; ! long long remain;
! for(;;) ! { ! result = pthread_mutex_trylock(mutex); ! if(result != EBUSY) return 0;
! gettimeofday(&tv,0); ! remain = (abs_timeout->tv_sec-tv.tv_sec)*10000000000LL+(abs_timeout->tv_nsec-tv.tv_usec*1000LL); ! if(remain <= 0) return ETIMEDOUT; ! ! /* Sleep for 1,000,000 nanoseconds before trying again. */ ! struct timespec ts; ! ts.tv_sec = 0; ! ts.tv_nsec = remain < 1000000?remain:1000000; ! ! int status; ! do { status = nanosleep(&ts, &ts); } while (status == -1); ! } } ! #endif ! /* } grrrr.org */
int sys_timedlock(int microsec) *************** *** 613,619 **** struct timeval now;
! if (sys_trylock() == 0) ! return 0; ! if (microsec < 1e3) microsec = 1e3; --- 625,629 ---- struct timeval now;
! /* timedlock seems to have a resolution of 1ms */ if (microsec < 1e3) microsec = 1e3; *************** *** 630,644 **** }
! ! /* in case the lock has been released during the system call, try ! again before waiting for the signal */ ! if (sys_trylock() == 0) ! return 0; ! ! ret = pthread_cond_timedwait(&sys_cond, &sys_mutex, &timeout); ! ! return ret; } ! #endif /* tb } */
--- 640,646 ---- }
! return pthread_mutex_timedlock(&sys_mutex, &timeout); } ! /* tb } */
*************** *** 675,680 **** struct _sched_callback* next; /* next callback in ringbuffer / in fifo */ t_int (*function) (t_int* argv); - t_int* argv; t_int argc; } t_sched_callback;
--- 677,682 ---- struct _sched_callback* next; /* next callback in ringbuffer / in fifo */ t_int (*function) (t_int* argv); t_int argc; + t_int argv[0]; } t_sched_callback;
*************** *** 683,699 **** { t_sched_callback* noo = (t_sched_callback*) getbytes ! (sizeof(t_sched_callback));
noo->function = callback; if (argv && argc) { - noo->argv = (t_int*) copybytes (argv, argc * sizeof (t_int)); noo->argc = argc; } else - { noo->argc = 0; ! noo->argv = NULL; ! } noo->next = NULL;
--- 685,699 ---- { t_sched_callback* noo = (t_sched_callback*) getbytes ! (sizeof(t_sched_callback)+argc*sizeof(*argv));
noo->function = callback; if (argv && argc) { noo->argc = argc; + memcpy(noo->argv,argv,argc * sizeof(*argv)); } else noo->argc = 0; ! noo->next = NULL;
*************** *** 712,718 **** static t_sched_callback *ringbuffer_head = NULL;
! void run_all_idle_callbacks(void) { t_sched_callback * new_callback; /* append idle callback to ringbuffer */ while (new_callback = (t_sched_callback*) fifo_get(callback_fifo)) --- 712,727 ---- static t_sched_callback *ringbuffer_head = NULL;
! /* ! \param microsec maximum time to take for idle processing (0 means, run all callbacks at least once) ! \return remaining time in usecs ! \note no sys_lock management here ! */ ! int run_timed_idle_callbacks(int microsec) { t_sched_callback * new_callback; + double stop; + + stop = sys_getrealtime()*1.e6 + (double)microsec; + /* append idle callback to ringbuffer */ while (new_callback = (t_sched_callback*) fifo_get(callback_fifo)) *************** *** 737,748 **** if (ringbuffer_head != NULL) { t_sched_callback * idle_callback = ringbuffer_head; t_sched_callback * last = NULL; t_sched_callback * next;
! do { ! int status; ! status = (idle_callback->function)(idle_callback->argv);
switch (status) --- 746,757 ---- if (ringbuffer_head != NULL) { + double remain = stop - sys_getrealtime() * 1.e6; t_sched_callback * idle_callback = ringbuffer_head; t_sched_callback * last = NULL; t_sched_callback * next;
! for(;;) { ! int status = (idle_callback->function)(idle_callback->argc?idle_callback->argv:NULL);
switch (status) *************** *** 751,757 **** case 0: next = idle_callback->next; ! if (idle_callback->argv) ! freebytes (idle_callback->argv, idle_callback->argc*sizeof (t_int)); ! freebytes ((void*)idle_callback, sizeof(t_sched_callback));
if (last == NULL) --- 760,764 ---- case 0: next = idle_callback->next; ! freebytes (idle_callback, sizeof(t_sched_callback)+idle_callback->argc*sizeof(*idle_callback->argv));
if (last == NULL) *************** *** 761,839 ****
idle_callback = next; - - /* callbacks returning 1 will be run again */ - case 1: break;
! /* callbacks returning 2 will be run during the next idle callback */ ! case 2: ! last = idle_callback; ! idle_callback = idle_callback->next; ! } ! ! } ! while ((idle_callback != NULL)); ! } ! } ! ! static void run_idle_callbacks(int microsec) ! { ! t_sched_callback * new_callback; ! double stop; ! ! stop = sys_getrealtime()*1.e6 + (double)microsec; ! ! /* append idle callback to ringbuffer */ ! while (new_callback = (t_sched_callback*) fifo_get(callback_fifo)) ! { ! t_sched_callback * next;
! /* set the next field to NULL ... it might be set in the fifo */ ! new_callback->next = NULL; ! if (ringbuffer_head == NULL) ! { ! ringbuffer_head = new_callback; ! } ! else { ! next = ringbuffer_head; ! while (next->next != 0) ! next = next->next; ! next->next = new_callback; ! } }
! if (ringbuffer_head != NULL) ! { ! double remain = stop - sys_getrealtime() * 1.e6; ! t_sched_callback * idle_callback = ringbuffer_head; ! t_sched_callback * last = NULL; ! t_sched_callback * next; ! ! do { ! int status; ! // sys_lock(); ! status = (idle_callback->function)(idle_callback->argv); ! // sys_unlock(); ! ! switch (status) ! { ! /* callbacks returning 0 will be deleted */ ! case 0: ! next = idle_callback->next; ! if (idle_callback->argc) ! freebytes (idle_callback->argv, idle_callback->argc*sizeof (t_int)); ! freebytes ((void*)idle_callback, sizeof(t_sched_callback));
if (last == NULL) ringbuffer_head = next; else last->next = next;
! idle_callback = next;
! /* callbacks returning 1 will be run again */ ! case 1: break;
--- 768,803 ----
idle_callback = next; break;
! /* callbacks returning 1 will be run again - enqueue at the tail ! , so that it is behind "last" in any case ! */ ! case 1: ! next = idle_callback->next;
! if(!microsec) { ! /* don't repeat */ ! idle_callback = next; ! break; }
! if(next) { ! t_sched_callback *n;
+ /* remove the event from the list */ if (last == NULL) ringbuffer_head = next; else last->next = next; + idle_callback->next = NULL;
! /* reinsert it at the end */ ! for(n = next; n->next; n = n->next) {} ! n->next = idle_callback;
! idle_callback = next; ! } break;
*************** *** 842,859 **** last = idle_callback; idle_callback = idle_callback->next; }
remain = stop-sys_getrealtime()*1.e6; } - while ((idle_callback != NULL) && (remain > 0));
! /* sleep for the rest of the time */ ! if(remain > 0) { ! sys_unlock(); ! sys_microsleep(remain); ! sys_lock(); } } ! else { sys_unlock(); sys_microsleep(microsec); --- 806,849 ---- last = idle_callback; idle_callback = idle_callback->next; + break; }
remain = stop-sys_getrealtime()*1.e6; + if(remain <= 0) break; /* time elapsed */ + + if(!idle_callback) + { + /* we arrived at the end of the list */ + + if(microsec) + { + /* restart */ + idle_callback = last?last->next:ringbuffer_head; + if(!idle_callback) break; + } + else + /* don't traverse list once more */ + break; + } }
! return remain > 0?remain:0; } + else + return microsec; } ! ! /* process idle callbacks at most once ! */ ! void run_all_idle_callbacks(void) ! { ! run_timed_idle_callbacks(0); ! } ! ! static void run_idle_callbacks(int microsec) ! { ! double remain = run_timed_idle_callbacks(microsec); ! if(remain > 0) ! { sys_unlock(); sys_microsleep(microsec);
Index: m_simd.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd.c,v retrieving revision 1.1.4.7 retrieving revision 1.1.4.7.2.1 diff -C2 -d -r1.1.4.7 -r1.1.4.7.2.1 *** m_simd.c 8 Apr 2005 12:39:33 -0000 1.1.4.7 --- m_simd.c 17 Aug 2007 13:56:41 -0000 1.1.4.7.2.1 *************** *** 6,15 **** --- 6,19 ---- #include "m_pd.h" #include "m_simd.h" + #include <string.h> /* for memcpy, memset */
void zerovec_8(t_float *dst,int n) { + memset(dst,0,n*sizeof(t_float)); + /* for(n >>= 3; n--; dst += 8) { dst[0] = dst[1] = dst[2] = dst[3] = dst[4] = dst[5] = dst[6] = dst[7] = 0; } + */ }
*************** *** 23,30 **** --- 27,37 ---- void copyvec_8(t_float *dst,const t_float *src,int n) { + memcpy(dst,src,n*sizeof(t_float)); + /* for(n >>= 3; n--; src += 8,dst += 8) { dst[0] = src[0],dst[1] = src[1],dst[2] = src[2],dst[3] = src[3]; dst[4] = src[4],dst[5] = src[5],dst[6] = src[6],dst[7] = src[7]; } + */ }
*************** *** 39,50 **** void copyvec(t_float *dst,const t_float *src,int n) { ! while(n--) ! *dst++ = *src++; }
void zerovec(t_float *dst, int n) { ! while(n--) ! *dst++ = 0; }
--- 46,55 ---- void copyvec(t_float *dst,const t_float *src,int n) { ! memcpy(dst,src,n*sizeof(t_float)); }
void zerovec(t_float *dst, int n) { ! memset(dst,0,n*sizeof(t_float)); }
Index: s_stuff.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_stuff.h,v retrieving revision 1.5.4.10.2.9 retrieving revision 1.5.4.10.2.10 diff -C2 -d -r1.5.4.10.2.9 -r1.5.4.10.2.10 *** s_stuff.h 30 Nov 2006 01:30:03 -0000 1.5.4.10.2.9 --- s_stuff.h 17 Aug 2007 13:56:42 -0000 1.5.4.10.2.10 *************** *** 19,31 **** } t_namelist;
! t_namelist *namelist_append(t_namelist *listwas, const char *s, int allowdup); ! t_namelist *namelist_append_files(t_namelist *listwas, const char *s); void namelist_free(t_namelist *listwas); ! char *namelist_get(t_namelist *namelist, int n); void sys_setextrapath(const char *p); extern int sys_usestdpath; extern t_namelist *sys_externlist; ! extern t_namelist *sys_searchpath; ! extern t_namelist *sys_helppath;
--- 19,31 ---- } t_namelist;
! EXTERN t_namelist *namelist_append(t_namelist *listwas, const char *s, int allowdup); ! EXTERN t_namelist *namelist_append_files(t_namelist *listwas, const char *s); void namelist_free(t_namelist *listwas); ! EXTERN char *namelist_get(t_namelist *namelist, int n); void sys_setextrapath(const char *p); extern int sys_usestdpath; extern t_namelist *sys_externlist; ! EXTERN t_namelist *sys_searchpath; ! EXTERN t_namelist *sys_helppath;
*************** *** 191,194 **** --- 191,195 ---- #endif
+ #ifdef PD_INTERNAL #define API_ALSA 1 #define API_OSS 2 *************** *** 256,259 **** --- 257,262 ---- #endif
+ #endif // PD_INTERNAL + int pa_open_audio(int inchans, int outchans, int rate, int advance, int indeviceno, int outdeviceno, int schedmode); *************** *** 348,353 ****
typedef void (*t_printhook)(const char *s); ! extern t_printhook sys_printhook; /* set this to override printing */ ! extern int sys_printtostderr; #ifdef MSW #define vsnprintf _vsnprintf /* jsarlo -- alias this name for msw */ --- 351,356 ----
typedef void (*t_printhook)(const char *s); ! EXTERN t_printhook sys_printhook; /* set this to override printing */ ! EXTERN int sys_printtostderr; #ifdef MSW #define vsnprintf _vsnprintf /* jsarlo -- alias this name for msw */
Index: s_inter.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_inter.c,v retrieving revision 1.5.4.10.2.26 retrieving revision 1.5.4.10.2.27 diff -C2 -d -r1.5.4.10.2.26 -r1.5.4.10.2.27 *** s_inter.c 30 Nov 2006 01:43:23 -0000 1.5.4.10.2.26 --- s_inter.c 17 Aug 2007 13:56:42 -0000 1.5.4.10.2.27 *************** *** 176,184 **** FD_ZERO(&readset); FD_ZERO(&exceptset); for (fp = sys_fdpoll, i = sys_nfdpoll; i--; fp++) FD_SET(fp->fdp_fd, &readset); select(sys_maxfd+1, &readset, &writeset, &exceptset, &timout); for (i = 0; i < sys_nfdpoll; i++) ! if (FD_ISSET(sys_fdpoll[i].fdp_fd, &readset)) { (*sys_fdpoll[i].fdp_fn)(sys_fdpoll[i].fdp_ptr, sys_fdpoll[i].fdp_fd); --- 176,186 ---- FD_ZERO(&readset); FD_ZERO(&exceptset); + for (fp = sys_fdpoll, i = sys_nfdpoll; i--; fp++) + if(fp->fdp_fd >= 0) /* in some situations (race conditions at startup?) file descriptors are -1 */ FD_SET(fp->fdp_fd, &readset); select(sys_maxfd+1, &readset, &writeset, &exceptset, &timout); for (i = 0; i < sys_nfdpoll; i++) ! if (sys_fdpoll[i].fdp_fd >= 0 && FD_ISSET(sys_fdpoll[i].fdp_fd, &readset)) { (*sys_fdpoll[i].fdp_fn)(sys_fdpoll[i].fdp_ptr, sys_fdpoll[i].fdp_fd);
Index: s_audio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v retrieving revision 1.5.4.16.2.20 retrieving revision 1.5.4.16.2.21 diff -C2 -d -r1.5.4.16.2.20 -r1.5.4.16.2.21 *** s_audio.c 23 Nov 2006 06:08:39 -0000 1.5.4.16.2.20 --- s_audio.c 17 Aug 2007 13:56:41 -0000 1.5.4.16.2.21 *************** *** 715,721 **** }
/* start an audio settings dialog window */ ! void glob_audio_properties(t_pd *dummy, t_floatarg flongform) { char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; --- 715,734 ---- }
+ static int sys_inaudiothread(void); + + /* vibrez.net - if we are within the audio thread, schedule function fun at idle time */ + static void _callfunction(t_int (*fun)(t_int *),t_int *argv,t_int argc) + { + /* if we are in audio thread, do the requested function at idle time */ + if(sys_inaudiothread()) + sys_callback(fun,argv,argc); + else + fun(argv); + } + + void glob_audio_properties(t_pd *dummy, t_floatarg f);
/* start an audio settings dialog window */ ! static t_int _glob_audio_properties(t_int *args) { char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; *************** *** 731,738 **** --- 744,754 ---- char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; int nindevs = 0, noutdevs = 0, canmulti = 0, i; + int longform = *args;
char indevliststring[MAXNDEV*(DEVDESCSIZE+4)+80], outdevliststring[MAXNDEV*(DEVDESCSIZE+4)+80];
+ if(sys_inaudiothread()) return 2; + audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); *************** *** 762,766 **** naudioindev, naudiooutdev, flongform); */ if (naudioindev > 1 || naudiooutdev > 1) ! flongform = 1;
--- 778,782 ---- naudioindev, naudiooutdev, flongform); */ if (naudioindev > 1 || naudiooutdev > 1) ! longform = 1;
*************** *** 792,802 **** audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4, audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4, ! rate, dacblocksize, advance, canmulti, (flongform != 0)); gfxstub_deleteforkey(0); gfxstub_new(&glob_pdobject, (void *)glob_audio_properties, buf); }
/* new values from dialog window */ ! void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) { int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; --- 808,826 ---- audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4, audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4, ! rate, dacblocksize, advance, canmulti, (longform != 0)); gfxstub_deleteforkey(0); gfxstub_new(&glob_pdobject, (void *)glob_audio_properties, buf); + return 0; + } + + void glob_audio_properties(t_pd *dummy, t_floatarg f) + { + t_int args = (t_int)f; + _callfunction(_glob_audio_properties,&args,1); }
+ /* new values from dialog window */ ! static t_int _glob_audio_dialog(t_int *args) { int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; *************** *** 807,822 **** newaudiooutdev[4], newaudiooutchan[4]; /* 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 newschedmode = atom_getintarg(19, argc, argv); int statewas;
for (i = 0; i < 4; i++) { ! newaudioindev[i] = atom_getintarg(i, argc, argv); ! newaudioinchan[i] = atom_getintarg(i+4, argc, argv); ! newaudiooutdev[i] = atom_getintarg(i+8, argc, argv); ! newaudiooutchan[i] = atom_getintarg(i+12, argc, argv); }
--- 831,848 ---- newaudiooutdev[4], newaudiooutchan[4]; /* the new values the dialog came back with: */ ! int newrate = args[16]; ! int newdacblocksize = args[17]; ! int newadvance = args[18]; ! int newschedmode = args[19]; int statewas;
+ if(sys_inaudiothread()) return 2; + for (i = 0; i < 4; i++) { ! newaudioindev[i] = args[i]; ! newaudioinchan[i] = args[i+4]; ! newaudiooutdev[i] = args[i+8]; ! newaudiooutchan[i] = args[i+12]; }
*************** *** 848,853 **** --- 874,890 ---- noutdev, newaudiooutdev, noutdev, newaudiooutchan, newrate, newdacblocksize, newadvance, newschedmode, 1); + return 0; }
+ void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) + { + t_int args[20]; + int i; + for (i = 0; i < 20; i++) + args[i] = atom_getintarg(i, argc, argv); + _callfunction(_glob_audio_dialog,args,20); + } + + void sys_listdevs(void ) { *************** *** 905,911 **** }
! void glob_audio_setapi(void *dummy, t_floatarg f) { ! int newapi = f; if (newapi != sys_audioapi) { --- 942,951 ---- }
! static t_int _glob_audio_setapi(t_int *args) { ! int newapi = *args; ! ! if(sys_inaudiothread()) return 2; ! if (newapi != sys_audioapi) { *************** *** 922,925 **** --- 962,972 ---- /* glob_audio_properties(0, 0); */ } + return 0; + } + + void glob_audio_setapi(t_pd *dummy, t_floatarg f) + { + t_int args = (t_int)f; + _callfunction(_glob_audio_setapi,&args,1); }
*************** *** 1014,1018 **** /* tb: message-based audio configuration * supported by vibrez.net { */ ! void glob_audio_samplerate(t_pd * dummy, t_float f) { int naudioindev; --- 1061,1066 ---- /* tb: message-based audio configuration * supported by vibrez.net { */ ! ! static t_int _glob_audio_samplerate(t_int *args) { int naudioindev; *************** *** 1026,1032 **** int advance; int scheduler;
! if (f == sys_getsr()) ! return;
sys_get_audio_params(&naudioindev, audioindev, audiochindev, --- 1074,1083 ---- int advance; int scheduler; + int newrate = *args;
! if(sys_inaudiothread()) return 2; ! ! if (newrate == sys_getsr()) ! return 0;
sys_get_audio_params(&naudioindev, audioindev, audiochindev, *************** *** 1036,1051 **** sys_open_audio(naudioindev, audioindev, naudioindev, audiochindev, naudiooutdev, audiooutdev, naudiooutdev, audiochoutdev, ! (int)f, dacblocksize, advance, scheduler, 1); }
! void glob_audio_api(t_pd * dummy, t_float f) { ! int newapi = (int)f; sys_close_audio(); sys_audioapi = newapi; }
! void glob_audio_delay(t_pd * dummy, t_float f) { int naudioindev; --- 1087,1116 ---- sys_open_audio(naudioindev, audioindev, naudioindev, audiochindev, naudiooutdev, audiooutdev, naudiooutdev, audiochoutdev, ! newrate, dacblocksize, advance, scheduler, 1); ! return 0; }
+ void glob_audio_samplerate(t_pd * dummy, t_float f) + { + t_int args = (t_int)f; + _callfunction(_glob_audio_samplerate,&args,1); + }
! static t_int _glob_audio_api(t_int *args) { ! int newapi = *args; ! if(sys_inaudiothread()) return 2; sys_close_audio(); sys_audioapi = newapi; + return 0; }
! void glob_audio_api(t_pd * dummy, t_float f) ! { ! t_int args = (t_int)f; ! _callfunction(_glob_audio_api,&args,1); ! } ! ! static t_int _glob_audio_delay(t_int *args) { int naudioindev; *************** *** 1059,1065 **** int advance; /* dummy */ int scheduler;
! if ((int)f == audio_advance) ! return;
sys_get_audio_params(&naudioindev, audioindev, audiochindev, --- 1124,1133 ---- int advance; /* dummy */ int scheduler; + int newadv = *args;
! if(sys_inaudiothread()) return 2; ! ! if (newadv == audio_advance) ! return 0;
sys_get_audio_params(&naudioindev, audioindev, audiochindev, *************** *** 1069,1076 **** sys_open_audio(naudioindev, audioindev, naudioindev, audiochindev, naudiooutdev, audiooutdev, naudiooutdev, audiochoutdev, ! rate, dacblocksize, (int) f, scheduler, 1); }
! void glob_audio_dacblocksize(t_pd * dummy, t_float f) { int naudioindev; --- 1137,1152 ---- sys_open_audio(naudioindev, audioindev, naudioindev, audiochindev, naudiooutdev, audiooutdev, naudiooutdev, audiochoutdev, ! rate, dacblocksize, newadv, scheduler, 1); ! return 0; }
! void glob_audio_delay(t_pd * dummy, t_float f) ! { ! t_int args = (t_int)f; ! _callfunction(_glob_audio_delay,&args,1); ! } ! ! ! static t_int _glob_audio_dacblocksize(t_int *args) { int naudioindev; *************** *** 1084,1090 **** int advance; int scheduler;
! if ((int)f == audio_dacblocksize) ! return;
sys_get_audio_params(&naudioindev, audioindev, audiochindev, --- 1160,1169 ---- int advance; int scheduler; + int newblocksize = *args;
! if(sys_inaudiothread()) return 2; ! ! if (newblocksize == audio_dacblocksize) ! return 0;
sys_get_audio_params(&naudioindev, audioindev, audiochindev, *************** *** 1094,1101 **** sys_open_audio(naudioindev, audioindev, naudioindev, audiochindev, naudiooutdev, audiooutdev, naudiooutdev, audiochoutdev, ! rate, (int)f, advance, scheduler, 1); }
! void glob_audio_scheduler(t_pd * dummy, t_float f) { int naudioindev; --- 1173,1188 ---- sys_open_audio(naudioindev, audioindev, naudioindev, audiochindev, naudiooutdev, audiooutdev, naudiooutdev, audiochoutdev, ! rate, newblocksize, advance, scheduler, 1); ! return 0; }
! void glob_audio_dacblocksize(t_pd * dummy, t_float f) ! { ! t_int args = (t_int)f; ! _callfunction(_glob_audio_dacblocksize,&args,1); ! } ! ! ! static t_int _glob_audio_scheduler(t_int *args) { int naudioindev; *************** *** 1109,1117 **** int advance; int scheduler; /* dummy */
! if ((int)f == sys_callbackscheduler) ! return;
! scheduler = (f != 0) ? 1 : 0;
sys_get_audio_params(&naudioindev, audioindev, audiochindev, --- 1196,1205 ---- int advance; int scheduler; /* dummy */ + int newscheduler = (*args != 0) ? 1 : 0;
! if(sys_inaudiothread()) return 2;
! if (newscheduler == sys_callbackscheduler) ! return 0;
sys_get_audio_params(&naudioindev, audioindev, audiochindev, *************** *** 1121,1129 **** sys_open_audio(naudioindev, audioindev, naudioindev, audiochindev, naudiooutdev, audiooutdev, naudiooutdev, audiochoutdev, ! rate, dacblocksize, advance, scheduler, 1);
! if (scheduler != sys_callbackscheduler) { ! if (scheduler == 1) post("switched to callback-based scheduler"); else --- 1209,1217 ---- sys_open_audio(naudioindev, audioindev, naudioindev, audiochindev, naudiooutdev, audiooutdev, naudiooutdev, audiochoutdev, ! rate, dacblocksize, advance, newscheduler, 1);
! if (scheduler != newscheduler) { ! if (newscheduler == 1) post("switched to callback-based scheduler"); else *************** *** 1132,1171 **** else post("couldn't change scheduler"); }
! ! void glob_audio_device(t_pd * dummy, t_symbol *s, int argc, t_atom *argv) ! { ! int naudioindev; ! int audioindev[MAXAUDIOINDEV]; ! int audiochindev[MAXAUDIOINDEV]; ! int naudiooutdev; ! int audiooutdev[MAXAUDIOOUTDEV]; ! int audiochoutdev[MAXAUDIOOUTDEV]; ! int rate; ! int dacblocksize; ! int advance; ! int scheduler; ! ! int i; ! ! sys_get_audio_params(&naudioindev, audioindev, audiochindev, ! &naudiooutdev, audiooutdev, audiochoutdev, ! &rate, &dacblocksize, &advance, &scheduler); ! ! naudiooutdev = naudioindev = (int)atom_getfloatarg(0, argc, argv); ! for (i = 0; i != MAXAUDIOINDEV; i++) { ! audiooutdev[i] = audioindev[i] = atom_getfloatarg(i*2+1, argc, argv); ! audiochoutdev[i] = audiochindev[i] = atom_getfloatarg(i*2+2, argc, argv); }
- sys_close_audio(); - sys_open_audio(naudioindev, audioindev, naudioindev, audiochindev, - naudiooutdev, audiooutdev, naudiooutdev, audiochoutdev, - rate, dacblocksize, advance, scheduler, 1); - }
! void glob_audio_device_in(t_pd * dummy, t_symbol *s, int argc, t_atom *argv) { int naudioindev; --- 1220,1234 ---- else post("couldn't change scheduler"); + return 0; }
! void glob_audio_scheduler(t_pd * dummy, t_float f) { ! t_int args = (t_int)f; ! _callfunction(_glob_audio_scheduler,&args,1); }
! static t_int _glob_audio_device(t_int *args) { int naudioindev; *************** *** 1182,1194 **** int i;
sys_get_audio_params(&naudioindev, audioindev, audiochindev, &naudiooutdev, audiooutdev, audiochoutdev, &rate, &dacblocksize, &advance, &scheduler); ! naudioindev = (int)atom_getfloatarg(0, argc, argv); ! for (i = 0; i != MAXAUDIOINDEV; i=i+2) { ! audioindev[i] = atom_getfloatarg(i+1, argc, argv); ! audiochindev[i] = atom_getfloatarg(i+2, argc, argv); }
--- 1245,1259 ---- int i;
+ if(sys_inaudiothread()) return 2; + sys_get_audio_params(&naudioindev, audioindev, audiochindev, &naudiooutdev, audiooutdev, audiochoutdev, &rate, &dacblocksize, &advance, &scheduler); ! naudiooutdev = naudioindev = args[0]; ! for (i = 0; i != MAXAUDIOINDEV; i++) { ! audiooutdev[i] = audioindev[i] = args[i*2+1]; ! audiochoutdev[i] = audiochindev[i] = args[i*2+2]; }
*************** *** 1197,1235 **** naudiooutdev, audiooutdev, naudiooutdev, audiochoutdev, rate, dacblocksize, advance, scheduler, 1); }
! void glob_audio_device_out(t_pd * dummy, t_symbol *s, int argc, t_atom *argv) { ! int naudioindev; ! int audioindev[MAXAUDIOINDEV]; ! int audiochindev[MAXAUDIOINDEV]; ! int naudiooutdev; ! int audiooutdev[MAXAUDIOOUTDEV]; ! int audiochoutdev[MAXAUDIOOUTDEV]; ! int rate; ! int dacblocksize; ! int advance; ! int scheduler; ! int i;
! sys_get_audio_params(&naudioindev, audioindev, audiochindev, ! &naudiooutdev, audiooutdev, audiochoutdev, ! &rate, &dacblocksize, &advance, &scheduler); ! ! naudiooutdev = (int)atom_getfloatarg(0, argc, argv); ! for (i = 0; i != MAXAUDIOOUTDEV; i=i+2) { ! audiooutdev[i] = atom_getfloatarg(i+1, argc, argv); ! audiochoutdev[i] = atom_getfloatarg(i+2, argc, argv); }
! sys_close_audio(); ! sys_open_audio(naudioindev, audioindev, naudioindev, audiochindev, ! naudiooutdev, audiooutdev, naudiooutdev, audiochoutdev, ! rate, dacblocksize, advance, scheduler, 1); }
- /* some general helper functions */ void sys_update_sleepgrain(void) --- 1262,1283 ---- naudiooutdev, audiooutdev, naudiooutdev, audiochoutdev, rate, dacblocksize, advance, scheduler, 1); + return 0; }
! void glob_audio_device(t_pd * dummy, t_symbol *s, int argc, t_atom *argv) { ! t_int args[MAXAUDIOINDEV*2+1]; int i;
! args[0] = (t_int)atom_getfloatarg(0, argc, argv); ! for (i = 0; i != MAXAUDIOINDEV; i++) { ! args[i*2+1] = (t_int)atom_getfloatarg(i*2+1, argc, argv); ! args[i*2+2] = (t_int)atom_getfloatarg(i*2+2, argc, argv); }
! _callfunction(_glob_audio_device,args,MAXAUDIOINDEV*2+1); }
/* some general helper functions */ void sys_update_sleepgrain(void) *************** *** 1244,1248 ****
! void glob_audio_getaudioindevices(t_pd * dummy, t_symbol *s, int ac, t_atom *av) { float flongform = 0; --- 1292,1296 ----
! static t_int _glob_audio_getaudioindevices(t_int *args) { float flongform = 0; *************** *** 1266,1274 ****
t_atom argv[MAXNDEV]; ! int f = ac ? (int)atom_getfloatarg(0,ac,av) : -1;
t_symbol * selector = gensym("audioindev"); t_symbol * pd = gensym("pd");
audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); --- 1314,1324 ----
t_atom argv[MAXNDEV]; ! int f = *args;
t_symbol * selector = gensym("audioindev"); t_symbol * pd = gensym("pd");
+ if(sys_inaudiothread()) return 2; + audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); *************** *** 1299,1305 **** typedmess(pd->s_thing, selector, 1, argv); } }
! void glob_audio_getaudiooutdevices(t_pd * dummy, t_symbol *s, int ac, t_atom *av) { float flongform = 0; --- 1349,1362 ---- typedmess(pd->s_thing, selector, 1, argv); } + return 0; }
! void glob_audio_getaudioindevices(t_pd * dummy, t_symbol *s, int ac, t_atom *av) ! { ! t_int args = ac ? (int)atom_getfloatarg(0,ac,av) : -1; ! _callfunction(_glob_audio_getaudioindevices,&args,1); ! } ! ! static t_int _glob_audio_getaudiooutdevices(t_int *args) { float flongform = 0; *************** *** 1323,1331 ****
t_atom argv[MAXNDEV]; ! int f = ac ? (int)atom_getfloatarg(0,ac,av) : -1;
t_symbol * selector = gensym("audiooutdev"); t_symbol * pd = gensym("pd");
audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); --- 1380,1390 ----
t_atom argv[MAXNDEV]; ! int f = *args;
t_symbol * selector = gensym("audiooutdev"); t_symbol * pd = gensym("pd");
+ if(sys_inaudiothread()) return 2; + audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); *************** *** 1356,1361 **** --- 1415,1428 ---- typedmess(pd->s_thing, selector, 1, argv); } + return 0; + } + + void glob_audio_getaudiooutdevices(t_pd * dummy, t_symbol *s, int ac, t_atom *av) + { + t_int args = ac ? (int)atom_getfloatarg(0,ac,av) : -1; + _callfunction(_glob_audio_getaudiooutdevices,&args,1); }
+ /* some prototypes from s_audio_portaudio.c */ extern void pa_getcurrent_devices(void); *************** *** 1364,1388 **** extern void pa_test_setting (int ac, t_atom *av); extern void pa_get_asio_latencies(t_float f);
! void glob_audio_getaudioininfo(t_pd * dummy, t_float f) { #ifdef USEAPI_PORTAUDIO #ifndef PABLIO if (sys_audioapi == API_PORTAUDIO) ! pa_getaudioininfo(f); #endif #endif }
! void glob_audio_getaudiooutinfo(t_pd * dummy, t_float f) { #ifdef USEAPI_PORTAUDIO #ifndef PABLIO if (sys_audioapi == API_PORTAUDIO) ! pa_getaudiooutinfo(f); #endif #endif }
void glob_audio_testaudiosetting(t_pd * dummy, t_symbol *s, int ac, t_atom *av) { --- 1431,1486 ---- extern void pa_test_setting (int ac, t_atom *av); extern void pa_get_asio_latencies(t_float f); + extern int pa_inaudiothread(void);
! static int sys_inaudiothread(void) { #ifdef USEAPI_PORTAUDIO #ifndef PABLIO if (sys_audioapi == API_PORTAUDIO) ! return pa_inaudiothread(); #endif #endif + return 0; }
! static t_int _glob_audio_getaudioininfo(t_int *args) { + if(sys_inaudiothread()) return 2; + #ifdef USEAPI_PORTAUDIO #ifndef PABLIO if (sys_audioapi == API_PORTAUDIO) ! pa_getaudioininfo(*args); #endif #endif + return 0; + } + + void glob_audio_getaudioininfo(t_pd * dummy, t_float f) + { + t_int args = (t_int)f; + _callfunction(_glob_audio_getaudioininfo,&args,1); }
+ static t_int _glob_audio_getaudiooutinfo(t_int *args) + { + if(sys_inaudiothread()) return 2; + + #ifdef USEAPI_PORTAUDIO + #ifndef PABLIO + if (sys_audioapi == API_PORTAUDIO) + pa_getaudiooutinfo(*args); + #endif + #endif + return 0; + } + + void glob_audio_getaudiooutinfo(t_pd * dummy, t_float f) + { + t_int args = (t_int)f; + _callfunction(_glob_audio_getaudiooutinfo,&args,1); + } + + /* TODO */ void glob_audio_testaudiosetting(t_pd * dummy, t_symbol *s, int ac, t_atom *av) { *************** *** 1395,1400 **** }
! void glob_audio_getcurrent_devices(void) { #ifdef USEAPI_PORTAUDIO #ifndef PABLIO --- 1493,1500 ---- }
! static t_int _glob_audio_getcurrent_devices(t_int *args) { + if(sys_inaudiothread()) return 2; + #ifdef USEAPI_PORTAUDIO #ifndef PABLIO *************** *** 1403,1417 **** #endif #endif }
! void glob_audio_asio_latencies(t_pd * dummy, t_float f) { #ifdef USEAPI_PORTAUDIO #ifndef PABLIO if (sys_audioapi == API_PORTAUDIO) ! pa_get_asio_latencies(f); #endif #endif }
--- 1503,1532 ---- #endif #endif + return 0; }
! void glob_audio_getcurrent_devices() ! { ! _callfunction(_glob_audio_getcurrent_devices,NULL,0); ! } ! ! ! static t_int _glob_audio_asio_latencies(t_int *args) { + if(sys_inaudiothread()) return 2; + #ifdef USEAPI_PORTAUDIO #ifndef PABLIO if (sys_audioapi == API_PORTAUDIO) ! pa_get_asio_latencies(*args); #endif #endif + return 0; + } + void glob_audio_asio_latencies(t_pd * dummy, t_float f) + { + t_int args = (t_int)f; + _callfunction(_glob_audio_asio_latencies,&args,1); }
Index: m_simd_sse_gcc.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_sse_gcc.c,v retrieving revision 1.1.4.13.2.4 retrieving revision 1.1.4.13.2.5 diff -C2 -d -r1.1.4.13.2.4 -r1.1.4.13.2.5 *** m_simd_sse_gcc.c 10 Jan 2006 20:28:13 -0000 1.1.4.13.2.4 --- m_simd_sse_gcc.c 17 Aug 2007 13:56:41 -0000 1.1.4.13.2.5 *************** *** 7,152 **** #include "m_simd.h"
! #if defined(__GNUC__) && (defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__)) && !(defined DONTUSESIMD)
/* TB: adapted from thomas' vc routines */
/* dst is assumed to be aligned */ ! void zerovec_simd(t_float *dst,int n) { ! asm( ! ".set T_FLOAT,4 \n" /* sizeof(t_float) */ ! "xorps %%xmm0, %%xmm0 \n" /* zero value */ ! "shr $4, %0 \n" ! ! /* should we do more loop unrolling? */ ! /* *dst = 0 */ ! "1: \n" ! "movaps %%xmm0, (%1) \n" ! "movaps %%xmm0, 4*T_FLOAT(%1) \n" ! "movaps %%xmm0, 8*T_FLOAT(%1) \n" ! "movaps %%xmm0, 12*T_FLOAT(%1) \n" ! ! "addl $16*T_FLOAT,%1 \n" ! "loop 1b \n" ! : ! :"c"(n),"r"(dst) ! :"%xmm0"); }
/* dst is assumed to be aligned */ ! void setvec_simd(t_float *dst,t_float v,int n) { ! asm( ! ".set T_FLOAT,4 \n" /* sizeof(t_float) */ ! "movss (%2),%%xmm0 \n" ! "shufps $0,%%xmm0,%%xmm0 \n" /* load value */ ! "shr $4,%0 \n" ! ! /* should we do more loop unrolling? */ ! /* *dst = v */ ! "1: \n" ! "movaps %%xmm0, (%1) \n" ! "movaps %%xmm0, 4*T_FLOAT(%1) \n" ! "movaps %%xmm0, 8*T_FLOAT(%1) \n" ! "movaps %%xmm0, 12*T_FLOAT(%1) \n" ! ! "addl $16*T_FLOAT,%1 \n" ! "loop 1b \n" ! : ! :"c"(n),"r"(dst),"r"(&v) ! :"%xmm0"); }
/* dst and src are assumed to be aligned */ ! void copyvec_simd(t_float *dst,const t_float *src,int n) { ! asm( ! ".set T_FLOAT,4 \n" /* sizeof(t_float) */ ! "shr $4, %0 \n" ! ! /* loop: *dst = *src */ ! "1: \n" ! "movaps (%1), %%xmm0 \n" ! "movaps 4*T_FLOAT(%1), %%xmm1 \n" ! "movaps 8*T_FLOAT(%1), %%xmm2 \n" ! "movaps 12*T_FLOAT(%1), %%xmm3 \n" ! "movaps %%xmm0, (%2) \n" ! "movaps %%xmm1, 4*T_FLOAT(%2) \n" ! "movaps %%xmm2, 8*T_FLOAT(%2) \n" ! "movaps %%xmm3, 12*T_FLOAT(%2) \n" ! ! ! "addl $16*T_FLOAT,%1 \n" ! "addl $16*T_FLOAT,%2 \n" ! "loop 1b \n" ! : ! :"c"(n),"r"(src),"r"(dst) ! :"%xmm0","%xmm1","%xmm2","%xmm3"); }
/* dst is assumed to be aligned */ ! void copyvec_simd_unalignedsrc(t_float *dst,const t_float *src,int n) { ! asm( ! ".set T_FLOAT,4 \n" /* sizeof(t_float) */ ! "shr $4, %0 \n" ! ! /* loop: *dst = *src */ ! "1: \n" ! "movups (%1), %%xmm0 \n" ! "movups 4*T_FLOAT(%1), %%xmm1 \n" ! "movups 8*T_FLOAT(%1), %%xmm2 \n" ! "movups 12*T_FLOAT(%1), %%xmm3 \n" ! "movaps %%xmm0, (%2) \n" ! "movaps %%xmm1, 4*T_FLOAT(%2) \n" ! "movaps %%xmm2, 8*T_FLOAT(%2) \n" ! "movaps %%xmm3, 12*T_FLOAT(%2) \n" ! ! ! "addl $16*T_FLOAT,%1 \n" ! "addl $16*T_FLOAT,%2 \n" ! "loop 1b \n" ! : ! :"c"(n),"r"(src),"r"(dst) ! :"%xmm0","%xmm1","%xmm2","%xmm3"); }
/* dst and src are assumed to be aligned */ ! void addvec_simd(t_float *dst,const t_float *src,int n) { ! asm( ! ".set T_FLOAT,4 \n" /* sizeof(t_float) */ ! "shr $4, %0 \n" ! ! /* loop: *dst += *src */ ! "1: \n" ! "movaps (%2,%3),%%xmm0 \n" ! "movaps (%1,%3),%%xmm1 \n" ! "addps %%xmm0,%%xmm1 \n" ! "movaps %%xmm1,(%2,%3) \n" ! ! "movaps 4*T_FLOAT(%2,%3),%%xmm0 \n" ! "movaps 4*T_FLOAT(%1,%3),%%xmm1 \n" ! "addps %%xmm0,%%xmm1 \n" ! "movaps %%xmm1,4*T_FLOAT(%2,%3) \n" ! ! "movaps 8*T_FLOAT(%2,%3),%%xmm0 \n" ! "movaps 8*T_FLOAT(%1,%3),%%xmm1 \n" ! "addps %%xmm0,%%xmm1 \n" ! "movaps %%xmm1,8*T_FLOAT(%2,%3) \n" ! ! "movaps 12*T_FLOAT(%2,%3),%%xmm0 \n" ! "movaps 12*T_FLOAT(%1,%3),%%xmm1 \n" ! "addps %%xmm0,%%xmm1 \n" ! "movaps %%xmm1,12*T_FLOAT(%2,%3) \n" ! ! "addl $16*T_FLOAT,%3 \n" ! "loop 1b \n" ! : ! : "c"(n),"r"(src),"r"(dst),"r"(0) ! : "%xmm0","%xmm1","%xmm2","%xmm3","%xmm4","%xmm5","%xmm6","%xmm7"); }
--- 7,68 ---- #include "m_simd.h"
! #if defined(__GNUC__) && (defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__)) && !defined(DONTUSESIMD) ! ! #include <xmmintrin.h> ! #include <string.h>
+ #define INNER 1 /* inner loop unrolling: 1, 2 or 4 */
+ #define INLINE __inline__ + typedef float * __restrict__ __attribute__((aligned(16))) vec_ptr; /* TB: adapted from thomas' vc routines */
/* dst is assumed to be aligned */ ! void INLINE zerovec_simd(vec_ptr dst,int n) { ! __m128 zero = _mm_xor_ps(zero,zero); ! int i,j; ! for(i = 0; i < n;) ! for(j = 0; j < INNER; ++j,i += 4) ! _mm_store_ps(dst+i,zero); }
/* dst is assumed to be aligned */ ! void INLINE setvec_simd(t_float *dst,t_float v,int n) { ! const __m128 src = _mm_load_ps1(&v); ! int i,j; ! for(i = 0; i < n;) ! for(j = 0; j < INNER; ++j,i += 4) ! _mm_store_ps(dst+i,src); }
/* dst and src are assumed to be aligned */ ! void INLINE copyvec_simd(t_float *dst,const t_float *src,int n) { ! int i,j; ! for(i = 0; i < n;) ! for(j = 0; j < INNER; ++j,i += 4) ! _mm_store_ps(dst+i ,_mm_load_ps(src+i )); }
/* dst is assumed to be aligned */ ! void INLINE copyvec_simd_unalignedsrc(t_float *dst,const t_float *src,int n) { ! int i,j; ! for(i = 0; i < n;) ! for(j = 0; j < INNER; ++j,i += 4) ! _mm_store_ps(dst+i ,_mm_loadu_ps(src+i )); }
/* dst and src are assumed to be aligned */ ! void INLINE addvec_simd(t_float *dst,const t_float *src,int n) { ! int i,j; ! for(i = 0; i < n;) ! for(j = 0; j < INNER; ++j,i += 4) ! _mm_store_ps(dst+i ,_mm_add_ps(_mm_load_ps(dst+i ),_mm_load_ps(src+i ))); }
*************** *** 154,175 **** void testcopyvec_simd(t_float *dst,const t_float *src,int n) { asm( - ".section .rodata \n" - ".align 16 \n" - "2: \n" - ".long 1610612736 \n" /* bitmask */ - ".long 1610612736 \n" /* 0x60000000 */ - ".long 1610612736 \n" - ".long 1610612736 \n" - ".set T_FLOAT,4 \n" - ".text \n" "shr $4, %0 \n" ! "movaps (2b), %%xmm0 \n" /* xmm0 = bitmask */ "xorps %%xmm1, %%xmm1 \n" /* xmm1 = 0x0 */
- "1: \n" "movaps (%1), %%xmm2 \n" --- 70,82 ---- void testcopyvec_simd(t_float *dst,const t_float *src,int n) { + static __attribute__((aligned(16))) const unsigned long bitmask[4] = {0x60000000,0x60000000,0x60000000,0x60000000}; asm( ".set T_FLOAT,4 \n" "shr $4, %0 \n" ! "movaps (%3), %%xmm0 \n" /* xmm0 = bitmask */ "xorps %%xmm1, %%xmm1 \n" /* xmm1 = 0x0 */
"1: \n" "movaps (%1), %%xmm2 \n" *************** *** 219,223 **** "jne 1b \n" : ! :"c"(n),"r"(src),"r"(dst) :"%xmm0","%xmm1","%xmm2","%xmm3", "%xmm4"); } --- 126,130 ---- "jne 1b \n" : ! :"c"(n),"r"(src),"r"(dst),"r"(bitmask) :"%xmm0","%xmm1","%xmm2","%xmm3", "%xmm4"); } *************** *** 226,246 **** void testaddvec_simd(t_float *dst,const t_float *src,int n) { ! asm( ! ".section .rodata \n" ! ".align 16 \n" ! "2: \n" ! ".long 1610612736 \n" /* bitmask */ ! ".long 1610612736 \n" /* 0x60000000 */ ! ".long 1610612736 \n" ! ".long 1610612736 \n"
".set T_FLOAT,4 \n" - ".text \n" "shr $4, %0 \n" ! "movaps (2b), %%xmm0 \n" /* xmm0 = bitmask */ "xorps %%xmm1, %%xmm1 \n" /* xmm1 = 0x0 */
- "1: \n" "movaps (%1), %%xmm2 \n" --- 133,145 ---- void testaddvec_simd(t_float *dst,const t_float *src,int n) { ! static __attribute__((aligned(16))) const unsigned long bitmask[4] = {0x60000000,0x60000000,0x60000000,0x60000000};
+ asm( ".set T_FLOAT,4 \n" "shr $4, %0 \n" ! "movaps (%3), %%xmm0 \n" /* xmm0 = bitmask */ "xorps %%xmm1, %%xmm1 \n" /* xmm1 = 0x0 */
"1: \n" "movaps (%1), %%xmm2 \n" *************** *** 298,302 **** "jne 1b \n" : ! :"c"(n),"r"(src),"r"(dst) :"%xmm0","%xmm1","%xmm2","%xmm3", "%xmm4", "%xmm5"); } --- 197,201 ---- "jne 1b \n" : ! :"c"(n),"r"(src),"r"(dst),"r"(bitmask) :"%xmm0","%xmm1","%xmm2","%xmm3", "%xmm4", "%xmm5"); } *************** *** 324,327 **** --- 223,236 ---- t_int *plus_perf_simd (t_int * w) { + #ifdef NOASM + vec_ptr in1 = (vec_ptr)w[1]; + vec_ptr in2 = (vec_ptr)w[2]; + vec_ptr out = (vec_ptr)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_add_ps(_mm_load_ps(in1+i),_mm_load_ps(in2+i))); + #else asm( ".set T_FLOAT,4 \n" *************** *** 358,361 **** --- 267,271 ---- :"%xmm0","%xmm1","%xmm2","%xmm3","%xmm4","%xmm5","%xmm6","%xmm7" ); + #endif return w+5; } *************** *** 364,367 **** --- 274,287 ---- t_int *scalarplus_perf_simd(t_int *w) { + #ifdef NOASM + vec_ptr in = (vec_ptr)w[1]; + const __m128 value = _mm_load_ps1((const t_float *)w[2]); + vec_ptr out = (vec_ptr)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_add_ps(_mm_load_ps(in+i),value)); + #else asm( ".set T_FLOAT,4 \n" *************** *** 397,400 **** --- 317,321 ---- :"%xmm0", "%xmm1","%xmm2","%xmm3","%xmm4" ); + #endif return w+5; } *************** *** 402,405 **** --- 323,336 ---- t_int *minus_perf_simd(t_int *w) { + #ifdef NOASM + vec_ptr in1 = (vec_ptr)w[1]; + vec_ptr in2 = (vec_ptr)w[2]; + vec_ptr out = (vec_ptr)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_sub_ps(_mm_load_ps(in1+i),_mm_load_ps(in2+i))); + #else asm( ".set T_FLOAT,4 \n" *************** *** 436,439 **** --- 367,371 ---- :"%xmm0","%xmm1","%xmm2","%xmm3","%xmm4","%xmm5","%xmm6","%xmm7" ); + #endif return w+5; } *************** *** 441,444 **** --- 373,386 ---- t_int* scalarminus_perf_simd(t_int *w) { + #ifdef NOASM + vec_ptr in = (vec_ptr)w[1]; + const __m128 value = _mm_load_ps1((const t_float *)w[2]); + vec_ptr out = (vec_ptr)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_sub_ps(_mm_load_ps(in+i),value)); + #else asm( ".set T_FLOAT,4 \n" *************** *** 474,477 **** --- 416,420 ---- :"%xmm0","%xmm1","%xmm2","%xmm3","%xmm4" ); + #endif return w+5; } *************** *** 480,483 **** --- 423,436 ---- t_int *times_perf_simd(t_int *w) { + #ifdef NOASM + vec_ptr in1 = (vec_ptr)w[1]; + vec_ptr in2 = (vec_ptr)w[2]; + vec_ptr out = (vec_ptr)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_mul_ps(_mm_load_ps(in1+i),_mm_load_ps(in2+i))); + #else asm( ".set T_FLOAT,4 \n" *************** *** 514,517 **** --- 467,471 ---- :"%xmm0","%xmm1","%xmm2","%xmm3","%xmm4","%xmm5","%xmm6","%xmm7" ); + #endif return w+5; } *************** *** 519,522 **** --- 473,486 ---- t_int* scalartimes_perf_simd(t_int *w) { + #ifdef NOASM + vec_ptr in = (vec_ptr)w[1]; + const __m128 value = _mm_load_ps1((const t_float *)w[2]); + vec_ptr out = (vec_ptr)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_mul_ps(_mm_load_ps(in+i),value)); + #else asm( ".set T_FLOAT,4 \n" *************** *** 552,555 **** --- 516,520 ---- :"%xmm0","%xmm1","%xmm2","%xmm3","%xmm4" ); + #endif return w+5; } *************** *** 557,560 **** --- 522,536 ---- t_int *sqr_perf_simd(t_int *w) { + #ifdef NOASM + vec_ptr in = (vec_ptr)w[1]; + vec_ptr out = (vec_ptr)w[2]; + const int n = (int)w[3]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) { + const __m128 v = _mm_load_ps(in+i); + _mm_store_ps(out+i,_mm_mul_ps(v,v)); + } + #else asm( ".set T_FLOAT,4 \n" *************** *** 588,591 **** --- 564,568 ---- :"%xmm0","%xmm1","%xmm2","%xmm3" ); + #endif return w+4; } *************** *** 594,597 **** --- 571,584 ---- t_int* over_perf_simd(t_int * w) { + #ifdef NOASM + vec_ptr in1 = (vec_ptr)w[1]; + vec_ptr in2 = (vec_ptr)w[2]; + vec_ptr out = (vec_ptr)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_div_ps(_mm_load_ps(in1+i),_mm_load_ps(in2+i))); + #else asm( ".set T_FLOAT,4 \n" *************** *** 628,631 **** --- 615,619 ---- :"%xmm0","%xmm1","%xmm2","%xmm3","%xmm4","%xmm5","%xmm6","%xmm7" ); + #endif return w+5; } *************** *** 633,636 **** --- 621,635 ---- t_int* scalarover_perf_simd(t_int *w) { + #ifdef NOASM + vec_ptr in = (vec_ptr)w[1]; + const float one = 1.f; + const __m128 value = _mm_div_ps(_mm_load_ps1(&one),_mm_load_ps1((const t_float *)w[2])); + vec_ptr out = (vec_ptr)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_mul_ps(_mm_load_ps(in+i),value)); + #else asm( ".set T_FLOAT,4 \n" *************** *** 666,669 **** --- 665,669 ---- :"%xmm0","%xmm1","%xmm2","%xmm3","%xmm4" ); + #endif return w+5; } *************** *** 672,675 **** --- 672,685 ---- t_int* min_perf_simd(t_int * w) { + #ifdef NOASM + vec_ptr in1 = (vec_ptr)w[1]; + vec_ptr in2 = (vec_ptr)w[2]; + vec_ptr out = (vec_ptr)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_min_ps(_mm_load_ps(in1+i),_mm_load_ps(in2+i))); + #else asm( ".set T_FLOAT,4 \n" *************** *** 706,709 **** --- 716,720 ---- :"%xmm0","%xmm1","%xmm2","%xmm3","%xmm4","%xmm5","%xmm6","%xmm7" ); + #endif return w+5; } *************** *** 712,715 **** --- 723,736 ---- t_int* scalarmin_perf_simd(t_int *w) { + #ifdef NOASM + vec_ptr in = (vec_ptr)w[1]; + const __m128 value = _mm_load_ps1((const t_float *)w[2]); + vec_ptr out = (vec_ptr)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_min_ps(_mm_load_ps(in+i),value)); + #else asm( ".set T_FLOAT,4 \n" *************** *** 745,748 **** --- 766,770 ---- :"%xmm0","%xmm1","%xmm2","%xmm3","%xmm4" ); + #endif return w+5; } *************** *** 751,754 **** --- 773,786 ---- t_int* max_perf_simd(t_int * w) { + #ifdef NOASM + vec_ptr in1 = (vec_ptr)w[1]; + vec_ptr in2 = (vec_ptr)w[2]; + vec_ptr out = (vec_ptr)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_max_ps(_mm_load_ps(in1+i),_mm_load_ps(in2+i))); + #else asm( ".set T_FLOAT,4 \n" *************** *** 785,788 **** --- 817,821 ---- :"%xmm0","%xmm1","%xmm2","%xmm3","%xmm4","%xmm5","%xmm6","%xmm7" ); + #endif return w+5; } *************** *** 791,794 **** --- 824,837 ---- t_int* scalarmax_perf_simd(t_int *w) { + #ifdef NOASM + vec_ptr in = (vec_ptr)w[1]; + const __m128 value = _mm_load_ps1((const t_float *)w[2]); + vec_ptr out = (vec_ptr)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_max_ps(_mm_load_ps(in+i),value)); + #else asm( ".set T_FLOAT,4 \n" *************** *** 824,827 **** --- 867,871 ---- :"%xmm0","%xmm1","%xmm2","%xmm3","%xmm4" ); + #endif return w+5; } *************** *** 829,832 **** --- 873,887 ---- t_int* clip_perf_simd(t_int *w) { + #ifdef NOASM + vec_ptr in = (vec_ptr)w[1]; + vec_ptr out = (vec_ptr)w[2]; + const __m128 lo = _mm_load_ps1((const t_float *)w[3]); + const __m128 hi = _mm_load_ps1((const t_float *)w[4]); + const int n = w[5]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_max_ps(_mm_min_ps(_mm_load_ps(in+i),hi),lo)); + #else asm( ".set T_FLOAT,4 \n" *************** *** 869,872 **** --- 924,928 ---- :"%xmm0","%xmm1","%xmm2","%xmm3","%xmm4","%xmm5" ); + #endif return w+6; } *************** *** 875,878 **** --- 931,943 ---- t_int* sigsqrt_perf_simd(t_int *w) { + #ifdef NOASM + vec_ptr in = (vec_ptr)w[1]; + vec_ptr out = (vec_ptr)w[2]; + const int n = w[3]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_sqrt_ps(_mm_load_ps(in+i))); + #else asm( ".set T_FLOAT,4 \n" *************** *** 906,909 **** --- 971,975 ---- :"%xmm0","%xmm1","%xmm2","%xmm3" ); + #endif return w+4; } *************** *** 912,915 **** --- 978,990 ---- t_int* sigrsqrt_perf_simd(t_int *w) { + #ifdef NOASM + vec_ptr in = (vec_ptr)w[1]; + vec_ptr out = (vec_ptr)w[2]; + const int n = w[3]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < INNER; ++j,i += 4) + _mm_store_ps(out+i,_mm_rsqrt_ps(_mm_load_ps(in+i))); + #else asm( ".set T_FLOAT,4 \n" *************** *** 943,946 **** --- 1018,1022 ---- :"%xmm0","%xmm1","%xmm2","%xmm3" ); + #endif return w+4; } *************** *** 1030,1047 **** float peakvec_simd(t_float* vec, t_int n, t_float cur_max) { ! asm( ! ".section .rodata \n" ! ".align 16 \n" ! "2: \n" ! ".long 2147483647 \n" /* bitmask for abs */ ! ".long 2147483647 \n" /* 0x7fffffff */ ! ".long 2147483647 \n" ! ".long 2147483647 \n"
".set T_FLOAT,4 \n" - ".text \n"
"shrl $4, %2 \n" /* divide by 16 */ ! "movaps (2b), %%xmm0 \n"
"movss (%0), %%xmm5 \n" /* cur_max */ --- 1106,1116 ---- float peakvec_simd(t_float* vec, t_int n, t_float cur_max) { ! static __attribute__((aligned(16))) const unsigned long bitmask[4] = {0x7fffffff,0x7fffffff,0x7fffffff,0x7fffffff};
+ asm( ".set T_FLOAT,4 \n"
"shrl $4, %2 \n" /* divide by 16 */ ! "movaps (%3), %%xmm0 \n"
"movss (%0), %%xmm5 \n" /* cur_max */ *************** *** 1081,1085 ****
: ! :"r"(&cur_max), "r"(vec),"c"(n) :"%xmm0","%xmm1","%xmm2","%xmm3", "%xmm4", "%xmm5");
--- 1150,1154 ----
: ! :"r"(&cur_max), "r"(vec),"c"(n),"r"(bitmask) :"%xmm0","%xmm1","%xmm2","%xmm3", "%xmm4", "%xmm5");
Index: s_audio_portaudio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/s_audio_portaudio.c,v retrieving revision 1.1.2.21 retrieving revision 1.1.2.22 diff -C2 -d -r1.1.2.21 -r1.1.2.22 *** s_audio_portaudio.c 23 Nov 2006 05:54:26 -0000 1.1.2.21 --- s_audio_portaudio.c 17 Aug 2007 13:56:41 -0000 1.1.2.22 *************** *** 37,54 ****
! #define MAX_PA_CHANS 32
! static int pa_inchans, pa_outchans; ! static int pa_blocksize;
! static PaStream *pa_stream; ! /* Initialize PortAudio */ ! PaError pa_status = -1; ! int pa_initialized = 0;
! void pa_initialize(void) { ! // if (!pa_initialized) ! // { pa_status = Pa_Initialize(); if ( pa_status!= paNoError ) --- 37,88 ----
! #define MAX_PA_CHANS 64
! static int pa_inchans = 0, pa_outchans = 0; ! static int pa_blocksize = 0;
! static PaStream *pa_stream = NULL;
! static float* pa_inbuffer[MAX_PA_CHANS]; ! static float* pa_outbuffer[MAX_PA_CHANS]; ! static int pa_bufferpos = 0; ! ! static int gotaudiothread = 0; ! static pthread_t audiothread; ! ! static t_symbol *sym_pd = NULL; ! static t_symbol *sym_audiodevice; ! static t_symbol *sym_audiocurrentininfo,*sym_audiocurrentoutinfo; ! static t_symbol *sym_audioininfo,*sym_audiooutinfo; ! static t_symbol *sym_testaudiosettingresult; ! static t_symbol *sym_asiolatency; ! ! int pa_inaudiothread(void) { ! return gotaudiothread && pthread_equal(pthread_self(),audiothread); ! } ! ! static void pa_initialize(void) ! { ! PaError pa_status; ! ! /* Assert that we're not in the audio thread */ ! assert(!pa_inaudiothread()); ! gotaudiothread = 0; ! ! if(!sym_pd) ! { ! /* initialize symbols */ ! sym_pd = gensym("pd"); ! ! sym_audiodevice = gensym("audiodevice"); ! sym_audiocurrentininfo = gensym("audiocurrentininfo"); ! sym_audiocurrentoutinfo = gensym("audiocurrentoutinfo"); ! sym_audioininfo = gensym("audioininfo"); ! sym_audiooutinfo = gensym("audiooutinfo"); ! sym_testaudiosettingresult = gensym("testaudiosettingresult"); ! sym_asiolatency = gensym("asiolatency"); ! } ! pa_status = Pa_Initialize(); if ( pa_status!= paNoError ) *************** *** 60,78 **** return; } - pa_initialized = 1; - // } }
! static float* pa_inbuffer[MAX_PA_CHANS]; ! static float* pa_outbuffer[MAX_PA_CHANS]; ! static int pa_bufferpos;
! static int pddev2padev(int pdindev,int isinput); ! static int padev2pddev(int padev,int isinput);
! int process (const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags statusFlags, void *userData);
static int patestCallback(const void* inputBuffer, void* outputBuffer, --- 94,141 ---- return; } }
! static int pddev2padev(int pddev,int input) ! { ! /* portaudio is already initialized here */ ! int j,devno; ! int count = Pa_GetDeviceCount(); ! for (j = 0, devno = 0; j < count; j++) ! { ! const PaDeviceInfo *info = Pa_GetDeviceInfo(j); ! int maxchans = input?info->maxInputChannels:info->maxOutputChannels; ! if (maxchans > 0) ! { ! if (devno == pddev) return j; ! devno++; ! } ! } ! return -1; // not found ! }
! static int padev2pddev(int padev,int input) ! { ! /* portaudio is already initialized here */ ! int j,devno; ! int count = Pa_GetDeviceCount(); ! for (j = 0, devno = 0; j < count; j++) ! { ! const PaDeviceInfo *info = Pa_GetDeviceInfo(j); ! int chans = input?info->maxInputChannels:info->maxOutputChannels; ! if (chans > 0) ! { ! if(j == padev) return devno; ! devno++; ! } ! } ! return -1; // not found ! }
! ! static int process (const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags statusFlags, void *userData);
+ /* static int patestCallback(const void* inputBuffer, void* outputBuffer, *************** *** 81,84 **** --- 144,148 ---- PaStreamCallbackFlags statusFlags, void* userData); + */
static int pa_indev = -1, pa_outdev = -1; *************** *** 135,140 **** #endif { ! post("input device %d, channels %d", pa_indev, inchans); ! post("output device %d, channels %d", pa_outdev, outchans); post("latency advance %d", advance); } --- 199,204 ---- #endif { ! post("input device %d (%s), channels %d", pa_indev, pdi?pdi->name:"", inchans); ! post("output device %d (%s), channels %d", pa_outdev, pdo?pdo->name:"", outchans); post("latency advance %d", advance); } *************** *** 197,209 **** if (err == paNoError) { - const PaStreamInfo * streaminfo = Pa_GetStreamInfo (pa_stream); - t_atom atoms[4];
! t_symbol * pd = gensym("pd"); ! t_symbol * selector1 = gensym("audiocurrentininfo"); ! t_symbol * selector2 = gensym("audiocurrentoutinfo"); ! ! sys_schedadvance = 1e-6 * streaminfo->outputLatency;
SETFLOAT(atoms, (float)indeviceno); --- 261,268 ---- if (err == paNoError) { t_atom atoms[4];
! const PaStreamInfo * streaminfo = Pa_GetStreamInfo (pa_stream); ! sys_schedadvance = 1e6 * streaminfo->outputLatency;
SETFLOAT(atoms, (float)indeviceno); *************** *** 211,215 **** SETFLOAT(atoms+2, (float)rate); SETFLOAT(atoms+3, (float)streaminfo->inputLatency * 1000.f); ! typedmess(pd->s_thing, selector1, 4, atoms);
SETFLOAT(atoms, (float)outdeviceno); --- 270,274 ---- SETFLOAT(atoms+2, (float)rate); SETFLOAT(atoms+3, (float)streaminfo->inputLatency * 1000.f); ! typedmess(sym_pd->s_thing, sym_audiocurrentininfo, 4, atoms);
SETFLOAT(atoms, (float)outdeviceno); *************** *** 217,221 **** SETFLOAT(atoms+2, (float)rate); SETFLOAT(atoms+3, (float)streaminfo->outputLatency * 1000.f); ! typedmess(pd->s_thing, selector2, 4, atoms); } } --- 276,280 ---- SETFLOAT(atoms+2, (float)rate); SETFLOAT(atoms+3, (float)streaminfo->outputLatency * 1000.f); ! typedmess(sym_pd->s_thing, sym_audiocurrentoutinfo, 4, atoms); } } *************** *** 264,315 **** extern int sys_meters; /* true if we're metering */
- - static int patestCallback(const void* inputBuffer, - void* outputBuffer, - unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo* timeInfo, - PaStreamCallbackFlags statusFlags, - void* userData) - { - int frameIndex, channelIndex, i; - float** outputs = (float**)outputBuffer; - static float phase; - - for( frameIndex=0; frameIndex<(int)framesPerBuffer; frameIndex++ ) - { - int c; - /* Output sine wave on every channel. */ - outputs[0][frameIndex] = (float) sin(phase); - outputs[1][frameIndex] = (float) sin(phase); - phase += 0.05; - if( phase >= (2.0 * M_PI) ) phase -= (2.0 * M_PI); - - } - for (i = 0; (unsigned)i != framesPerBuffer / sys_dacblocksize; ++i) - { - sched_tick(sys_time + sys_time_per_dsp_tick); - } - - return 0; - } - void run_all_idle_callbacks(void); void sys_xrun_notification(void); /* in m_sched.c */
void sys_lock_timeout_notification(void);
! int process (const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags statusFlags, void *userData) { - static int started = 0; - - int i; int timeout = (float)frameCount / (float) sys_dacsr * 1e6;
if (statusFlags) sys_xrun_notification();
if (sys_timedlock(timeout) == ETIMEDOUT) /* we're late */ --- 323,351 ---- extern int sys_meters; /* true if we're metering */
void run_all_idle_callbacks(void); + int run_timed_idle_callbacks(int microsecs); void sys_xrun_notification(void); /* in m_sched.c */
void sys_lock_timeout_notification(void);
! static int process (const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags statusFlags, void *userData) { int i; int timeout = (float)frameCount / (float) sys_dacsr * 1e6; + double time,rtime; + + if(!gotaudiothread) { + audiothread = pthread_self(); + gotaudiothread = 1; + } + else + assert(pa_inaudiothread());
if (statusFlags) sys_xrun_notification();
+ time = sys_getrealtime(); if (sys_timedlock(timeout) == ETIMEDOUT) /* we're late */ *************** *** 322,325 **** --- 358,362 ---- { int j; + if(input) for (j = 0; j < sys_inchannels; j++) { *************** *** 331,334 **** --- 368,372 ---- sched_tick(sys_time + sys_time_per_dsp_tick);
+ if(output) for (j = 0; j < sys_outchannels; j++) { *************** *** 337,340 **** --- 375,379 ---- sys_dacblocksize); } + /* update peak meters */ if (sys_meters) *************** *** 345,349 **** }
! run_all_idle_callbacks(); sys_unlock();
--- 384,395 ---- }
! rtime = (sys_getrealtime()-time)*1e6; ! if(rtime > 0) /* < 0 can happen when changing drivers etc. */ ! { ! time = timeout-rtime; ! if(time > 0) ! rtime = run_timed_idle_callbacks(time); ! } ! sys_unlock();
*************** *** 353,356 **** --- 399,404 ---- void pa_close_audio( void) { + pa_initialize(); + #ifndef DEBUG if(sys_verbose) *************** *** 362,366 **** if (pa_stream) { ! int status = Pa_StopStream(pa_stream);
if (status) --- 410,414 ---- if (pa_stream) { ! int status = Pa_AbortStream(pa_stream);
if (status) *************** *** 479,492 **** void pa_getaudioininfo(t_float f) { ! int i = pddev2padev((int)f,1); const PaDeviceInfo * pdi;
pa_initialize(); - pdi = Pa_GetDeviceInfo (i);
if (pdi) { - t_symbol * selector = gensym("audioininfo"); - t_symbol * pd = gensym("pd"); t_atom argv[4]; SETFLOAT(argv, pdi->maxInputChannels); --- 527,541 ---- void pa_getaudioininfo(t_float f) { ! int index; const PaDeviceInfo * pdi;
pa_initialize();
+ index = pddev2padev((int)f,1); + if(index < 0) return; + + pdi = Pa_GetDeviceInfo (index); if (pdi) { t_atom argv[4]; SETFLOAT(argv, pdi->maxInputChannels); *************** *** 494,498 **** SETFLOAT(argv+2, pdi->defaultLowInputLatency*1000.f); SETFLOAT(argv+3, pdi->defaultHighInputLatency*1000.f); ! typedmess(pd->s_thing, selector, 4, argv); } } --- 543,547 ---- SETFLOAT(argv+2, pdi->defaultLowInputLatency*1000.f); SETFLOAT(argv+3, pdi->defaultHighInputLatency*1000.f); ! typedmess(sym_pd->s_thing, sym_audioininfo, 4, argv); } } *************** *** 500,513 **** void pa_getaudiooutinfo(t_float f) { ! int i = pddev2padev((int)f,0); const PaDeviceInfo * pdi;
pa_initialize(); - pdi = Pa_GetDeviceInfo (i);
if (pdi) { - t_symbol * selector = gensym("audiooutinfo"); - t_symbol * pd = gensym("pd"); t_atom argv[4]; SETFLOAT(argv, pdi->maxOutputChannels); --- 549,563 ---- void pa_getaudiooutinfo(t_float f) { ! int index; const PaDeviceInfo * pdi;
pa_initialize();
+ index = pddev2padev((int)f,0); + if(index < 0) return; + + pdi = Pa_GetDeviceInfo (index); if (pdi) { t_atom argv[4]; SETFLOAT(argv, pdi->maxOutputChannels); *************** *** 515,519 **** SETFLOAT(argv+2, pdi->defaultLowOutputLatency*1000.f); SETFLOAT(argv+3, pdi->defaultHighOutputLatency*1000.f); ! typedmess(pd->s_thing, selector, 4, argv); } } --- 565,569 ---- SETFLOAT(argv+2, pdi->defaultLowOutputLatency*1000.f); SETFLOAT(argv+3, pdi->defaultHighOutputLatency*1000.f); ! typedmess(sym_pd->s_thing, sym_audiooutinfo, 4, argv); } } *************** *** 521,530 **** void pa_getcurrent_devices(void) { - t_symbol * pd = gensym("pd"); - t_symbol * selector = gensym("audiodevice"); t_atom argv[2]; SETFLOAT(argv, padev2pddev(pa_indev,1)); SETFLOAT(argv+1, padev2pddev(pa_outdev,0)); ! typedmess(pd->s_thing, selector, 2, argv); }
--- 571,581 ---- void pa_getcurrent_devices(void) { t_atom argv[2]; + + assert(!pa_inaudiothread()); + SETFLOAT(argv, padev2pddev(pa_indev,1)); SETFLOAT(argv+1, padev2pddev(pa_outdev,0)); ! typedmess(sym_pd->s_thing, sym_audiodevice, 2, argv); }
*************** *** 537,542 **** int outchans = atom_getfloatarg(4, ac, av); int advance = atom_getfloatarg(5, ac, av); - t_symbol * pd = gensym("pd"); - t_symbol * selector = gensym("testaudiosettingresult"); t_atom argv[1];
--- 588,591 ---- *************** *** 546,550 **** outdev = pddev2padev(outdev,0);
! if ((pa_indev == -1) && (pa_outdev == -1)) { int ret; --- 595,599 ---- outdev = pddev2padev(outdev,0);
! if (pa_indev >= 0 && pa_outdev >= 0) { int ret; *************** *** 566,621 ****
SETFLOAT(argv, ret == paNoError?1:0); ! typedmess(pd->s_thing, selector, 1, argv); } }
! static int pddev2padev(int pddev,int input) { ! int j; ! int devno; ! pa_initialize();
! for (j = 0, devno = 0; j < Pa_GetDeviceCount(); j++) ! { ! const PaDeviceInfo *info = Pa_GetDeviceInfo(j); ! int maxchans = input?info->maxInputChannels:info->maxOutputChannels; ! if (maxchans > 0) ! { ! if (devno == pddev) ! { ! return j; ! } ! devno++; ! } ! }
! return -1; }
! static int padev2pddev(int padev,int input) ! { ! int j,devno; ! int count = Pa_GetDeviceCount(); ! for (j = 0, devno = 0; j < count; j++) ! { ! const PaDeviceInfo *info = Pa_GetDeviceInfo(j); ! int chans = input?info->maxInputChannels:info->maxOutputChannels; ! if (chans > 0) ! { ! if(j == padev) return devno; ! devno++; ! } ! } ! return -1; // no found ! }
- void pa_get_asio_latencies(t_float f) - { - int index = pddev2padev((int)f,0); - const PaDeviceInfo *pdi = Pa_GetDeviceInfo(index); - const PaHostApiInfo *phi = Pa_GetHostApiInfo(pdi->hostApi); if (phi->type != paASIO) { ! post("device not an asio device"); return; } --- 615,642 ----
SETFLOAT(argv, ret == paNoError?1:0); ! typedmess(sym_pd->s_thing, sym_testaudiosettingresult, 1, argv); } }
! void pa_get_asio_latencies(t_float f) { ! int index; ! const PaDeviceInfo *pdi; ! const PaHostApiInfo *phi;
! pa_initialize();
! index = pddev2padev((int)f,0); ! if(index < 0) { ! post("device %i out of range",(int)f); ! return; }
! pdi = Pa_GetDeviceInfo(index); ! phi = Pa_GetHostApiInfo(pdi->hostApi);
if (phi->type != paASIO) { ! post("device %i not an asio device",(int)f); return; } *************** *** 626,632 **** t_atom argv[4];
- t_symbol * selector = gensym("asiolatency"); - t_symbol * pd = gensym("pd"); - PaAsio_GetAvailableLatencyValues(index, &minlat, &maxlat, &preflat, &gran);
--- 647,650 ---- *************** *** 635,640 **** SETFLOAT(argv + 2, (float) preflat); SETFLOAT(argv + 3, (float) gran); ! ! typedmess(pd->s_thing, selector, 4, argv); } #endif --- 653,657 ---- SETFLOAT(argv + 2, (float) preflat); SETFLOAT(argv + 3, (float) gran); ! typedmess(sym_pd->s_thing, sym_asiolatency, 4, argv); } #endif
Index: s_midi_pm.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_midi_pm.c,v retrieving revision 1.4.4.1.2.9 retrieving revision 1.4.4.1.2.10 diff -C2 -d -r1.4.4.1.2.9 -r1.4.4.1.2.10 *** s_midi_pm.c 30 Nov 2006 01:43:23 -0000 1.4.4.1.2.9 --- s_midi_pm.c 17 Aug 2007 13:56:42 -0000 1.4.4.1.2.10 *************** *** 22,26 **** #include "portmidi.h" #include "porttime.h" ! #include "pminternal.h"
static PmStream *mac_midiindevlist[MAXMIDIINDEV]; --- 22,26 ---- #include "portmidi.h" #include "porttime.h" ! #include "pmutil.h"
static PmStream *mac_midiindevlist[MAXMIDIINDEV];
Index: m_simd_sse_vc.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_sse_vc.c,v retrieving revision 1.1.4.6.2.1 retrieving revision 1.1.4.6.2.2 diff -C2 -d -r1.1.4.6.2.1 -r1.1.4.6.2.2 *** m_simd_sse_vc.c 11 Sep 2005 11:55:12 -0000 1.1.4.6.2.1 --- m_simd_sse_vc.c 17 Aug 2007 13:56:41 -0000 1.1.4.6.2.2 *************** *** 7,15 **** #include "m_simd.h"
! #if defined(NT) && defined(_MSC_VER) && !(defined DONTUSESIMD)
/* dst is assumed to be aligned */ void zerovec_simd(t_float *dst,int n) { __asm { mov edx,dword ptr [dst] /* out */ --- 7,28 ---- #include "m_simd.h"
! #if defined(NT) && defined(_MSC_VER) && !defined(DONTUSESIMD) ! ! #include <xmmintrin.h>
/* dst is assumed to be aligned */ void zerovec_simd(t_float *dst,int n) { + #ifdef NOASM + int n4 = n/16; + const __m128 zero = _mm_setzero_ps(); + for(int i = 0; i < n4; ++i,dst += 16) + { + _mm_store_ps(dst+ 0,zero); + _mm_store_ps(dst+ 4,zero); + _mm_store_ps(dst+ 8,zero); + _mm_store_ps(dst+12,zero); + } + #else __asm { mov edx,dword ptr [dst] /* out */ *************** *** 30,33 **** --- 43,47 ---- loop loopa } + #endif }
*************** *** 35,38 **** --- 49,63 ---- void setvec_simd(t_float *dst,t_float v,int n) { + #ifdef NOASM + int n4 = n/16; + const __m128 value = _mm_load1_ps(&v); + for(int i = 0; i < n4; ++i,dst += 16) + { + _mm_store_ps(dst+ 0,value); + _mm_store_ps(dst+ 4,value); + _mm_store_ps(dst+ 8,value); + _mm_store_ps(dst+12,value); + } + #else __asm { mov edx,dword ptr [dst] /* out */ *************** *** 56,59 **** --- 81,85 ---- loop loopa } + #endif }
*************** *** 429,432 **** --- 455,468 ---- t_int *scalartimes_perf_simd(t_int *w) { + #if 0 //def NOASM + const t_float *in = (t_float *)w[1]; + const __m128 value = _mm_load1_ps((const t_float *)w[2]); + t_float *out = (t_float *)w[3]; + const int n = w[4]; + int i,j; + for(i = 0; i < n; ) + for(j = 0; j < 4; ++j,i += 4) + _mm_store_ps(out+i,_mm_mul_ps(_mm_load_ps(in+i),value)); + #else __asm { mov esi,dword ptr [w] *************** *** 471,474 **** --- 507,511 ---- loop loopa } + #endif return (w+5); }
Index: s_entry.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_entry.c,v retrieving revision 1.2.4.2.2.2 retrieving revision 1.2.4.2.2.3 diff -C2 -d -r1.2.4.2.2.2 -r1.2.4.2.2.3 *** s_entry.c 8 Oct 2005 09:38:46 -0000 1.2.4.2.2.2 --- s_entry.c 17 Aug 2007 13:56:41 -0000 1.2.4.2.2.3 *************** *** 13,18 **** --- 13,21 ---- int nCmdShow) { + #ifdef _MSC_VER __try { + #endif sys_main(__argc,__argv); + #ifdef _MSC_VER } __finally *************** *** 20,23 **** --- 23,27 ---- printf("caught an exception; stopping\n"); } + #endif }
Index: m_simd_ve_gcc.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_ve_gcc.c,v retrieving revision 1.1.4.2 retrieving revision 1.1.4.2.2.1 diff -C2 -d -r1.1.4.2 -r1.1.4.2.2.1 *** m_simd_ve_gcc.c 11 Jan 2005 21:41:14 -0000 1.1.4.2 --- m_simd_ve_gcc.c 17 Aug 2007 13:56:41 -0000 1.1.4.2.2.1 *************** *** 7,14 **** #include "m_simd.h"
! #if defined(__GNUC__) && defined(__POWERPC__) && defined(__ALTIVEC__)
//#define USEVECLIB
#ifdef USEVECLIB #include <vecLib/vDSP.h> --- 7,19 ---- #include "m_simd.h" [...1048 lines suppressed...] } --- 449,466 ---- #ifdef USEVECLIB /* no zero checking here */ ! vec_st(vrsqrtf(vec_ld( 0,src+i)), 0,dst+i); #else ! vector float v = vec_ld( 0,src+i); ! const vector unsigned char mask = vec_nor((vector unsigned char)vec_cmple(v,zero),(vector unsigned char)zero); /* bit mask... all 0 for data <= 0., all 1 else */ ! const vector float estimate = (vector float)vec_and((vector unsigned char)vec_rsqrte(v),mask);
! vec_st( ! vec_madd( ! vec_nmsub( v, vec_madd( estimate, estimate, zero ), one ), ! vec_madd( estimate, oneHalf, zero ), ! estimate ! ) ! , 0,dst+i ! ); #endif }
Index: s_print.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_print.c,v retrieving revision 1.2.4.1.2.2 retrieving revision 1.2.4.1.2.3 diff -C2 -d -r1.2.4.1.2.2 -r1.2.4.1.2.3 *** s_print.c 30 Nov 2005 13:36:58 -0000 1.2.4.1.2.2 --- s_print.c 17 Aug 2007 13:56:42 -0000 1.2.4.1.2.3 *************** *** 11,22 **** #include "s_stuff.h"
! t_printhook sys_printhook; ! int sys_printtostderr; ! ! static void dopost(const char *s) { ! if (sys_printhook) ! (*sys_printhook)(s); ! else if (sys_printtostderr) fprintf(stderr, "%s", s); else --- 11,17 ---- #include "s_stuff.h"
! static void dopost_intern(const char *s) { ! if (sys_printtostderr) fprintf(stderr, "%s", s); else *************** *** 33,37 **** if (c == '\' || c == '{' || c == '}' || c == ';') upbuf[ptout++] = '\'; ! upbuf[ptout] = s[ptin]; } if (ptout && upbuf[ptout-1] == '\n') --- 28,32 ---- if (c == '\' || c == '{' || c == '}' || c == ';') upbuf[ptout++] = '\'; ! upbuf[ptout] = c; } if (ptout && upbuf[ptout-1] == '\n') *************** *** 42,45 **** --- 37,48 ---- }
+ static void dopost(const char *s) + { + (*sys_printhook)(s); + } + + t_printhook sys_printhook = dopost_intern; + int sys_printtostderr = 0; + void post(const char *fmt, ...) {
Index: x_connective.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/x_connective.c,v retrieving revision 1.3.4.1.2.11 retrieving revision 1.3.4.1.2.12 diff -C2 -d -r1.3.4.1.2.11 -r1.3.4.1.2.12 *** x_connective.c 30 Nov 2006 01:43:23 -0000 1.3.4.1.2.11 --- x_connective.c 17 Aug 2007 13:56:42 -0000 1.3.4.1.2.12 *************** *** 11,16 **** extern t_pd *newest;
- #define pd_set_newest(x) (newest=(x)) - /* -------------------------- int ------------------------------ */ static t_class *pdint_class; --- 11,14 ---- *************** *** 69,73 **** outlet_new(&x->x_obj, &s_float); floatinlet_new(&x->x_obj, &x->x_f); ! pd_set_newest((t_pd *)x); return (x); } --- 67,71 ---- outlet_new(&x->x_obj, &s_float); floatinlet_new(&x->x_obj, &x->x_f); ! newest = &x->x_obj.ob_pd; return (x); } *************** *** 112,116 **** outlet_new(&x->x_obj, &s_symbol); symbolinlet_new(&x->x_obj, &x->x_s); ! pd_set_newest((t_pd *)x); return (x); } --- 110,114 ---- outlet_new(&x->x_obj, &s_symbol); symbolinlet_new(&x->x_obj, &x->x_s); ! newest = &x->x_obj.ob_pd; return (x); } *************** *** 168,172 **** t_bang *x = (t_bang *)pd_new(bang_class); outlet_new(&x->x_obj, &s_bang); ! pd_set_newest((t_pd *)x); return (x); } --- 166,170 ---- t_bang *x = (t_bang *)pd_new(bang_class); outlet_new(&x->x_obj, &s_bang); ! newest = &x->x_obj.ob_pd; return (x); }
Index: SConscript =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/SConscript,v retrieving revision 1.1.4.61 retrieving revision 1.1.4.62 diff -C2 -d -r1.1.4.61 -r1.1.4.62 *** SConscript 30 Nov 2006 01:43:23 -0000 1.1.4.61 --- SConscript 17 Aug 2007 13:56:41 -0000 1.1.4.62 *************** *** 301,304 **** --- 301,305 ---- pa_stream.c pa_trace.c + pa_debugprint.c """) ) *************** *** 312,315 **** --- 313,317 ----
pmpath = pdenv['portmidipath'] + pdenv.Append(CPPDEFINES="NEWBUFFER")
pm_common_sources = map(lambda x: pmpath+x, *************** *** 414,417 **** --- 416,420 ---- /src/hostapi/oss/pa_unix_oss.c /src/hostapi/alsa/pa_linux_alsa.c + /src/common/pa_ringbuffer.c """) ) *************** *** 473,479 **** /src/os/mac_osx/pa_mac_hostapis.c /src/os/unix/pa_unix_util.c """) ) ! osx_sources = pa_sources + pa_common_sources + pa_osx_sources + pm_sources + pm_common_sources + pm_osx_sources + simd_ve_gcc_sources
osx_defs = Split("UNISTD PA_USE_COREAUDIO MACOSX") --- 476,487 ---- /src/os/mac_osx/pa_mac_hostapis.c /src/os/unix/pa_unix_util.c + /src/common/pa_ringbuffer.c """) ) ! osx_sources = pa_sources + pa_common_sources + pa_osx_sources + pm_sources + pm_common_sources + pm_osx_sources ! ! if pdenv['simd']: ! osx_sources += simd_sse_gcc_sources ! osx_sources += simd_ve_gcc_sources
osx_defs = Split("UNISTD PA_USE_COREAUDIO MACOSX") *************** *** 573,577 **** cflags += " -mfpmath=sse -mmmx -msse -fprefetch-loop-arrays" else: ! cflags += " -faltivec -maltivec"
if pdenv['PLATFORM'] == 'win32': --- 581,586 ---- cflags += " -mfpmath=sse -mmmx -msse -fprefetch-loop-arrays" else: ! pass ! # cflags += " -faltivec -maltivec"
if pdenv['PLATFORM'] == 'win32':
Index: m_atomic.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/m_atomic.h,v retrieving revision 1.1.2.1.2.1 retrieving revision 1.1.2.1.2.2 diff -C2 -d -r1.1.2.1.2.1 -r1.1.2.1.2.2 *** m_atomic.h 12 Jul 2005 15:11:10 -0000 1.1.2.1.2.1 --- m_atomic.h 17 Aug 2007 13:56:41 -0000 1.1.2.1.2.2 *************** *** 6,17 **** #if defined(__GNUC__) && (defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__))
/* gcc, x86 */ #define ATOMIC_INC(X) \ ! asm __volatile__("lock incl (%0) \n" \ : :"r"(X) :"memory")
#define ATOMIC_DEC(X) \ ! asm __volatile__("lock decl (%0) \n" \ : :"r"(X) :"memory")
--- 6,19 ---- #if defined(__GNUC__) && (defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__))
+ /* grrrr: for OSX >= 10.4 we could use the functions provided by the OS */ + /* gcc, x86 */ #define ATOMIC_INC(X) \ ! asm __volatile__("lock\n incl (%0) \n" \ : :"r"(X) :"memory")
#define ATOMIC_DEC(X) \ ! asm __volatile__("lock\n decl (%0) \n" \ : :"r"(X) :"memory")