From b1224f91730af6a729f7e7a428eb660a6d734926 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 20 Sep 2006 14:24:10 +0000 Subject: enabled templates for flext classes, inlined timer functions, some more ToOut/Sys methods fixed help name definition added flfeatures.h for compile-time version-specific feature detection changed eol-style adapted for pd-devel 0.39 minimal fix for timers cosmetic changes to calm the compiler changes for Mac/Intel svn path=/trunk/; revision=5979 --- externals/grill/flext/source/fltimer.cpp | 52 ++++++++------------------------ 1 file changed, 12 insertions(+), 40 deletions(-) (limited to 'externals/grill/flext/source/fltimer.cpp') diff --git a/externals/grill/flext/source/fltimer.cpp b/externals/grill/flext/source/fltimer.cpp index d9bf3cc1..6f13999f 100755 --- a/externals/grill/flext/source/fltimer.cpp +++ b/externals/grill/flext/source/fltimer.cpp @@ -25,31 +25,6 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif - -double flext::GetTime() -{ -#if FLEXT_SYS == FLEXT_SYS_PD - return clock_gettimesince(0)*0.001; -#elif FLEXT_SYS == FLEXT_SYS_MAX - double tm; - clock_getftime(&tm); - return tm*0.001; -#else - #error Not implemented -#endif -} - -double flext::GetTimeGrain() -{ -#if FLEXT_SYS == FLEXT_SYS_PD - return 0; -#elif FLEXT_SYS == FLEXT_SYS_MAX - return 0.001; -#else - #error Not implemented -#endif -} - #if FLEXT_OS == FLEXT_OS_WIN static double perffrq = 0; #endif @@ -246,9 +221,9 @@ bool flext::Timer::Delay(double tm,void *data) bool flext::Timer::Periodic(double tm,void *data) { userdata = data; - period = tm; + period = tm; #if FLEXT_SYS == FLEXT_SYS_PD - clock_delay(clk,tm*1000); + clock_delay(clk,tm*1000.); #elif FLEXT_SYS == FLEXT_SYS_MAX clock_fdelay(clk,tm*1000.); #else @@ -257,29 +232,26 @@ bool flext::Timer::Periodic(double tm,void *data) return true; } -/*! \brief Callback function for system clock. - \todo Make periodic events scheduled as such. -*/ +//! \brief Callback function for system clock. void flext::Timer::callback(Timer *tmr) { +#if FLEXT_SYS == FLEXT_SYS_MAX + if(tmr->queued) + qelem_set(tmr->qelem); + else +#endif + tmr->Work(); + if(tmr->period) { - // clearly it would be more precise if the periodic event is scheduled as such - // and not retriggered every time + // reschedule #if FLEXT_SYS == FLEXT_SYS_PD - clock_delay(tmr->clk,tmr->period*1000); + clock_delay(tmr->clk,tmr->period*1000.); #elif FLEXT_SYS == FLEXT_SYS_MAX clock_fdelay(tmr->clk,tmr->period*1000.); #else #error Not implemented #endif } - -#if FLEXT_SYS == FLEXT_SYS_MAX - if(tmr->queued) - qelem_set(tmr->qelem); - else -#endif - tmr->Work(); } #if FLEXT_SYS == FLEXT_SYS_MAX -- cgit v1.2.1