aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS2
-rw-r--r--src/library_openal.js39
-rw-r--r--tests/freealut/AUTHORS14
-rw-r--r--tests/freealut/CMakeLists.txt208
-rw-r--r--tests/freealut/COPYING483
-rw-r--r--tests/freealut/ChangeLog786
-rw-r--r--tests/freealut/INSTALL236
-rw-r--r--tests/freealut/Makefile.am57
-rw-r--r--tests/freealut/Makefile.in690
-rw-r--r--tests/freealut/NEWS34
-rw-r--r--tests/freealut/README188
-rw-r--r--tests/freealut/aclocal.m46886
-rw-r--r--tests/freealut/admin/CMakeModules/FindCompilerAttribute.cmake11
-rw-r--r--tests/freealut/admin/CMakeModules/FindCompilerFlagsSet.cmake34
-rw-r--r--tests/freealut/admin/CMakeModules/FindCompilerVisibility.cmake37
-rw-r--r--tests/freealut/admin/CMakeModules/FindConfigHelper.cmake22
-rw-r--r--tests/freealut/admin/CMakeModules/FindSleepFunction.cmake40
-rw-r--r--tests/freealut/admin/Makefile.am2
-rw-r--r--tests/freealut/admin/Makefile.in484
-rw-r--r--tests/freealut/admin/RPM/freealut.spec103
-rw-r--r--tests/freealut/admin/RPM/freealut.spec.in103
-rw-r--r--tests/freealut/admin/VisualStudio6/alut.dsw59
-rw-r--r--tests/freealut/admin/VisualStudio6/alut/alut.dsp150
-rw-r--r--tests/freealut/admin/VisualStudio6/hello_world/hello_world.dsp93
-rw-r--r--tests/freealut/admin/VisualStudio6/playfile/playfile.dsp93
-rw-r--r--tests/freealut/admin/VisualStudioDotNET/alut.sln35
-rw-r--r--tests/freealut/admin/VisualStudioDotNET/alut/alut.vcproj161
-rw-r--r--tests/freealut/admin/VisualStudioDotNET/hello_world/hello_world.vcproj118
-rw-r--r--tests/freealut/admin/VisualStudioDotNET/playfile/playfile.vcproj118
-rw-r--r--tests/freealut/admin/autotools/.indent.pro46
-rwxr-xr-xtests/freealut/admin/autotools/compile142
-rwxr-xr-xtests/freealut/admin/autotools/config.guess1469
-rwxr-xr-xtests/freealut/admin/autotools/config.sub1563
-rwxr-xr-xtests/freealut/admin/autotools/depcomp529
-rwxr-xr-xtests/freealut/admin/autotools/install-sh323
-rw-r--r--tests/freealut/admin/autotools/ltmain.sh6460
-rw-r--r--tests/freealut/admin/autotools/m4/alut_c__attribute.m416
-rw-r--r--tests/freealut/admin/autotools/m4/alut_check_cflags_wall.m4120
-rw-r--r--tests/freealut/admin/autotools/m4/alut_check_flag.m428
-rw-r--r--tests/freealut/admin/autotools/m4/alut_check_func.m415
-rw-r--r--tests/freealut/admin/autotools/m4/alut_eval_stderr.m411
-rwxr-xr-xtests/freealut/admin/autotools/missing357
-rw-r--r--tests/freealut/admin/pkgconfig/Makefile.am3
-rw-r--r--tests/freealut/admin/pkgconfig/Makefile.in388
-rw-r--r--tests/freealut/admin/pkgconfig/freealut-config.in174
-rw-r--r--tests/freealut/admin/pkgconfig/freealut.pc.in11
-rwxr-xr-xtests/freealut/autogen.sh2
-rw-r--r--tests/freealut/config.h.in116
-rwxr-xr-xtests/freealut/configure22839
-rw-r--r--tests/freealut/configure.ac219
-rw-r--r--tests/freealut/doc/alut.css45
-rw-r--r--tests/freealut/doc/alut.html1399
-rw-r--r--tests/freealut/examples/Makefile.am8
-rw-r--r--tests/freealut/examples/Makefile.in451
-rw-r--r--tests/freealut/examples/hello_world.c23
-rw-r--r--tests/freealut/examples/playfile.c81
-rw-r--r--tests/freealut/include/AL/alut.h133
-rw-r--r--tests/freealut/include/Makefile.am1
-rw-r--r--tests/freealut/include/Makefile.in408
-rw-r--r--tests/freealut/src/Makefile.am32
-rw-r--r--tests/freealut/src/Makefile.in584
-rw-r--r--tests/freealut/src/README13
-rw-r--r--tests/freealut/src/alutBufferData.c136
-rw-r--r--tests/freealut/src/alutCodec.c119
-rw-r--r--tests/freealut/src/alutError.c92
-rw-r--r--tests/freealut/src/alutInit.c154
-rw-r--r--tests/freealut/src/alutInputStream.c236
-rw-r--r--tests/freealut/src/alutInternal.h121
-rw-r--r--tests/freealut/src/alutLoader.c493
-rw-r--r--tests/freealut/src/alutOutputStream.c89
-rw-r--r--tests/freealut/src/alutUtil.c141
-rw-r--r--tests/freealut/src/alutVersion.c11
-rw-r--r--tests/freealut/src/alutWaveform.c912
-rw-r--r--tests/freealut/src/helloworld.wavbin0 -> 65462 bytes
-rw-r--r--tests/freealut/test_suite/Makefile.am27
-rw-r--r--tests/freealut/test_suite/Makefile.in513
-rw-r--r--tests/freealut/test_suite/README33
-rw-r--r--tests/freealut/test_suite/file1.wavbin0 -> 6246 bytes
-rw-r--r--tests/freealut/test_suite/file2.aubin0 -> 6400 bytes
-rw-r--r--tests/freealut/test_suite/file3.raw1
-rw-r--r--tests/freealut/test_suite/test_errorstuff.c23
-rw-r--r--tests/freealut/test_suite/test_fileloader.c74
-rw-r--r--tests/freealut/test_suite/test_memoryloader.c98
-rw-r--r--tests/freealut/test_suite/test_retrostuff.c79
-rw-r--r--tests/freealut/test_suite/test_version.c36
-rw-r--r--tests/freealut/test_suite/test_waveforms.c31
-rwxr-xr-xtests/runner.py6
87 files changed, 52710 insertions, 10 deletions
diff --git a/AUTHORS b/AUTHORS
index 438a13ff..b6770265 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -58,5 +58,3 @@ a license to everyone to use it as detailed in LICENSE.)
* Felix H. Dahlke <fhd@ubercode.de>
* Éloi Rivard <azmeuk@gmail.com>
* Alexander Gladysh <ag@logiceditor.com>
-
-
diff --git a/src/library_openal.js b/src/library_openal.js
index 0b6e9b2f..6a97fce7 100644
--- a/src/library_openal.js
+++ b/src/library_openal.js
@@ -13,11 +13,30 @@ var LibraryOpenAL = {
alcMakeContextCurrent: function(context) {
if (context == 0) {
AL.currentContext = null;
+ return 0;
} else {
AL.currentContext = AL.contexts[context - 1];
+ return 1;
}
},
+ alcGetContextsDevice: function(context) {
+ if (context <= AL.contexts.length && context > 0) {
+ // Returns the only one audio device
+ return 1;
+ }
+ return 0;
+ },
+
+ alcGetCurrentContext: function() {
+ for (var i = 0; i < AL.contexts.length; ++i) {
+ if (AL.contexts[i] == AL.currentContext) {
+ return i + 1;
+ }
+ }
+ return 0;
+ },
+
alcDestroyContext: function(context) {
// Stop playback, etc
},
@@ -167,7 +186,9 @@ var LibraryOpenAL = {
}
switch (param) {
case 0x100A /* AL_GAIN */:
- AL.currentContext.src[source - 1].gain.gain.value = value;
+ if (AL.currentContext.src[source - 1]) {
+ AL.currentContext.src[source - 1].gain.gain.value = value;
+ }
break;
case 0x1003 /* AL_PITCH */:
#if OPENAL_DEBUG
@@ -291,14 +312,16 @@ var LibraryOpenAL = {
}
for (var i = 0; i < count; ++i) {
var bufferIdx = {{{ makeGetValue('buffers', 'i*4', 'i32') }}} - 1;
- var buffer = AL.currentContext.buf[bufferIdx].buf;
- for (var j = 0; j < AL.currentContext.src.length; ++j) {
- if (buffer == AL.currentContext.src[j].buffer) {
- AL.currentContext.err = 0xA004 /* AL_INVALID_OPERATION */;
- return;
+ if (bufferIdx < AL.currentContext.buf.length && AL.currentContext.buf[bufferIdx]) {
+ var buffer = AL.currentContext.buf[bufferIdx].buf;
+ for (var j = 0; j < AL.currentContext.src.length; ++j) {
+ if (buffer == AL.currentContext.src[j].buffer) {
+ AL.currentContext.err = 0xA004 /* AL_INVALID_OPERATION */;
+ return;
+ }
}
+ delete AL.currentContext.buf[bufferIdx];
}
- delete AL.currentContext.buf[bufferIdx];
}
},
@@ -424,7 +447,7 @@ var LibraryOpenAL = {
#endif
return;
}
- if ("src" in AL.currentContext.src[source - 1]) {
+ if (AL.currentContext.src[source - 1] && "src" in AL.currentContext.src[source - 1]) {
AL.currentContext.src[source - 1]["src"].stop(0);
delete AL.currentContext.src[source - 1]["src"];
}
diff --git a/tests/freealut/AUTHORS b/tests/freealut/AUTHORS
new file mode 100644
index 00000000..92890c93
--- /dev/null
+++ b/tests/freealut/AUTHORS
@@ -0,0 +1,14 @@
+Steve Baker <sjbaker1@airmail.net>
+ Initial version of the sources and the specification
+
+Sven Panne <sven.panne@aedion.de>
+ Build system
+ General hacking
+ Specification maintenance
+
+Erik Hofman <erik@ehofman.com>
+ Fixes and additions to the sound file loaders
+ playfile demo
+
+Prakash Punnoor <prakash@punnoor.de>
+ CMake build system
diff --git a/tests/freealut/CMakeLists.txt b/tests/freealut/CMakeLists.txt
new file mode 100644
index 00000000..640f35bf
--- /dev/null
+++ b/tests/freealut/CMakeLists.txt
@@ -0,0 +1,208 @@
+# cmake project file by Prakash Punnoor
+CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
+
+SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/admin/CMakeModules")
+PROJECT(Alut C)
+SET(PACKAGE "freealut")
+SET(PACKAGE_TARNAME "freealut")
+SET(PACKAGE_NAME "freealut library")
+SET(PACKAGE_MAJOR_VERSION "1")
+SET(PACKAGE_MINOR_VERSION "0")
+SET(PACKAGE_BUILD_VERSION "1")
+SET(PACKAGE_VERSION "${PACKAGE_MAJOR_VERSION}.${PACKAGE_MINOR_VERSION}.${PACKAGE_BUILD_VERSION}")
+SET(MAJOR_VERSION "0")
+SET(MINOR_VERSION "0")
+SET(BUILD_VERSION "0")
+SET(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_VERSION}")
+SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+SET(PACKAGE_BUGREPORT "openal-devel@opensource.creative.com")
+SET(OPERATING_SYSTEM "${CMAKE_SYSTEM_NAME}")
+
+INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
+INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake)
+INCLUDE(${CMAKE_ROOT}/Modules/CheckCSourceCompiles.cmake)
+
+FIND_PACKAGE(ConfigHelper)
+
+SET(ALUT_SOURCES src/alutBufferData.c
+ src/alutCodec.c
+ src/alutError.c
+ src/alutInit.c
+ src/alutInputStream.c
+ src/alutInternal.h
+ src/alutLoader.c
+ src/alutOutputStream.c
+ src/alutUtil.c
+ src/alutVersion.c
+ src/alutWaveform.c)
+
+INCLUDE_DIRECTORIES(${Alut_SOURCE_DIR}/include)
+
+SET(ADD_WFLAGS "")
+SET(ADD_CFLAGS "")
+SET(ADD_LDFLAGS "")
+SET(ADD_LIBS "")
+
+OPTION(BUILD_STATIC "build static library too" ON)
+OPTION(PROFILE "enable profile" OFF)
+OPTION(OPTIMIZATION "enable optimization" ON)
+OPTION(WARNINGS "enable warnings" ON)
+IF(WARNINGS)
+ OPTION(MORE_WARNINGS "enable more warnings" OFF)
+ OPTION(USE_WERROR "enable fail on all warning" OFF)
+ENDIF(WARNINGS)
+
+#want test-suit?
+OPTION(BUILD_TESTS "build the test-suite" OFF)
+
+
+ADD_DEFINE(ALUT_BUILD_LIBRARY)
+# We could possibly need struct timespec and random(), which are not ANSI.
+# Define to 500 if Single Unix conformance is wanted, 600 for sixth revision.
+ADD_DEFINE("_XOPEN_SOURCE 500")
+# We might need nanosleep, which is a POSIX IEEE Std 1003.1b-1993 feature.
+# Define to the POSIX version that should be used.
+ADD_DEFINE("_POSIX_C_SOURCE 199309")
+# Without __NO_CTYPE tolower and friends are macros which introduce a GLIBC 2.3
+# dependency. By defining this identifier we are currently backwards compatible
+# to GLIBC 2.1.3, which is a good thing. In addition, the macros lead to code
+# which triggers warnings with -Wunreachable-code.
+ADD_DEFINE("__NO_CTYPE 1")
+
+ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+ADD_DEFINITIONS(-DNDEBUG)
+
+FIND_LIBRARY(OPENAL_LIB NAMES openal openal32 PATHS /usr/lib /usr/local/lib ${OPENAL_LIB_DIR})
+IF(OPENAL_LIB MATCHES "NOTFOUND")
+ MESSAGE(FATAL_ERROR "OpenAL not installed, cannot build alut - aborting.")
+ENDIF(OPENAL_LIB MATCHES "NOTFOUND")
+
+IF(UNIX)
+ SET(ADD_LIBS ${ADD_LIBS} m)
+ENDIF(UNIX)
+
+SET(CMAKE_REQUIRED_INCLUDES ${OPENAL_INCLUDE_DIR})
+CHECK_INCLUDE_FILES("AL/alc.h;AL/al.h" AL_HEADERS)
+IF(NOT AL_HEADERS)
+ MESSAGE(FATAL_ERROR "OpenAL header files not found - aborting.")
+ENDIF(NOT AL_HEADERS)
+
+IF(DEFINED OPENAL_INCLUDE_DIR)
+ INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
+ENDIF(DEFINED OPENAL_INCLUDE_DIR)
+
+FIND_PACKAGE(SleepFunction)
+
+CHECK_INCLUDE_FILE_DEFINE(stdint.h HAVE_STDINT_H)
+
+IF(WIN32)
+ CHECK_INCLUDE_FILE_DEFINE(basetsd.h HAVE_BASETSD_H)
+ENDIF(WIN32)
+
+# FindSleepFunction will check for unistd.h if time.h wasn't found
+IF(HAVE_TIME_H)
+ CHECK_INCLUDE_FILE_DEFINE(unistd.h HAVE_UNISTD_H)
+ENDIF(HAVE_TIME_H)
+
+IF(HAVE_UNISTD_H)
+ CHECK_FUNCTION_DEFINE("
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+ " stat "(\"\", (struct stat*)0)" HAVE_STAT)
+ENDIF(HAVE_UNISTD_H)
+
+IF(NOT HAVE_STAT)
+ CHECK_FUNCTION_DEFINE("
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ " _stat "(\"\", (struct _stat*)0)" HAVE__STAT)
+ENDIF(NOT HAVE_STAT)
+
+# compiler specific settings
+FIND_PACKAGE(CompilerAttribute)
+FIND_PACKAGE(CompilerVisibility)
+FIND_PACKAGE(CompilerFlagsSet)
+
+GENERATE_CONFIG_H()
+
+SET(CMAKE_C_FLAGS "${ADD_WFLAGS} ${ADD_CFLAGS} ${CMAKE_C_FLAGS}")
+SET(CMAKE_CXX_FLAGS "${ADD_CFLAGS} ${CMAKE_CXX_FLAGS}")
+SET(CMAKE_SHARED_LINKER_FLAGS "${ADD_LDFLAGS} ${CMAKE_SHARED_LINKER_FLAGS}")
+SET(CMAKE_MODULE_LINKER_FLAGS "${ADD_LDFLAGS} ${CMAKE_MODULE_LINKER_FLAGS}")
+
+IF(BUILD_STATIC)
+ # we can't create a static library with the same name
+ # as the shared one, so we copy it over after creation
+ ADD_LIBRARY(alut_static STATIC ${ALUT_SOURCES})
+ TARGET_LINK_LIBRARIES(alut_static ${OPENAL_LIB} ${ADD_LIBS})
+ IF(NOT WIN32)
+ ADD_CUSTOM_COMMAND(
+ TARGET alut_static
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy
+ ${CMAKE_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}alut_static${CMAKE_STATIC_LIBRARY_SUFFIX}
+ ${CMAKE_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}alut${CMAKE_STATIC_LIBRARY_SUFFIX})
+ INSTALL_FILES(/lib FILES ${CMAKE_STATIC_LIBRARY_PREFIX}alut${CMAKE_STATIC_LIBRARY_SUFFIX})
+ ENDIF(NOT WIN32)
+ENDIF(BUILD_STATIC)
+
+
+ADD_LIBRARY(alut SHARED ${ALUT_SOURCES})
+SET_TARGET_PROPERTIES(alut PROPERTIES VERSION ${VERSION} SOVERSION ${MAJOR_VERSION})
+TARGET_LINK_LIBRARIES(alut ${OPENAL_LIB} ${ADD_LIBS})
+
+INSTALL_TARGETS(/lib alut)
+INSTALL_FILES(/include/AL FILES include/AL/alut.h)
+
+# needed for openal.pc.in and openal-config.in
+SET(prefix ${CMAKE_INSTALL_PREFIX})
+SET(exec_prefix "\${prefix}")
+SET(libdir "\${exec_prefix}/lib")
+SET(bindir "\${exec_prefix}/bin")
+SET(includedir "\${prefix}/include")
+SET(requirements "")
+# static linking dependecies are broken, so pthread isn't needed currently
+SET(PTHREAD_LIBS ${CMAKE_THREAD_LIBS_INIT})
+
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/admin/pkgconfig/freealut.pc.in
+ ${CMAKE_BINARY_DIR}/admin/pkgconfig/freealut.pc @ONLY)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/admin/pkgconfig/freealut-config.in
+ ${CMAKE_BINARY_DIR}/admin/pkgconfig/freealut-config @ONLY)
+INSTALL_PROGRAMS(/bin FILES admin/pkgconfig/freealut-config)
+INSTALL_FILES(/lib/pkgconfig FILES admin/pkgconfig/freealut.pc)
+
+
+# test-suite
+IF(BUILD_TESTS)
+ # examples
+ ADD_EXECUTABLE(hello_world examples/hello_world.c)
+ TARGET_LINK_LIBRARIES(hello_w