From 97926eb08cf74f277e522ffb8c7f985457822de3 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 11 Feb 2003 04:37:35 +0000 Subject: "" svn path=/trunk/; revision=388 --- externals/grill/flext/source/flutil.cpp | 36 +++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'externals/grill/flext/source/flutil.cpp') diff --git a/externals/grill/flext/source/flutil.cpp b/externals/grill/flext/source/flutil.cpp index 1b1d929a..9be38cf1 100644 --- a/externals/grill/flext/source/flutil.cpp +++ b/externals/grill/flext/source/flutil.cpp @@ -17,9 +17,9 @@ WARRANTIES, see the file, "license.txt," in this distribution. #if FLEXT_OS == FLEXT_OS_WIN #include -#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || defined(__GNUC__) +#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_OSX #include -#elif FLEXT_OS == FLEXT_OS_MACOS +#elif FLEXT_OS == FLEXT_OS_MAC #include #include #endif @@ -34,13 +34,41 @@ void flext::ZeroMem(void *dst,int bytes) memset(dst,0,bytes); } +void flext::CopySamples(t_sample *dst,const t_sample *src,int cnt) +{ + int n = cnt>>3; + cnt -= n<<3; + while(n--) { + 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]; + src += 8,dst += 8; + } + + while(cnt--) *(dst++) = *(src++); +} + +void flext::SetSamples(t_sample *dst,int cnt,t_sample s) +{ + int n = cnt>>3; + cnt -= n<<3; + while(n--) { + dst[0] = dst[1] = dst[2] = dst[3] = dst[4] = dst[5] = dst[6] = dst[7] = s; + dst += 8; + } + + while(cnt--) *(dst++) = s; +} + + void flext::Sleep(double s) { #if FLEXT_OS == FLEXT_OS_WIN ::Sleep((long)(s*1000.)); -#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || defined(__GNUC__) +#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_OSX usleep((long)(s*1000000.)); -#elif FLEXT_OS == FLEXT_OS_MACOS +#elif FLEXT_OS == FLEXT_OS_MAC // that's just for OS9! UnsignedWide tick; Microseconds(&tick); -- cgit v1.2.1