diff options
author | Chris Robinson <[email protected]> | 2015-12-04 19:09:48 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-12-04 19:09:48 -0800 |
commit | 482372577e6eaa9f4b857dc3a335e67efd1ee367 (patch) | |
tree | 0c025eae5873f32d1dcf641a675c3d95a4eb1dd3 /examples | |
parent | 4e6acfa0d549281efcbe8293d95b76a37deb370d (diff) |
Avoid using usleep in the examples
We already have an al_nssleep wrapper in the common lib we can use.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/alhrtf.c | 2 | ||||
-rw-r--r-- | examples/allatency.c | 2 | ||||
-rw-r--r-- | examples/alloopback.c | 2 | ||||
-rw-r--r-- | examples/alreverb.c | 2 | ||||
-rw-r--r-- | examples/alstream.c | 2 | ||||
-rw-r--r-- | examples/altonegen.c | 2 | ||||
-rw-r--r-- | examples/common/alhelpers.h | 10 |
7 files changed, 8 insertions, 14 deletions
diff --git a/examples/alhrtf.c b/examples/alhrtf.c index 6dac5308..b18a5115 100644 --- a/examples/alhrtf.c +++ b/examples/alhrtf.c @@ -227,7 +227,7 @@ int main(int argc, char **argv) angle = 0.0; alSourcePlay(source); do { - Sleep(10); + al_nssleep(10000000); /* Rotate the source around the listener by about 1/4 cycle per second. * Only affects mono sounds. diff --git a/examples/allatency.c b/examples/allatency.c index deb13d3b..afef43ca 100644 --- a/examples/allatency.c +++ b/examples/allatency.c @@ -182,7 +182,7 @@ int main(int argc, char **argv) /* Play the sound until it finishes. */ alSourcePlay(source); do { - Sleep(10); + al_nssleep(10000000); alGetSourcei(source, AL_SOURCE_STATE, &state); /* Get the source offset and latency. AL_SEC_OFFSET_LATENCY_SOFT will diff --git a/examples/alloopback.c b/examples/alloopback.c index 04c92818..c5dee36d 100644 --- a/examples/alloopback.c +++ b/examples/alloopback.c @@ -216,7 +216,7 @@ int main(int argc, char *argv[]) /* Play the sound until it finishes. */ alSourcePlay(source); do { - Sleep(10); + al_nssleep(10000000); alGetSourcei(source, AL_SOURCE_STATE, &state); } while(alGetError() == AL_NO_ERROR && state == AL_PLAYING); diff --git a/examples/alreverb.c b/examples/alreverb.c index 420b1c55..7d2bb343 100644 --- a/examples/alreverb.c +++ b/examples/alreverb.c @@ -311,7 +311,7 @@ int main(int argc, char **argv) /* Play the sound until it finishes. */ alSourcePlay(source); do { - Sleep(10); + al_nssleep(10000000); alGetSourcei(source, AL_SOURCE_STATE, &state); } while(alGetError() == AL_NO_ERROR && state == AL_PLAYING); diff --git a/examples/alstream.c b/examples/alstream.c index 2972d375..63478d6a 100644 --- a/examples/alstream.c +++ b/examples/alstream.c @@ -318,7 +318,7 @@ int main(int argc, char **argv) } while(UpdatePlayer(player)) - Sleep(10); + al_nssleep(10000000); /* All done with this file. Close it and go to the next */ ClosePlayerFile(player); diff --git a/examples/altonegen.c b/examples/altonegen.c index 65980529..74a04ee2 100644 --- a/examples/altonegen.c +++ b/examples/altonegen.c @@ -246,7 +246,7 @@ int main(int argc, char *argv[]) alSourcePlay(source); do { ALint pos; - Sleep(10); + al_nssleep(10000000); alGetSourcei(source, AL_SAMPLE_OFFSET, &pos); alGetSourcei(source, AL_SOURCE_STATE, &state); if(pos < last_pos && state == AL_PLAYING) diff --git a/examples/common/alhelpers.h b/examples/common/alhelpers.h index 62ed5be2..1b4d2fbf 100644 --- a/examples/common/alhelpers.h +++ b/examples/common/alhelpers.h @@ -1,18 +1,12 @@ #ifndef ALHELPERS_H #define ALHELPERS_H -#ifndef _WIN32 -#include <unistd.h> -#define Sleep(x) usleep((x)*1000) -#else -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#endif - #include "AL/alc.h" #include "AL/al.h" #include "AL/alext.h" +#include "threads.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ |