diff options
author | Chris Robinson <[email protected]> | 2008-01-11 17:19:08 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2008-01-11 17:19:08 -0800 |
commit | 3bbbf8a025c66367fdb19dce70c9a2b6505725f4 (patch) | |
tree | 4a1e7d433689989de8cd314b8796466a2f029192 /OpenAL32/Include/alMain.h | |
parent | 312108a0d32190289a1e59a3797b7075d6d745d3 (diff) | |
parent | 978764cb6b84d78187badf9d8d5b7177d047654f (diff) |
Merge branch 'master' into efx-experiment
Diffstat (limited to 'OpenAL32/Include/alMain.h')
-rw-r--r-- | OpenAL32/Include/alMain.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index a1857c97..ce5c5be9 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -13,6 +13,9 @@ #include <assert.h> #include <pthread.h> +#include <sys/time.h> +#include <time.h> +#include <errno.h> #define IsBadWritePtr(a,b) (0) @@ -52,6 +55,30 @@ static inline void DeleteCriticalSection(CRITICAL_SECTION *cs) assert(ret == 0); } +/* NOTE: This wrapper isn't quite accurate as it returns an ALuint, as opposed + * to the expected DWORD. Both are defined as unsigned 32-bit types, however. + * Additionally, Win32 is supposed to measure the time since Windows started, + * as opposed to the actual time. */ +static inline ALuint timeGetTime(void) +{ + struct timeval tv; + int ret; + + ret = gettimeofday(&tv, NULL); + assert(ret == 0); + + return tv.tv_usec/1000 + tv.tv_sec*1000; +} + +static inline void Sleep(ALuint t) +{ + struct timespec tv, rem; + tv.tv_nsec = (t*1000000)%1000000000; + tv.tv_sec = t/1000; + + while(nanosleep(&tv, &rem) == -1 && errno == EINTR) + tv = rem; +} #define min(x,y) (((x)<(y))?(x):(y)) #define max(x,y) (((x)>(y))?(x):(y)) #endif @@ -123,6 +150,7 @@ void alc_alsa_init(BackendFuncs *func_list); void alc_oss_init(BackendFuncs *func_list); void alcDSoundInit(BackendFuncs *func_list); void alcWinMMInit(BackendFuncs *FuncList); +void alc_wave_init(BackendFuncs *func_list); struct ALCdevice_struct |