diff options
-rw-r--r-- | .gitignore | 68 | ||||
-rw-r--r-- | .travis.yml | 31 | ||||
-rw-r--r-- | CMakeLists.txt | 180 | ||||
-rw-r--r-- | INSTALL.md | 54 | ||||
-rw-r--r-- | Makefile.am | 129 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | cmake/toolchain-cross-mingw.cmake | 14 | ||||
-rw-r--r-- | configure.ac | 228 | ||||
-rw-r--r-- | cubeb-uninstalled.pc.in | 13 | ||||
-rw-r--r-- | cubeb.pc.in | 13 | ||||
-rw-r--r-- | docs/Doxyfile.in | 2 | ||||
-rw-r--r-- | docs/Makefile.am | 38 | ||||
-rw-r--r-- | include/cubeb/cubeb.h | 87 | ||||
-rw-r--r-- | m4/as-ac-expand.m4 | 43 | ||||
-rw-r--r-- | src/cubeb.c | 8 | ||||
-rw-r--r-- | src/cubeb_alsa.c | 4 | ||||
-rw-r--r-- | src/cubeb_log.h | 8 | ||||
-rw-r--r-- | src/cubeb_pulse.c | 46 | ||||
-rw-r--r-- | src/cubeb_resampler.cpp | 4 | ||||
-rw-r--r-- | src/cubeb_wasapi.cpp | 3 | ||||
-rw-r--r-- | test/test_resampler.cpp | 6 |
21 files changed, 323 insertions, 658 deletions
diff --git a/.gitignore b/.gitignore deleted file mode 100644 index df6c4e7..0000000 --- a/.gitignore +++ /dev/null @@ -1,68 +0,0 @@ -*.lo -*.o -*.swp -*~ -*.trs -*.raw -*.wav -*.log -.deps -.dirstamp -.libs -Makefile -Makefile.in -_stdint.h -aclocal.m4 -autom4te.cache -compile -config.guess -config.h -config.h.in -config.log -config.status -config.sub -configure -depcomp -docs/Doxyfile -docs/doxygen-build.stamp -docs/html -install-sh -libtool -ltmain.sh -m4/libtool.m4 -m4/ltoptions.m4 -m4/ltsugar.m4 -m4/ltversion.m4 -m4/lt~obsolete.m4 -missing -cubeb-uninstalled.pc -cubeb.pc -src/.dirstamp -src/libcubeb.la -src/speex/libspeex.la -stamp-h1 -test-driver -test/test_audio -test/test_audio.exe -test/test_latency -test/test_latency.exe -test/test_sanity -test/test_sanity.exe -test/test_tone -test/test_tone.exe -test/test_devices -test/test_devices.exe -test/test_resampler -test/test_resampler.exe -test/test_record -test/test_record.exe -test/test_duplex -test/test_duplex.exe -test/test_utils -test/test_utils.exe -include/cubeb/cubeb-stdint.h -test-suite.log -test/test_sanity.log -test/test_sanity.trs -test/test_ring_array -test/test_ring_array.exe diff --git a/.travis.yml b/.travis.yml index efdfd9e..a2d9e17 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,13 +48,16 @@ before_install: fi - if [[ $TRAVIS_OS_NAME = "linux" ]]; then if [ ! -z "$HOST" ]; then - sudo apt-get install -qq mingw-w64 g++-mingw-w64 binutils-mingw-w64; - wget http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-tools_3.1.0-1_amd64.deb; - sudo dpkg -i mingw-w64-tools_3.1.0-1_amd64.deb; + sudo apt-get install -qq mingw-w64 mingw-w64-tools g++-mingw-w64 binutils-mingw-w64; fi fi - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew uninstall libtool && brew install libtool; fi + - if [[ $TRAVIS_OS_NAME = "osx" ]]; then + brew update; + brew uninstall libtool && brew install libtool; + brew uninstall cmake && brew install cmake; + fi before_script: + - cmake --version - if [[ $TRAVIS_OS_NAME = "linux" ]]; then if [ ! -z "$HOST" ]; then unset CC; @@ -67,15 +70,23 @@ before_script: export CXX=$COMPILER_CXX; fi fi - - autoreconf -i - - $SCAN_BUILD_PATH ./configure --host=$HOST + - mkdir build + - cd build + - if [[ $TRAVIS_OS_NAME = "linux" ]]; then + if [ ! -z "$HOST" ]; then + $SCAN_BUILD_PATH cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-cross-mingw.cmake ..; + else + $SCAN_BUILD_PATH cmake ..; + fi + else + $SCAN_BUILD_PATH cmake ..; + fi script: - echo $SCAN_BUILD_PATH - $SCAN_BUILD_PATH make - - if [ -z "$HOST" ]; then - if [ "$TRAVIS_OS_NAME" = "linux" ]; then - make check; - cat test/*.log; + - if [[ $TRAVIS_OS_NAME = "linux" ]]; then + if [ -z "$HOST" ]; then + make test ARGS=-V; fi fi addons: diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0b13f0e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,180 @@ +# TODO +# - backend selection via command line, rather than simply detecting headers. + +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) +project(cubeb + VERSION 0.0.0) + +if(POLICY CMP0063) + cmake_policy(SET CMP0063 NEW) +endif() +set(CMAKE_C_STANDARD 99) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_C_VISIBILITY_PRESET hidden) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) + +add_library(cubeb + src/cubeb.c + src/cubeb_resampler.cpp + src/cubeb_panner.cpp + $<TARGET_OBJECTS:speex>) +target_include_directories(cubeb PUBLIC include) +target_include_directories(cubeb PRIVATE src) +target_compile_definitions(cubeb PRIVATE OUTSIDE_SPEEX) +target_compile_definitions(cubeb PRIVATE FLOATING_POINT) +target_compile_definitions(cubeb PRIVATE EXPORT=) +target_compile_definitions(cubeb PRIVATE RANDOM_PREFIX=speex) + +include(GenerateExportHeader) +generate_export_header(cubeb EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/exports/cubeb_export.h) +target_include_directories(cubeb PUBLIC ${CMAKE_BINARY_DIR}/exports) + +add_library(speex OBJECT + src/speex/resample.c) +set_target_properties(speex PROPERTIES POSITION_INDEPENDENT_CODE TRUE) +target_compile_definitions(speex PRIVATE OUTSIDE_SPEEX) +target_compile_definitions(speex PRIVATE FLOATING_POINT) +target_compile_definitions(speex PRIVATE EXPORT=) +target_compile_definitions(speex PRIVATE RANDOM_PREFIX=speex) + +include(CheckIncludeFiles) + +check_include_files(AudioUnit/AudioUnit.h USE_AUDIOUNIT) +if(USE_AUDIOUNIT) + target_sources(cubeb PRIVATE + src/cubeb_audiounit.cpp + src/cubeb_osx_run_loop.c) + target_compile_definitions(cubeb PRIVATE USE_AUDIOUNIT) + target_link_libraries(cubeb PRIVATE "-framework AudioUnit" "-framework CoreAudio" "-framework CoreServices") +endif() + +check_include_files(pulse/pulseaudio.h USE_PULSE) +if(USE_PULSE) + target_sources(cubeb PRIVATE + src/cubeb_pulse.c) + target_compile_definitions(cubeb PRIVATE USE_PULSE) + target_link_libraries(cubeb PRIVATE pulse) +endif() + +check_include_files(alsa/asoundlib.h USE_ALSA) +if(USE_ALSA) + target_sources(cubeb PRIVATE + src/cubeb_alsa.c) + target_compile_definitions(cubeb PRIVATE USE_ALSA) + target_link_libraries(cubeb PRIVATE asound dl pthread) +endif() + +check_include_files(jack/jack.h USE_JACK) +if(USE_JACK) + target_sources(cubeb PRIVATE + src/cubeb_jack.cpp) + target_compile_definitions(cubeb PRIVATE USE_JACK) + target_link_libraries(cubeb PRIVATE jack dl pthread) +endif() + +check_include_files(audioclient.h USE_WASAPI) +if(USE_WASAPI) + target_sources(cubeb PRIVATE + src/cubeb_wasapi.cpp) + target_compile_definitions(cubeb PRIVATE USE_WASAPI) +endif() + +check_include_files("windows.h;mmsystem.h" USE_WINMM) +if(USE_WINMM) + target_sources(cubeb PRIVATE + src/cubeb_winmm.c) + target_compile_definitions(cubeb PRIVATE USE_WINMM) + target_link_libraries(cubeb PRIVATE winmm) +endif() + +check_include_files(SLES/OpenSLES.h USE_OPENSL) +if(USE_OPENSL) + target_sources(cubeb PRIVATE + src/cubeb_opensl.c) + target_compile_definitions(cubeb PRIVATE USE_OPENSL) + target_link_libraries(cubeb PRIVATE OpenSLES) +endif() + +check_include_files(android/log.h USE_AUDIOTRACK) +if(USE_AUDIOTRACK) + target_sources(cubeb PRIVATE + src/cubeb_audiotrack.c) + target_compile_definitions(cubeb PRIVATE USE_AUDIOTRACK) +endif() + +check_include_files(sndio.h USE_SNDIO) +if(USE_SNDIO) + target_sources(cubeb PRIVATE + src/cubeb_sndio.c) + target_compile_definitions(cubeb PRIVATE USE_SNDIO) + target_link_libraries(cubeb PRIVATE sndio) +endif() + +check_include_files(kai.h USE_KAI) +if(USE_KAI) + target_sources(cubeb PRIVATE + src/cubeb_kai.c) + target_compile_definitions(cubeb PRIVATE USE_KAI) + target_link_libraries(cubeb PRIVATE kai) +endif() + +find_package(Doxygen) +if(DOXYGEN_FOUND) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/docs/Doxyfile @ONLY) + add_custom_target(doc ALL + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/docs/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs + COMMENT "Generating API documentation with Doxygen" VERBATIM) +endif() + +enable_testing() + +add_executable(test_sanity test/test_sanity.cpp) +target_link_libraries(test_sanity PRIVATE cubeb) +add_test(sanity test_sanity) + +add_executable(test_tone test/test_tone.cpp) +target_link_libraries(test_tone PRIVATE cubeb) +add_test(tone test_tone) + +add_executable(test_audio test/test_audio.cpp) +target_link_libraries(test_audio PRIVATE cubeb) +add_test(audio test_audio) + +add_executable(test_record test/test_record.cpp) +target_link_libraries(test_record PRIVATE cubeb) +add_test(record test_record) + +add_executable(test_devices test/test_devices.c) +target_link_libraries(test_devices PRIVATE cubeb) +add_test(devices test_devices) + +add_executable(test_resampler test/test_resampler.cpp src/cubeb_resampler.cpp $<TARGET_OBJECTS:speex>) +target_include_directories(test_resampler PRIVATE src) +target_compile_definitions(test_resampler PRIVATE OUTSIDE_SPEEX) +target_compile_definitions(test_resampler PRIVATE FLOATING_POINT) +target_compile_definitions(test_resampler PRIVATE EXPORT=) +target_compile_definitions(test_resampler PRIVATE RANDOM_PREFIX=speex) +target_link_libraries(test_resampler PRIVATE cubeb) +add_test(resampler test_resampler) + +add_executable(test_duplex test/test_duplex.cpp) +target_link_libraries(test_duplex PRIVATE cubeb) +add_test(duplex test_duplex) + +add_executable(test_latency test/test_latency.cpp) +target_link_libraries(test_latency PRIVATE cubeb) +add_test(latency test_latency) + +add_executable(test_ring_array test/test_ring_array.cpp) +target_include_directories(test_ring_array PRIVATE src) +target_link_libraries(test_ring_array PRIVATE cubeb) +add_test(ring_array test_ring_array) + +add_executable(test_utils test/test_utils.cpp) +target_include_directories(test_utils PRIVATE src) +target_link_libraries(test_utils PRIVATE cubeb) +add_test(utils test_utils) @@ -1,36 +1,24 @@ # Build instructions for libcubeb -Note Also:Cubeb does not currently build under Cygwin, but this is being worked on. - -0. Change directory into the source directory. -1. Run |autoreconf --install| to generate configure. -2. Run |./configure| to configure the build. -3. Run |make| to build. -4. Run |make check| to run the test suite. - -# Debugging - -Debugging tests can be done like so: - -```libtool --mode=execute gdb test/test_tone``` - -# Windows build prerequisite, using `msys2` - -Cubeb for Windows uses win32 threads - -- Download and install `msys2` 32-bits from <https://msys2.github.io>. Let it - install in `C:\msys32`. -- Download and install `7z` from <http://www.7-zip.org/>. -- Run `msys2` (a shortcut has been added to the start menu, or use the `.bat` - script: `C:\msys32\mingw32_shell.bat`), and issue the following commands to - install the dependencies: -``` -pacman -S git automake autoconf libtool m4 make pkg-config gdb -``` -- Download a `mingw` compiler with the WIN32 thread model [here](http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.2/threads-win32/sjlj/i686-4.9.2-release-win32-sjlj-rt_v3-rev0.7z/download). `msys2` does not have `mingw` builds with win32 threads, -so we have to install another compiler. -- Unzip the compiler, and copy all folders in `C:\msys32\opt` -- Exit the `msys2` shell, and run `C:\msys32\autorebase.bat` (double clicking - works). -- Open an `msys2` shell and follow the build instructions. +You must have CMake v3.1 or later installed. + +1. `git clone https://github.com/kinetiknz/cubeb.git` +2. `mkdir cubeb-build` +3. `cd cubeb-build` +3. `cmake ../cubeb` +4. `cmake --build .` +5. `ctest` + +# Windows build notes + +Windows builds can use Microsoft Visual Studio 2015 (the default) or MinGW-w64 +with Win32 threads (by passing `cmake -G` to generate the appropriate build +configuration). To build with MinGW-w64, install the following items: + +- Download and install MinGW-w64 with Win32 threads. +- Download and install CMake. +- Run MinGW-w64 Terminal from the Start Menu. +- Follow the build steps above, but at step 3 run: + `cmake -G "MinGW Makefiles" ..` +- Continue the build steps above. diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 11857e3..0000000 --- a/Makefile.am +++ /dev/null @@ -1,129 +0,0 @@ -AUTOMAKE_OPTIONS = foreign 1.10 dist-bzip2 subdir-objects -ACLOCAL_AMFLAGS = -I m4 - -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I. -I$(top_srcdir)/src -AM_CFLAGS = -ansi -std=gnu99 -Wall -Wextra -Wno-long-long -O2 -g -Wno-unused-parameter -AM_CXXFLAGS = -std=c++11 -Wall -Wextra -g - -SUBDIRS = docs - -EXTRA_DIST = \ - AUTHORS README LICENSE \ - cubeb-uninstalled.pc.in \ - m4/as-ac-expand.m4 \ - m4/pkg.m4 - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = cubeb.pc - -cubebincludedir = $(includedir)/cubeb -cubebinclude_HEADERS = include/cubeb/cubeb.h - -lib_LTLIBRARIES = src/libcubeb.la - -src_libcubeb_la_SOURCES = src/cubeb.c src/cubeb_panner.cpp - -if PULSE -src_libcubeb_la_SOURCES += src/cubeb_pulse.c -endif -if JACK -src_libcubeb_la_SOURCES += src/cubeb_jack.cpp -endif -if ALSA -src_libcubeb_la_SOURCES += src/cubeb_alsa.c -endif -if AUDIOUNIT -src_libcubeb_la_SOURCES += src/cubeb_audiounit.cpp src/cubeb_osx_run_loop.c -endif -if WASAPI -src_libcubeb_la_SOURCES += src/cubeb_wasapi.cpp -endif -if WINMM -src_libcubeb_la_SOURCES += src/cubeb_winmm.c -endif -if SNDIO -src_libcubeb_la_SOURCES += src/cubeb_sndio.c -endif -if OPENSL -src_libcubeb_la_SOURCES += src/cubeb_opensl.c -endif -if AUDIOTRACK -src_libcubeb_la_SOURCES += src/cubeb_audiotrack.c -endif -if KAI -src_libcubeb_la_SOURCES += src/cubeb_kai.c -endif - -src_libcubeb_la_SOURCES += src/cubeb_resampler.cpp - -noinst_LTLIBRARIES = src/speex/libspeex.la -src_speex_libspeex_la_SOURCES = src/speex/resample.c -src_speex_libspeex_la_CFLAGS = -Wno-sign-compare -src_libcubeb_la_LIBADD = src/speex/libspeex.la - -EXTRA_src_libcubeb_la_SOURCES = \ - src/cubeb.c \ - src/cubeb_jack.cpp \ - src/cubeb_alsa.c \ - src/cubeb_pulse.c \ - src/cubeb_audiounit.cpp \ - src/cubeb_sndio.c \ - src/cubeb_winmm.c \ - src/cubeb_wasapi.cpp \ - src/speex/resample.c \ - src/cubeb_opensl.c \ - src/cubeb_audiotrack.c \ - $(NULL) - -src_libcubeb_la_LDFLAGS = -export-symbols-regex '^cubeb_' $(platform_lib) -no-undefined - -check_PROGRAMS = test/test_sanity \ - test/test_tone \ - test/test_audio \ - test/test_latency \ - test/test_devices \ - test/test_duplex \ - test/test_resampler \ - test/test_record \ - test/test_utils \ - test/test_ring_array\ - $(NULL) - -test_test_sanity_SOURCES = test/test_sanity.cpp -test_test_sanity_LDADD = -lm src/libcubeb.la $(platform_lib) - -test_test_tone_SOURCES = test/test_tone.cpp -test_test_tone_LDADD = -lm src/libcubeb.la $(platform_lib) - -test_test_audio_SOURCES = test/test_audio.cpp -test_test_audio_LDADD = -lm src/libcubeb.la $(platform_lib) - -test_test_latency_SOURCES = test/test_latency.cpp -test_test_latency_LDADD = -lm src/libcubeb.la $(platform_lib) - -test_test_devices_SOURCES = test/test_devices.cpp -test_test_devices_LDADD = -lm src/libcubeb.la $(platform_lib) - -test_test_resampler_SOURCES = test/test_resampler.cpp -test_test_resampler_LDADD = -lm src/libcubeb.la $(platform_lib) src/cubeb_resampler.o src/speex/libspeex.la - -test_test_duplex_SOURCES = test/test_duplex.cpp -test_test_duplex_LDADD = -lm src/libcubeb.la $(platform_lib) - -test_test_record_SOURCES = test/test_record.cpp -test_test_record_LDADD = -lm src/libcubeb.la $(platform_lib) - -test_test_utils_SOURCES = test/test_utils.cpp - -test_test_ring_array_SOURCES = test/test_ring_array.cpp - -TESTS = $(check_PROGRAMS) - -dist-hook: - find $(distdir) -type d -name '.git' | xargs rm -rf - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" @@ -1,5 +1,5 @@ [![Build Status](https://travis-ci.org/kinetiknz/cubeb.svg?branch=master)](https://travis-ci.org/kinetiknz/cubeb) -See INSTALL for build instructions. +See INSTALL.md for build instructions. Licensed under an ISC-style license. See LICENSE for details. diff --git a/cmake/toolchain-cross-mingw.cmake b/cmake/toolchain-cross-mingw.cmake new file mode 100644 index 0000000..385d790 --- /dev/null +++ b/cmake/toolchain-cross-mingw.cmake @@ -0,0 +1,14 @@ +SET(CMAKE_SYSTEM_NAME Windows) + +set(COMPILER_PREFIX "i686-w64-mingw32") + +find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres) +find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc) +find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++) + +SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX}) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + diff --git a/configure.ac b/configure.ac deleted file mode 100644 index df81fd3..0000000 --- a/configure.ac +++ /dev/null @@ -1,228 +0,0 @@ -dnl ------------------------------------------------ -dnl Initialization and Versioning -dnl ------------------------------------------------ - -AC_INIT(libcubeb,[0.3git]) - -AC_CANONICAL_HOST -AC_CANONICAL_TARGET - -AC_CONFIG_MACRO_DIR([m4]) - -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_SRCDIR([src/cubeb.c]) -AM_INIT_AUTOMAKE - -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -dnl Library versioning -dnl CURRENT, REVISION, AGE -dnl - library source changed -> increment REVISION -dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0 -dnl - interfaces added -> increment AGE -dnl - interfaces removed -> AGE = 0 - -CUBEB_CURRENT=0 -CUBEB_REVISION=0 -CUBEB_AGE=1 -AC_SUBST(CUBEB_CURRENT) -AC_SUBST(CUBEB_REVISION) -AC_SUBST(CUBEB_AGE) - - -dnl -------------------------------------------------- -dnl Check for programs -dnl -------------------------------------------------- - -dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2" -dnl if $CFLAGS is blank -cflags_save="$CFLAGS" -cxxflags_save="$CXXFLAGS" -AC_PROG_CC -AC_PROG_CPP -AC_PROG_CXX -CFLAGS="$cflags_save" -CXXFLAGS="$cxxflags_save" - -AM_PROG_CC_C_O -AC_LIBTOOL_WIN32_DLL -AM_PROG_LIBTOOL - - -AC_ARG_WITH([pulse], - AS_HELP_STRING([--with-pulse], [with PulseAudio @<:@default=check@:>@])) -AS_IF([test "x$with_pulse" != xno], - [PKG_CHECK_MODULES(PULSE, libpulse >= 0.9.16, [ - HAVE_PULSE=1 - PULSE_LIBS="-ldl" - AC_DEFINE([USE_PULSE], [], [Use PulseAudio]) - ], [ - HAVE_PULSE=0 - AS_IF([test "x$with_pulse" = xyes], [AC_MSG_ERROR(PulseAudio not detected)])])]) -AM_CONDITIONAL([PULSE], [test $HAVE_PULSE -eq 1]) - -AC_ARG_WITH([jack], - AS_HELP_STRING([--with-jack], [with JACK @<:@default=check@:>@])) -AS_IF([test "x$with_jack" != xno], - [PKG_CHECK_MODULES(JACK, jack >= 1.9.9, [ - HAVE_JACK=1 - JACK_LIBS="-ldl" - AC_DEFINE([USE_JACK], [], [Use JACK]) - ], [ - HAVE_JACK=0 - AS_IF([test "x$with_jack" = xyes], [AC_MSG_ERROR(JACK not detected)])])]) -AM_CONDITIONAL([JACK], [test $HAVE_JACK -eq 1]) - -AC_ARG_WITH([alsa], - AS_HELP_STRING([--with-alsa], [with ALSA @<:@default=check@:>@])) -AS_IF([test "x$with_alsa" != xno], - [PKG_CHECK_MODULES(ALSA, alsa >= 1.0.17, [ - HAVE_ALSA=1 - AC_DEFINE([USE_ALSA], [], [Use ALSA]) - ], [ - HAVE_ALSA=0 - AS_IF([test "x$with_alsa" = xyes], [AC_MSG_ERROR(ALSA not detected)])])]) -AM_CONDITIONAL([ALSA], [test $HAVE_ALSA -eq 1]) - -AC_ARG_WITH([audiounit], - AS_HELP_STRING([--with-audiounit], [with AudioUnit @<:@default=check@:>@])) -AS_IF([test "x$with_audiounit" != xno], - [AC_CHECK_HEADER([AudioUnit/AudioUnit.h], [ - HAVE_AUDIOUNIT=1 - AUDIOUNIT_LIBS="-framework CoreServices -framework AudioUnit -framework CoreAudio" - AC_DEFINE([USE_AUDIOUNIT], [], [Use AudioUnit]) - ], [ - HAVE_AUDIOUNIT=0 - AS_IF([test "x$with_audiounit" = xyes], [AC_MSG_ERROR(AudioUnit not detected)])])]) -AM_CONDITIONAL([AUDIOUNIT], [test $HAVE_AUDIOUNIT -eq 1]) - -AC_ARG_WITH([sndio], - AS_HELP_STRING([--with-sndio], [with sndio @<:@default=check@:>@])) -AS_IF([test "x$with_sndio" != xno], - [AC_CHECK_HEADER([sndio.h], [ - HAVE_SNDIO=1 - SNDIO_LIBS="-lsndio" - AC_DEFINE([USE_SNDIO], [], [Use sndio]) - ], [ - HAVE_SNDIO=0 - AS_IF([test "x$with_sndio" = xyes], [AC_MSG_ERROR(sndio not detected)])])]) -AM_CONDITIONAL([SNDIO], [test $HAVE_SNDIO -eq 1]) - -AC_ARG_WITH([opensl], - AS_HELP_STRING([--with-opensl], [with OpenSL @<:@default=check@:>@])) -AS_IF([test "x$with_opensl" != xno], - [AC_CHECK_HEADER([SLES/OpenSLES.h], [ - HAVE_OPENSL=1 - AC_DEFINE([USE_OPENSL], [], [Use OpenSL]) - ], [ - HAVE_OPENSL=0 - AS_IF([test "x$with_opensl" = xyes], [AC_MSG_ERROR(OpenSL not detected)])])]) -AM_CONDITIONAL([OPENSL], [test $HAVE_OPENSL -eq 1]) - -AC_ARG_WITH([audiotrack], - AS_HELP_STRING([--with-audiotrack], [with OpenSL @<:@default=check@:>@])) -AS_IF([test "x$with_audiotrack" != xno], - [AC_CHECK_HEADER([android/log.h], [ - HAVE_AUDIOTRACK=1 - AC_DEFINE([USE_AUDIOTRACK], [], [Use AudioTrack]) - ], [ - HAVE_AUDIOTRACK=0 - AS_IF([test "x$with_audiotrack" = xyes], [AC_MSG_ERROR(AudioTrack not detected)])])]) -AM_CONDITIONAL([AUDIOTRACK], [test $HAVE_AUDIOTRACK -eq 1]) - -AC_ARG_WITH([wasapi], - AS_HELP_STRING([--with-wasapi], [with WASAPI @<:@default=check@:>@])) -AS_IF([test "x$with_wasapi" != xno], - [AC_CHECK_HEADERS([audioclient.h], [ - HAVE_WASAPI=1 - AC_DEFINE([USE_WASAPI], [], [Use WASAPI]) - WASAPI_LIBS="-lole32" - ], [ - HAVE_WASAPI=0 - AS_IF([test "x$with_wasapi" = xyes], [AC_MSG_ERROR(WASAPI not detected)]) - ], [#include <windows.h>])]) -AM_CONDITIONAL([WASAPI], [test $HAVE_WASAPI -eq 1]) - -AC_ARG_WITH([winmm], - AS_HELP_STRING([--with-winmm], [with WinMM @<:@default=check@:>@])) -AS_IF([test "x$with_winmm" != xno], - [AC_CHECK_HEADERS([mmsystem.h], [ - HAVE_WINMM=1 - WINMM_LIBS="-lwinmm" - AC_DEFINE([USE_WINMM], [], [Use WinMM]) - ], [ - HAVE_WINMM=0 - AS_IF([test "x$with_winmm" = xyes], [AC_MSG_ERROR(WinMM not detected)]) - ], [#include <windows.h>])]) -AM_CONDITIONAL([WINMM], [test $HAVE_WINMM -eq 1]) - -AC_ARG_WITH([kai], - AS_HELP_STRING([--with-kai], [with KAI @<:@default=check@:>@])) -AS_IF([test "x$with_kai" != xno], - [AC_CHECK_HEADERS([kai.h], [ - HAVE_KAI=1 - KAI_LIBS="-lkai" - AC_DEFINE([USE_KAI], [], [Use K Audio Interface]) - ], [ - HAVE_KAI=0 - AS_IF([test "x$with_kai" = xyes], [AC_MSG_ERROR(KAI not detected)]) - ])]) -AM_CONDITIONAL([KAI], [test $HAVE_KAI -eq 1]) - -AC_DEFINE([OUTSIDE_SPEEX], [], [Tell the speex resampler not to expect speex headers.]) -AC_DEFINE([RANDOM_PREFIX], [speex], [Required by the speex resampler.]) -AC_DEFINE([FLOATING_POINT], [], [Tell the resampler to only enable floating point support]) -AC_DEFINE([EXPORT], [], [Tell the resampler to export the symbols by default.]) - -platform_lib="$PULSE_LIBS $JACK_LIBS $ALSA_LIBS $AUDIOUNIT_LIBS $SNDIO_LIBS $OPENSL_LIBS $WINMM_LIBS $WASAPI_LIBS $KAI_LIBS" - -dnl Check for doxygen -AC_ARG_ENABLE([doc], - AS_HELP_STRING([--enable-doc], [build API documentation]), - [ac_enable_doc=$enableval], [ac_enable_doc=auto]) - -if test "x$ac_enable_doc" != "xno"; then - AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false) - - if test "x$HAVE_DOXYGEN" = "xfalse" -a "x$ac_enable_doc" = "xyes"; then - AC_MSG_ERROR([*** API documentation explicitly requested but Doxygen not found]) - fi -else - HAVE_DOXYGEN=false -fi -AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN) -if test $HAVE_DOXYGEN = "false"; then - AC_MSG_WARN([*** doxygen not found, API documentation will not be built]) -fi - -# Test whenever ld supports -version-script -AC_PROG_LD -AC_PROG_LD_GNU -AC_MSG_CHECKING([how to control symbol export]) - -dnl -------------------------------------------------- -dnl Do substitutions -dnl -------------------------------------------------- - -AC_SUBST(DEBUG) -AC_SUBST(PROFILE) -AC_SUBST(platform_lib) - -AC_OUTPUT([ - Makefile - docs/Makefile - docs/Doxyfile - cubeb.pc - cubeb-uninstalled.pc -]) - -AS_AC_EXPAND(LIBDIR, ${libdir}) -AS_AC_EXPAND(INCLUDEDIR, ${includedir}) -AS_AC_EXPAND(BINDIR, ${bindir}) -AS_AC_EXPAND(DOCDIR, ${docdir}) - -if test $HAVE_DOXYGEN = "false"; then - doc_build="no" -else - doc_build="yes" -fi diff --git a/cubeb-uninstalled.pc.in b/cubeb-uninstalled.pc.in deleted file mode 100644 index b0f5471..0000000 --- a/cubeb-uninstalled.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -# cubeb uninstalled pkg-config file - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: cubeb -Description: WebM demuxer -Version: @VERSION@ -Conflicts: -Libs: -L${libdir} -lcubeb -Cflags: -I${includedir} diff --git a/cubeb.pc.in b/cubeb.pc.in deleted file mode 100644 index 2fea494..0000000 --- a/cubeb.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -# cubeb installed pkg-config file - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: cubeb -Description: Portable audio API -Version: @VERSION@ -Conflicts: -Libs: -L${libdir} -lcubeb -Cflags: -I${includedir} diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index db05c1f..2b52bce 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -7,6 +7,6 @@ CASE_SENSE_NAMES = NO SORT_MEMBER_DOCS = NO QUIET = YES WARN_NO_PARAMDOC = YES -INPUT = @top_srcdir@/include/cubeb +INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include/cubeb GENERATE_HTML = YES GENERATE_LATEX = NO diff --git a/docs/Makefile.am b/docs/Makefile.am deleted file mode 100644 index 5326ea1..0000000 --- a/docs/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -doc_DATA = doxygen-build.stamp - -EXTRA_DIST = Doxyfile.in - -if HAVE_DOXYGEN -doxygen-build.stamp: Doxyfile ../include/cubeb/cubeb.h - doxygen - touch doxygen-build.stamp -else -doxygen-build.stamp: - echo "*** Warning: Doxygen not found; documentation will not be built." - touch doxygen-build.stamp -endif - -dist_docdir = $(distdir)/libcubeb - -dist-hook: - if test -d html; then \ - mkdir $(dist_docdir); \ - echo -n "copying built documenation..."; \ - cp -rp html $(dist_docdir)/html; \ - echo "OK"; \ - fi - - -install-data-local: doxygen-build.stamp - $(mkinstalldirs) $(DESTDIR)$(docdir) - if test -d html; then \ - cp -rp html $(DESTDIR)$(docdir)/html; \ - fi - -uninstall-local: - rm -rf $(DESTDIR)$(docdir) - -clean-local: - if test -d html; then rm -rf html; fi - if test -f doxygen-build.stamp; then rm -f doxygen-build.stamp; fi - diff --git a/include/cubeb/cubeb.h b/include/cubeb/cubeb.h index cdc0a34..50976c9 100644 --- a/include/cubeb/cubeb.h +++ b/include/cubeb/cubeb.h @@ -8,6 +8,7 @@ #define CUBEB_c2f983e9_c96f_e71c_72c3_bbf62992a382 #include <stdint.h> +#include "cubeb_export.h" #if defined(__cplusplus) extern "C" { @@ -359,12 +360,12 @@ typedef void (*cubeb_log_callback)(const char * msg); @retval CUBEB_OK in case of success. @retval CUBEB_ERROR in case of error, for example because the host has no audio hardware. */ -int cubeb_init(cubeb ** context, char const * context_name); +CUBEB_EXPORT int cubeb_init(cubeb ** context, char const * context_name); /** Get a read-only string identifying this context's current backend. @param context A pointer to the cubeb context. @retval Read-only string identifying current backend. */ -char const * cubeb_get_backend_id(cubeb * context); +CUBEB_EXPORT char const * cubeb_get_backend_id(cubeb * context); /** Get the maximum possible number of channels. @param context A pointer to the cubeb context. @@ -373,7 +374,7 @@ char const * cubeb_get_backend_id(cubeb * context); @retval CUBEB_ERROR_INVALID_PARAMETER @retval CUBEB_ERROR_NOT_SUPPORTED @retval CUBEB_ERROR */ -int cubeb_get_max_channel_count(cubeb * context, uint32_t * max_channels); +CUBEB_EXPORT int cubeb_get_max_channel_count(cubeb * context, uint32_t * max_channels); /** Get the minimal latency value, in frames, that is guaranteed to work when creating a stream for the specified sample rate. This is platform, @@ -386,9 +387,9 @@ int cubeb_get_max_channel_count(cubeb * context, uint32_t * max_channels); @retval CUBEB_OK @retval CUBEB_ERROR_INVALID_PARAMETER @retval CUBEB_ERROR_NOT_SUPPORTED */ -int cubeb_get_min_latency(cubeb * context, - cubeb_stream_params params, - uint32_t * latency_frames); +CUBEB_EXPORT int cubeb_get_min_latency(cubeb * context, + cubeb_stream_params params, + uint32_t * latency_frames); /** Get the preferred sample rate for this backend: this is hardware and platform dependant, and can avoid resampling, and/or trigger fastpaths. @@ -397,12 +398,12 @@ int cubeb_get_min_latency(cubeb * context, @retval CUBEB_OK @retval CUBEB_ERROR_INVALID_PARAMETER @retval CUBEB_ERROR_NOT_SUPPORTED */ -int cubeb_get_preferred_sample_rate(cubeb * context, uint32_t * rate); +CUBEB_EXPORT int cubeb_get_preferred_sample_rate(cubeb * context, uint32_t * rate); /** Destroy an application context. This must be called after all stream have * been destroyed. @param context A pointer to the cubeb context.*/ -void cubeb_destroy(cubeb * context); +CUBEB_EXPORT void cubeb_destroy(cubeb * context); /** Initialize a stream associated with the supplied application context. @param context A pointer to the cubeb context. @@ -428,41 +429,41 @@ void cubeb_destroy(cubeb * context); @retval CUBEB_ERROR @retval CUBEB_ERROR_INVALID_FORMAT @retval CUBEB_ERROR_DEVICE_UNAVAILABLE */ -int cubeb_stream_init(cubeb * context, - cubeb_stream ** stream, - char const * stream_name, - cubeb_devid input_device, - cubeb_stream_params * input_stream_params, - cubeb_devid output_device, - cubeb_stream_params * output_stream_params, - unsigned int latency_frames, - cubeb_data_callback data_callback, - cubeb_state_callback state_callback, - void * user_ptr); +CUBEB_EXPORT int cubeb_stream_init(cubeb * context, + cubeb_stream ** stream, + char const * stream_name, + cubeb_devid input_device, + cubeb_stream_params * input_stream_params, + cubeb_devid output_device, + cubeb_stream_params * output_stream_params, + unsigned int latency_frames, + cubeb_data_callback data_callback, + cubeb_state_callback state_callback, + void * user_ptr); /** Destroy a stream. `cubeb_stream_stop` MUST be called before destroying a stream. @param stream The stream to destroy. */ -void cubeb_stream_destroy(cubeb_stream * stream); +CUBEB_EXPORT void cubeb_stream_destroy(cubeb_stream * stream); /** Start playback. @param stream @retval CUBEB_OK @retval CUBEB_ERROR */ -int cubeb_stream_start(cubeb_stream * stream); +CUBEB_EXPORT int cubeb_stream_start(cubeb_stream * stream); /** Stop playback. @param stream @retval CUBEB_OK @retval CUBEB_ERROR */ -int cubeb_stream_stop(cubeb_stream * stream); +CUBEB_EXPORT int cubeb_stream_stop(cubeb_stream * stream); /** Get the current stream playback position. @param stream @param position Playback position in frames. @retval CUBEB_OK @retval CUBEB_ERROR */ -int cubeb_stream_get_position(cubeb_stream * stream, uint64_t * position); +CUBEB_EXPORT int cubeb_stream_get_position(cubeb_stream * stream, uint64_t * position); /** Get the latency for this stream, in frames. This is the number of frames between the time cubeb acquires the data in the callback and the listener @@ -472,7 +473,7 @@ int cubeb_stream_get_position(cubeb_stream * stream, uint64_t * position); @retval CUBEB_OK @retval CUBEB_ERROR_NOT_SUPPORTED @retval CUBEB_ERROR */ -int cubeb_stream_get_latency(cubeb_stream * stream, uint32_t * latency); +CUBEB_EXPORT int cubeb_stream_get_latency(cubeb_stream * stream, uint32_t * latency); /** Set the volume for a stream. @param stream the stream for which to adjust the volume. @@ -481,7 +482,7 @@ int cubeb_stream_get_latency(cubeb_stream * stream, uint32_t * latency); @retval CUBEB_ERROR_INVALID_PARAMETER volume is outside [0.0, 1.0] or stream is an invalid pointer @retval CUBEB_ERROR_NOT_SUPPORTED */ -int cubeb_stream_set_volume(cubeb_stream * stream, float volume); +CUBEB_EXPORT int cubeb_stream_set_volume(cubeb_stream * stream, float volume); /** If the stream is stereo, set the left/right panning. If the stream is mono, this has no effect. @@ -495,7 +496,7 @@ int cubeb_stream_set_volume(cubeb_stream * stream, float volume); outside the [-1.0, 1.0] range. @retval CUBEB_ERROR_NOT_SUPPORTED @retval CUBEB_ERROR stream is not mono nor stereo */ -int cubeb_stream_set_panning(cubeb_stream * stream, float panning); +CUBEB_EXPORT int cubeb_stream_set_panning(cubeb_stream * stream, float panning); /** Get the current output device for this stream. @param stm the stream for which to query the current output device @@ -504,8 +505,8 @@ int cubeb_stream_set_panning(cubeb_stream * stream, float panning); @retval CUBEB_ERROR_INVALID_PARAMETER if either stm, device or count are invalid pointers @retval CUBEB_ERROR_NOT_SUPPORTED */ -int cubeb_stream_get_current_device(cubeb_stream * stm, - cubeb_device ** const device); +CUBEB_EXPORT int cubeb_stream_get_current_device(cubeb_stream * stm, + cubeb_device ** const device); /** Destroy a cubeb_device structure. @param stream the stream passed in cubeb_stream_get_current_device @@ -513,8 +514,8 @@ int cubeb_stream_get_current_device(cubeb_stream * stm, @retval CUBEB_OK in case of success @retval CUBEB_ERROR_INVALID_PARAMETER if devices is an invalid pointer @retval CUBEB_ERROR_NOT_SUPPORTED */ -int cubeb_stream_device_destroy(cubeb_stream * stream, - cubeb_device * devices); +CUBEB_EXPORT int cubeb_stream_device_destroy(cubeb_stream * stream, + cubeb_device * devices); /** Set a callback to be notified when the output device changes. @param stream the stream for which to set the callback. @@ -524,8 +525,8 @@ int cubeb_stream_device_destroy(cubeb_stream * stream, @retval CUBEB_ERROR_INVALID_PARAMETER if either stream or device_changed_callback are invalid pointers. @retval CUBEB_ERROR_NOT_SUPPORTED */ -int cubeb_stream_register_device_changed_callback(cubeb_stream * stream, - cubeb_device_changed_callback device_changed_callback); +CUBEB_EXPORT int cubeb_stream_register_device_changed_callback(cubeb_stream * stream, + cubeb_device_changed_callback device_changed_callback); /** Returns enumerated devices. @param context @@ -534,21 +535,21 @@ int cubeb_stream_register_device_changed_callback(cubeb_stream * stream, @retval CUBEB_OK in case of success @retval CUBEB_ERROR_INVALID_PARAMETER if collection is an invalid pointer @retval CUBEB_ERROR_NOT_SUPPORTED */ -int cubeb_enumerate_devices(cubeb * context, - cubeb_device_type devtype, - cubeb_device_collection ** collection); +CUBEB_EXPORT int cubeb_enumerate_devices(cubeb * context, + cubeb_device_type devtype, + cubeb_device_collection ** collection); /** Destroy a cubeb_device_collection, and its `cubeb_device_info`. @param collection collection to destroy @retval CUBEB_OK @retval CUBEB_ERROR_INVALID_PARAMETER if collection is an invalid pointer */ -int cubeb_device_collection_destroy(cubeb_device_collection * collection); +CUBEB_EXPORT int cubeb_device_collection_destroy(cubeb_device_collection * collection); /** Destroy a cubeb_device_info structure. @param info pointer to device info structure @retval CUBEB_OK @retval CUBEB_ERROR_INVALID_PARAMETER if info is an invalid pointer */ -int cubeb_device_info_destroy(cubeb_device_info * info); +CUBEB_EXPORT int cubeb_device_info_destroy(cubeb_device_info * info); /** Registers a callback which is called when the system detects a new device or a device is removed. @@ -559,10 +560,10 @@ int cubeb_device_info_destroy(cubeb_device_info * info); @param user_ptr pointer to user specified data which will be present in subsequent callbacks. @retval CUBEB_ERROR_NOT_SUPPORTED */ -int cubeb_register_device_collection_changed(cubeb * context, - cubeb_device_type devtype, - cubeb_device_collection_changed_callback callback, - void * user_ptr); +CUBEB_EXPORT int cubeb_register_device_collection_changed(cubeb * context, + cubeb_device_type devtype, + cubeb_device_collection_changed_callback callback, + void * user_ptr); /** Set a callback to be called with a message. @param log_level CUBEB_LOG_VERBOSE, CUBEB_LOG_NORMAL. @@ -574,8 +575,8 @@ int cubeb_register_device_collection_changed(cubeb * context, @retval CUBEB_ERROR_INVALID_PARAMETER if either context or log_callback are invalid pointers, or if level is not in cubeb_log_level. */ -int cubeb_set_log_callback(cubeb_log_level log_level, - cubeb_log_callback log_callback); +CUBEB_EXPORT int cubeb_set_log_callback(cubeb_log_level log_level, + cubeb_log_callback log_callback); #if defined(__cplusplus) } diff --git a/m4/as-ac-expand.m4 b/m4/as-ac-expand.m4 deleted file mode 100644 index d6c9e33..0000000 --- a/m4/as-ac-expand.m4 +++ /dev/null @@ -1,43 +0,0 @@ -dnl as-ac-expand.m4 0.2.0 -dnl autostars m4 macro for expanding directories using configure's prefix -dnl [email protected] - -dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) -dnl example -dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) -dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local - -AC_DEFUN([AS_AC_EXPAND], -[ - EXP_VAR=[$1] - FROM_VAR=[$2] - - dnl first expand prefix and exec_prefix if necessary - prefix_save=$prefix - exec_prefix_save=$exec_prefix - - dnl if no prefix given, then use /usr/local, the default prefix - if test "x$prefix" = "xNONE"; then - prefix="$ac_default_prefix" - fi - dnl if no exec_prefix given, then use prefix - if test "x$exec_prefix" = "xNONE"; then - exec_prefix=$prefix - fi - - full_var="$FROM_VAR" - dnl loop until it doesn't change anymore - while true; do - new_full_var="`eval echo $full_var`" - if test "x$new_full_var" = "x$full_var"; then break; fi - full_var=$new_full_var - done - - dnl clean up - full_var=$new_full_var - AC_SUBST([$1], "$full_var") - - dnl restore prefix and exec_prefix - prefix=$prefix_save - exec_prefix=$exec_prefix_save -]) diff --git a/src/cubeb.c b/src/cubeb.c index 17ad84e..e6b6624 100644 --- a/src/cubeb.c +++ b/src/cubeb.c @@ -8,9 +8,6 @@ #include <assert.h> #include <stddef.h> #include <stdlib.h> -#if defined(HAVE_CONFIG_H) -#include "config.h" -#endif #include "cubeb/cubeb.h" #include "cubeb-internal.h" @@ -59,7 +56,7 @@ int kai_init(cubeb ** context, char const * context_name); #endif -int +static int validate_stream_params(cubeb_stream_params * input_stream_params, cubeb_stream_params * output_stream_params) { @@ -101,7 +98,7 @@ validate_stream_params(cubeb_stream_params * input_stream_params, -int +static int validate_latency(int latency) { if (latency < 1 || latency > 96000) { @@ -473,4 +470,3 @@ cubeb_crash() *((volatile int *) NULL) = 0; } - diff --git a/src/cubeb_alsa.c b/src/cubeb_alsa.c index ec203e0..42675e5 100644 --- a/src/cubeb_alsa.c +++ b/src/cubeb_alsa.c @@ -1090,7 +1090,7 @@ alsa_stream_get_position(cubeb_stream * stm, uint64_t * position) return CUBEB_OK; } -int +static int alsa_stream_get_latency(cubeb_stream * stm, uint32_t * latency) { snd_pcm_sframes_t delay; @@ -1105,7 +1105,7 @@ alsa_stream_get_latency(cubeb_stream * stm, uint32_t * latency) return CUBEB_OK; } -int +static int alsa_stream_set_volume(cubeb_stream * stm, float volume) { /* setting the volume using an API call does not seem very stable/supported */ diff --git a/src/cubeb_log.h b/src/cubeb_log.h index 42ea202..d38327e 100644 --- a/src/cubeb_log.h +++ b/src/cubeb_log.h @@ -10,9 +10,17 @@ #include <stdio.h> +#ifdef __cplusplus +extern "C" { +#endif + extern cubeb_log_level g_log_level; extern cubeb_log_callback g_log_callback; +#ifdef __cplusplus +} +#endif + #define LOGV(...) do { \ LOG_INTERNAL(CUBEB_LOG_VERBOSE, __VA_ARGS__); \ } while(0) diff --git a/src/cubeb_pulse.c b/src/cubeb_pulse.c index ec89d68..5576c4c 100644 --- a/src/cubeb_pulse.c +++ b/src/cubeb_pulse.c @@ -116,7 +116,7 @@ struct cubeb_stream { cubeb_state state; }; -const float PULSE_NO_GAIN = -1.0; +static const float PULSE_NO_GAIN = -1.0; enum cork_state { UNCORK = 0, @@ -636,8 +636,8 @@ pulse_destroy(cubeb * ctx) static void pulse_stream_destroy(cubeb_stream * stm); -pa_sample_format_t -cubeb_to_pulse_format(cubeb_sample_format format) +static pa_sample_format_t +to_pulse_format(cubeb_sample_format format) { switch (format) { case CUBEB_SAMPLE_S16LE: @@ -662,7 +662,7 @@ create_pa_stream(cubeb_stream * stm, assert(stm && stream_params); *pa_stm = NULL; pa_sample_spec ss; - ss.format = cubeb_to_pulse_format(stream_params->format); + ss.format = to_pulse_format(stream_params->format); if (ss.format == PA_SAMPLE_INVALID) return CUBEB_ERROR_INVALID_FORMAT; ss.rate = stream_params->rate; @@ -835,7 +835,7 @@ pulse_stream_destroy(cubeb_stream * stm) free(stm); } -void +static void pulse_defer_event_cb(pa_mainloop_api * a, void * userdata) { cubeb_stream * stm = userdata; @@ -908,7 +908,7 @@ pulse_stream_get_position(cubeb_stream * stm, uint64_t * position) return CUBEB_OK; } -int +static int pulse_stream_get_latency(cubeb_stream * stm, uint32_t * latency) { pa_usec_t r_usec; @@ -928,14 +928,15 @@ pulse_stream_get_latency(cubeb_stream * stm, uint32_t * latency) return CUBEB_OK; } -void volume_success(pa_context *c, int success, void *userdata) +static void +volume_success(pa_context *c, int success, void *userdata) { cubeb_stream * stream = userdata; assert(success); WRAP(pa_threaded_mainloop_signal)(stream->context->mainloop, 0); } -int +static int pulse_stream_set_volume(cubeb_stream * stm, float volume) { uint32_t index; @@ -980,7 +981,7 @@ pulse_stream_set_volume(cubeb_stream * stm, float volume) return CUBEB_OK; } -int +static int pulse_stream_set_panning(cubeb_stream * stream, float panning) { const pa_channel_map * map; @@ -1222,7 +1223,8 @@ pulse_enumerate_devices(cubeb * context, cubeb_device_type type, return CUBEB_OK; } -int pulse_stream_get_current_device(cubeb_stream * stm, cubeb_device ** const device) +static int +pulse_stream_get_current_device(cubeb_stream * stm, cubeb_device ** const device) { #if PA_CHECK_VERSION(0, 9, 8) *device = calloc(1, sizeof(cubeb_device)); @@ -1245,8 +1247,9 @@ int pulse_stream_get_current_device(cubeb_stream * stm, cubeb_device ** const de #endif } -int pulse_stream_device_destroy(cubeb_stream * stream, - cubeb_device * device) +static int +pulse_stream_device_destroy(cubeb_stream * stream, + cubeb_device * device) { free(device->input_name); free(device->output_name); @@ -1254,9 +1257,10 @@ int pulse_stream_device_destroy(cubeb_stream * stream, return CUBEB_OK; } -void pulse_subscribe_callback(pa_context * ctx, - pa_subscription_event_type_t t, - uint32_t index, void * userdata) +static void +pulse_subscribe_callback(pa_context * ctx, + pa_subscription_event_type_t t, + uint32_t index, void * userdata) { cubeb * context = userdata; @@ -1289,17 +1293,19 @@ void pulse_subscribe_callback(pa_context * ctx, } } -void subscribe_success(pa_context *c, int success, void *userdata) +static void +subscribe_success(pa_context *c, int success, void *userdata) { cubeb * context = userdata; assert(success); WRAP(pa_threaded_mainloop_signal)(context->mainloop, 0); } -int pulse_register_device_collection_changed(cubeb * context, - cubeb_device_type devtype, - cubeb_device_collection_changed_callback collection_changed_callback, - void * user_ptr) +static int +pulse_register_device_collection_changed(cubeb * context, + cubeb_device_type devtype, + cubeb_device_collection_changed_callback collection_changed_callback, + void * user_ptr) { context->collection_changed_callback = collection_changed_callback; context->collection_changed_user_ptr = user_ptr; diff --git a/src/cubeb_resampler.cpp b/src/cubeb_resampler.cpp index 7b9326e..f667694 100644 --- a/src/cubeb_resampler.cpp +++ b/src/cubeb_resampler.cpp @@ -4,7 +4,6 @@ * This program is made available under an ISC-style license. See the * accompanying file LICENSE for details. */ - #ifndef NOMINMAX #define NOMINMAX #endif // NOMINMAX @@ -15,9 +14,6 @@ #include <cstring> #include <cstddef> #include <cstdio> -#if defined(HAVE_CONFIG_H) -#include "config.h" -#endif #include "cubeb_resampler.h" #include "cubeb-speex-resampler.h" #include "cubeb_resampler_internal.h" diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp index d960dfc..2cbad36 100644 --- a/src/cubeb_wasapi.cpp +++ b/src/cubeb_wasapi.cpp @@ -6,9 +6,6 @@ */ #define NOMINMAX -#if defined(HAVE_CONFIG_H) -#include "config.h" -#endif #include <initguid.h> #include <windows.h> #include <mmdeviceapi.h> diff --git a/test/test_resampler.cpp b/test/test_resampler.cpp index 00b256d..7e62a35 100644 --- a/test/test_resampler.cpp +++ b/test/test_resampler.cpp @@ -4,13 +4,13 @@ * This program is made available under an ISC-style license. See the * accompanying file LICENSE for details. */ +#ifndef NOMINMAX +#define NOMINMAX +#endif // NOMINMAX #ifdef NDEBUG #undef NDEBUG #endif -#ifndef CUBEB_GECKO_BUILD -#include "config.h" -#endif #include "cubeb_resampler_internal.h" #include <assert.h> #include <stdio.h> |