/*---------------------------------------------------------------------------- MCD-X: General API for audio/graphics/interaction programming (sibling of MCD-Y API) http://www.gewang.com/software/mcd-api/ Copyright (c) 2007-present Ge Wang All rights reserved. http://www.gewang.com/ Music, Computing, Design Group @ CCRMA, Stanford University http://ccrma.stanford.edu/groups/mcd/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 U.S.A. -----------------------------------------------------------------------------*/ //----------------------------------------------------------------------------- // name: x-def.h // desc: general defs // // authors: Ge Wang (ge@ccrma.stanford.edu) // Jieun Oh (jieun5@ccrma.stanford.edu) // adapted from ChucK audio programming language // date: Spring 2010 // // Stanford Mobile Phone Orchestra // http://mopho.stanford.edu/ //----------------------------------------------------------------------------- #ifndef __MCD_X_DEF_H__ #define __MCD_X_DEF_H__ #include #include #include // bool #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #define ONE_PI (3.14159265358979323846) #define TWO_PI (2.0 * ONE_PI) #define SQRT2 (1.41421356237309504880) #define PI_OVER_180 (ONE_PI / 180.0) #ifndef SAFE_DELETE #define SAFE_DELETE(x) do { if(x){ delete x; x = NULL; } } while(0) #define SAFE_DELETE_ARRAY(x) do { if(x){ delete [] x; x = NULL; } } while(0) #endif #if defined(__MACOSX_CORE__) || defined(__APPLE__) #define __PLATFORM_MACOSX__ #endif #if defined(__LINUX_ALSA__) || defined(__LINUX_JACK__) || defined(__LINUX_OSS__) #define __PLATFORM_LINUX__ #endif #ifdef __PLATFORM_WIN32__ #include #ifndef usleep #define usleep(x) Sleep( (x / 1000 <= 0 ? 1 : x / 1000) ) #endif #pragma warning (disable : 4996) // stdio deprecation #pragma warning (disable : 4786) // stl debug info #pragma warning (disable : 4312) // type casts from void* #pragma warning (disable : 4311) // type casts to void* #pragma warning (disable : 4244) // truncation #pragma warning (disable : 4068) // unknown pragma #else #include #endif #endif