diff options
Diffstat (limited to 'tests')
85 files changed, 52679 insertions, 0 deletions
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_world ${OPENAL_LIB} ${ADD_LIBS} alut) + + ADD_EXECUTABLE(playfile examples/playfile.c) + TARGET_LINK_LIBRARIES(playfile ${OPENAL_LIB} ${ADD_LIBS} alut) + + + SET(TESTS errorstuff + fileloader + memoryloader + version + waveforms) + + FOREACH(TEST ${TESTS}) + SET(TEST_SRC test_suite/test_${TEST}.c) + SET_SOURCE_FILES_PROPERTIES(${TEST_SRC} PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations") + ADD_EXECUTABLE(test_${TEST} ${TEST_SRC}) + TARGET_LINK_LIBRARIES(test_${TEST} ${OPENAL_LIB} ${ADD_LIBS} alut) + ENDFOREACH(TEST) + + #copy over testdata, so test-suite can be used in binary dir + SET(TESTDATA file1.wav + file2.au + file3.raw) + + FOREACH(TESTDATUM ${TESTDATA}) + CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/test_suite/${TESTDATUM} ${CMAKE_BINARY_DIR}/${TESTDATUM} COPYONLY) + ENDFOREACH(TESTDATUM) +ENDIF(BUILD_TESTS) diff --git a/tests/freealut/COPYING b/tests/freealut/COPYING new file mode 100644 index 00000000..e463f462 --- /dev/null +++ b/tests/freealut/COPYING @@ -0,0 +1,483 @@ + + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with applicat |