From 18230ab52e858c7cb21b7685cff05f05bd9d864e Mon Sep 17 00:00:00 2001 From: carmen rocco Date: Sun, 30 May 2004 05:20:01 +0000 Subject: trying out the roast of these NT Tweak . svn path=/trunk/externals/unauthorized/; revision=1793 --- blinkenlights/blinkenlights.c | 3 --- cooled~/cooled~.c | 11 ++++++++++- countund/countund.c | 3 --- exciter/exciter.c | 20 ++++++++++++++++---- filterbank~/filterbank~.c | 1 + probalizer/probalizer.c | 1 + randomblock~/randomblock~.c | 3 --- scratcher~/scratcher~.c | 29 ++++++++++++++++++++++++++--- sonogram~/sonogram~-yves.c | 7 ++++++- sonogram~/sonogram~.c | 7 ++++++- 10 files changed, 66 insertions(+), 19 deletions(-) diff --git a/blinkenlights/blinkenlights.c b/blinkenlights/blinkenlights.c index 4281a41..b99d57d 100644 --- a/blinkenlights/blinkenlights.c +++ b/blinkenlights/blinkenlights.c @@ -40,9 +40,6 @@ #endif #include #include -#include -#include -#include #include #include diff --git a/cooled~/cooled~.c b/cooled~/cooled~.c index 51e97f3..1e67ad3 100644 --- a/cooled~/cooled~.c +++ b/cooled~/cooled~.c @@ -43,7 +43,11 @@ #include #endif #ifdef NT -#define M_PI 3.14159265358979323846 +#include +int usleep (unsigned int us) { + Sleep((long)(us/1000.)); + return 0; +} #endif #include @@ -1363,8 +1367,13 @@ void cooled_tilde_setup(void) cooled_widgetbehavior.w_deletefn = cooled_delete; cooled_widgetbehavior.w_visfn = cooled_vis; cooled_widgetbehavior.w_clickfn = cooled_click; +#if PD_MINOR_VERSION >= 37 + class_setpropertiesfn(cooled_class, cooled_properties); + class_setsavefn(cooled_class, cooled_save); +#else cooled_widgetbehavior.w_propertiesfn = cooled_properties; cooled_widgetbehavior.w_savefn = cooled_save; +#endif CLASS_MAINSIGNALIN( cooled_class, t_cooled, x_f ); class_addmethod(cooled_class, (t_method)cooled_dsp, gensym("dsp"), A_NULL); diff --git a/countund/countund.c b/countund/countund.c index ac21f8e..0d554a2 100644 --- a/countund/countund.c +++ b/countund/countund.c @@ -37,9 +37,6 @@ #endif #include #include -#include -#include -#include #include #include diff --git a/exciter/exciter.c b/exciter/exciter.c index 0faf3d4..16c584f 100644 --- a/exciter/exciter.c +++ b/exciter/exciter.c @@ -37,8 +37,6 @@ #include #include #include -#include - #include #include "m_imp.h" @@ -48,7 +46,10 @@ #ifdef NT #include +#include +#include #else +#include #include #endif @@ -687,16 +688,27 @@ static t_int *exciter_perform(t_int *w) t_int ei, gi; t_int gstart, gend; t_exciter* x = (t_exciter*)(w[1]); +#ifdef NT + time_t et; + struct _timeb tv; +#else struct timeval tv; struct timezone tz; +#endif long long looptime = 0L; double preltime = x->x_reltime; if ( x->x_started ) { // get current time in ms - gettimeofday( &tv, &tz ); - looptime = tv.tv_sec*1000 + tv.tv_usec/1000; +#ifdef NT + time( &et ); + _ftime( &tv ); + looptime = et*1000 + tv.millitm; +#else + gettimeofday( &tv, &tz ); + looptime = tv.tv_sec*1000 + tv.tv_usec/1000; +#endif if ( x->x_plooptime == 0L ) { x->x_plooptime = looptime; diff --git a/filterbank~/filterbank~.c b/filterbank~/filterbank~.c index 2ef8dad..09dcb8f 100644 --- a/filterbank~/filterbank~.c +++ b/filterbank~/filterbank~.c @@ -35,6 +35,7 @@ #ifdef NT #include +#define random rand #else #include #endif diff --git a/probalizer/probalizer.c b/probalizer/probalizer.c index cae6178..973e1d2 100644 --- a/probalizer/probalizer.c +++ b/probalizer/probalizer.c @@ -43,6 +43,7 @@ #ifdef NT #include +#define random rand #else #include #endif diff --git a/randomblock~/randomblock~.c b/randomblock~/randomblock~.c index c5ca687..9fbbc2c 100644 --- a/randomblock~/randomblock~.c +++ b/randomblock~/randomblock~.c @@ -37,9 +37,6 @@ #endif #include #include -#include -#include -#include #include #include diff --git a/scratcher~/scratcher~.c b/scratcher~/scratcher~.c index 1045ff0..87be8a2 100644 --- a/scratcher~/scratcher~.c +++ b/scratcher~/scratcher~.c @@ -48,7 +48,8 @@ #include #endif #ifdef NT -#define M_PI 3.14159265358979323846 +#include +#include #endif #include @@ -325,8 +326,13 @@ static void scratcher_displace(t_gobj *z, t_glist *glist, int dx, int dy) static void scratcher_motion(t_scratcher *x, t_floatarg dx, t_floatarg dy) { +#ifdef NT + time_t et; + struct _timeb tv; +#else struct timeval tv; struct timezone tz; +#endif // post( "scratcher_motion dx=%f dy=%f", dx, dy ); @@ -334,8 +340,14 @@ static void scratcher_motion(t_scratcher *x, t_floatarg dx, t_floatarg dy) x->x_mousemoved = 1; // get current time in ms +#ifdef NT + time( &et ); + _ftime( &tv ); + x->x_lastmovetime = et*1000 + tv.millitm; +#else gettimeofday( &tv, &tz ); x->x_lastmovetime = tv.tv_sec*1000 + tv.tv_usec/1000; +#endif // post( "scratcher~ : move time : %ld", x->x_lastmovetime ); if ( x->x_showspeed ) @@ -477,8 +489,13 @@ static t_int *scratcher_perform(t_int *w) t_float *out = (t_float *)(w[2]); t_int n = (int)(w[3]); /* number of samples */ t_scratcher *x = (t_scratcher *)(w[4]); +#ifdef NT + time_t et; + struct _timeb tv; +#else struct timeval tv; struct timezone tz; +#endif long long perftime = 0L; x->x_readspeed += x->x_speedinc; @@ -497,8 +514,14 @@ static t_int *scratcher_perform(t_int *w) if ( x->x_mousemoved ) { // get current time in ms - gettimeofday( &tv, &tz ); - perftime = tv.tv_sec*1000 + tv.tv_usec/1000; +#ifdef NT + time( &et ); + _ftime( &tv ); + perftime = et*1000 + tv.millitm; +#else + gettimeofday( &tv, &tz ); + perftime = tv.tv_sec*1000 + tv.tv_usec/1000; +#endif if ( perftime - x->x_lastmovetime > SCRATCHER_MOVE_TIMEOUT ) { // post( "scratcher~ : mouse timeout (m=%ld)", perftime ); diff --git a/sonogram~/sonogram~-yves.c b/sonogram~/sonogram~-yves.c index 02e5f47..df957b1 100644 --- a/sonogram~/sonogram~-yves.c +++ b/sonogram~/sonogram~-yves.c @@ -46,7 +46,12 @@ #include #endif #ifdef NT -#define M_PI 3.14159265358979323846 +#define random rand +#include +static int usleep (unsigned int us) { + Sleep((long)(us/1000.)); + return 0; +} #endif #include diff --git a/sonogram~/sonogram~.c b/sonogram~/sonogram~.c index a0b8472..7a41da7 100644 --- a/sonogram~/sonogram~.c +++ b/sonogram~/sonogram~.c @@ -44,7 +44,12 @@ #include #endif #ifdef NT -#define M_PI 3.14159265358979323846 +#define random rand +#include +static int usleep (unsigned int us) { + Sleep((long)(us/1000.)); + return 0; +} #endif #include -- cgit v1.2.1