diff -r fdb76012b688 -r c8b1fb10003c openalbridge/common.h --- a/openalbridge/common.h Thu Oct 15 15:49:42 2009 +0000 +++ b/openalbridge/common.h Thu Oct 15 15:54:48 2009 +0000 @@ -17,8 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ifndef COMMON_H -#define COMMON_H + #include #include @@ -39,6 +38,9 @@ #define LOG_ERR 3 #endif +#ifndef COMMON_H +#define COMMON_H + /* magics */ #define OGG_FILE_FORMAT 0x4F676753 #define WAV_FILE_FORMAT 0x52494646 @@ -77,6 +79,30 @@ #define ENDIAN_BIG_16(x) x #endif +/** 1.0 02/03/10 - Defines cross-platform sleep, usleep, etc. [Wu Yongwei] **/ +#ifndef _SLEEP_H +#define _SLEEP_H +#ifdef _WIN32 +# if defined(_NEED_SLEEP_ONLY) && (defined(_MSC_VER) || defined(__MINGW32__)) +# include +# define sleep(t) _sleep((t) * 1000) +# else +# define WIN32_LEAN_AND_MEAN +# include +# define sleep(t) Sleep((t) * 1000) +# endif +# ifndef _NEED_SLEEP_ONLY +# define msleep(t) Sleep(t) +# define usleep(t) Sleep((t) / 1000) +# endif +#else +# include +# ifndef _NEED_SLEEP_ONLY +# define msleep(t) usleep((t) * 1000) +# endif +#endif +#endif /* _SLEEP_H */ + #pragma pack(1) typedef struct _WAV_header_t { uint32_t ChunkID;