Skip to content

Commit

Permalink
Experimental portaudio-based backend
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Apr 11, 2019
2 parents d22cb52 + 9cb578c commit 23d6807
Show file tree
Hide file tree
Showing 3 changed files with 519 additions and 3 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,26 @@ project(libstdaudio)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")

if (APPLE)
set(CMAKE_EXE_LINKER_FLAGS "-framework CoreAudio")
endif ()

include_directories(include)

add_executable(white_noise examples/white_noise.cpp)
target_link_libraries(white_noise PRIVATE ${CMAKE_DL_LIBS})
add_executable(print_devices examples/print_devices.cpp)
target_link_libraries(print_devices PRIVATE ${CMAKE_DL_LIBS})
add_executable(sine_wave examples/sine_wave.cpp)
target_link_libraries(sine_wave PRIVATE ${CMAKE_DL_LIBS})
add_executable(melody examples/melody.cpp)
target_link_libraries(melody PRIVATE ${CMAKE_DL_LIBS})
add_executable(level_meter examples/level_meter.cpp)
target_link_libraries(level_meter PRIVATE ${CMAKE_DL_LIBS})

add_executable(test
test/test_main.cpp
# test/null_backend_test.cpp // TODO: fix linker error when uncommenting this one!
test/default_backend_test.cpp)
test/default_backend_test.cpp)

target_link_libraries(test PRIVATE ${CMAKE_DL_LIBS})
10 changes: 9 additions & 1 deletion include/audio
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ struct audio_null_driver_t {};
struct __coreaudio_driver_t {};
using audio_default_driver_t = __coreaudio_driver_t;
#else
using audio_default_driver_t = audio_null_driver_t;

#if __has_include(<portaudio.h>)
struct __portaudio_driver_t {};
using audio_default_driver_t = __portaudio_driver_t;
#endif

#endif // __APPLE__

_LIBSTDAUDIO_NAMESPACE_END
Expand All @@ -39,3 +44,6 @@ _LIBSTDAUDIO_NAMESPACE_END
#ifdef __APPLE__
#include <audio_backend/__coreaudio_backend.h>
#endif // __APPLE__
#if __has_include(<portaudio.h>)
#include <audio_backend/__portaudio_backend.h>
#endif // __APPLE__
Loading

0 comments on commit 23d6807

Please sign in to comment.