aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/openal_playback.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/openal_playback.cpp b/tests/openal_playback.cpp
index 4afa55fb..13d619e6 100644
--- a/tests/openal_playback.cpp
+++ b/tests/openal_playback.cpp
@@ -2,6 +2,28 @@
#include <stdlib.h>
#include <AL/al.h>
#include <AL/alc.h>
+#include <assert.h>
+#include <emscripten.h>
+
+void playSource(void* arg)
+{
+ ALuint source = reinterpret_cast<ALuint>(arg);
+ ALint state;
+ alGetSourcei(source, AL_SOURCE_STATE, &state);
+ assert(state == AL_PLAYING);
+ alSourcePause(source);
+ alGetSourcei(source, AL_SOURCE_STATE, &state);
+ assert(state == AL_PAUSED);
+ alSourcePlay(source);
+ alGetSourcei(source, AL_SOURCE_STATE, &state);
+ assert(state == AL_PLAYING);
+ alSourceStop(source);
+ alGetSourcei(source, AL_SOURCE_STATE, &state);
+ assert(state == AL_STOPPED);
+
+ int result = 1;
+ REPORT_RESULT();
+}
int main() {
ALCdevice* device = alcOpenDevice(NULL);
@@ -78,10 +100,16 @@ int main() {
alSourcei(sources[0], AL_BUFFER, buffers[0]);
+ ALint state;
+ alGetSourcei(sources[0], AL_SOURCE_STATE, &state);
+ assert(state == AL_INITIAL);
+
alSourcePlay(sources[0]);
- int result = 1;
- REPORT_RESULT();
+ alGetSourcei(sources[0], AL_SOURCE_STATE, &state);
+ assert(state == AL_PLAYING);
+
+ emscripten_async_call(playSource, reinterpret_cast<void*>(sources[0]), 700);
return 0;
}