diff options
-rw-r--r-- | .gitmodules | 6 | ||||
m--------- | lib/sdl2 | 0 | ||||
-rw-r--r-- | lib/soloud/CMakeLists.txt | 97 | ||||
m--------- | lib/soloud/src | 0 | ||||
-rw-r--r-- | mwe/audio/bgm.ogg | bin | 0 -> 125020 bytes | |||
-rw-r--r-- | mwe/audio/sfx1.wav | bin | 0 -> 44144 bytes | |||
-rw-r--r-- | mwe/audio/sfx2.wav | bin | 0 -> 44144 bytes | |||
-rw-r--r-- | mwe/audio/sfx3.wav | bin | 0 -> 44144 bytes | |||
-rw-r--r-- | mwe/audio/soloud/CMakeLists.txt | 19 | ||||
-rw-r--r-- | mwe/audio/soloud/main.cpp | 48 |
10 files changed, 170 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules index f8a9861..ba367bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,3 +3,9 @@ url = https://github.com/google/googletest branch = v1.15.x shallow = true +[submodule "lib/soloud/src"] + path = lib/soloud/src + url = https://github.com/jarikomppa/soloud +[submodule "lib/sdl2"] + path = lib/sdl2 + url = https://github.com/libsdl-org/SDL diff --git a/lib/sdl2 b/lib/sdl2 new file mode 160000 +Subproject 9519b9916cd29a14587af0507292f2bd31dd575 diff --git a/lib/soloud/CMakeLists.txt b/lib/soloud/CMakeLists.txt new file mode 100644 index 0000000..8433281 --- /dev/null +++ b/lib/soloud/CMakeLists.txt @@ -0,0 +1,97 @@ +cmake_minimum_required(VERSION 3.28) + +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 20) + +add_compile_definitions(WITH_SDL2) + +add_subdirectory(../sdl2 sdl2) + +project(soloud C CXX) + +add_library(soloud STATIC + src/src/audiosource/ay/chipplayer.cpp + src/src/audiosource/ay/sndbuffer.cpp + src/src/audiosource/ay/sndchip.cpp + src/src/audiosource/ay/sndrender.cpp + src/src/audiosource/ay/soloud_ay.cpp + src/src/audiosource/monotone/soloud_monotone.cpp + src/src/audiosource/noise/soloud_noise.cpp + src/src/audiosource/openmpt/soloud_openmpt.cpp + src/src/audiosource/openmpt/soloud_openmpt_dll.c + src/src/audiosource/sfxr/soloud_sfxr.cpp + src/src/audiosource/speech/darray.cpp + src/src/audiosource/speech/klatt.cpp + src/src/audiosource/speech/resonator.cpp + src/src/audiosource/speech/soloud_speech.cpp + src/src/audiosource/speech/tts.cpp + src/src/audiosource/tedsid/sid.cpp + src/src/audiosource/tedsid/soloud_tedsid.cpp + src/src/audiosource/tedsid/ted.cpp + src/src/audiosource/vic/soloud_vic.cpp + src/src/audiosource/vizsn/soloud_vizsn.cpp + src/src/audiosource/wav/dr_impl.cpp + src/src/audiosource/wav/soloud_wav.cpp + src/src/audiosource/wav/soloud_wavstream.cpp + src/src/audiosource/wav/stb_vorbis.c + + src/src/backend/alsa/soloud_alsa.cpp + src/src/backend/coreaudio/soloud_coreaudio.cpp + src/src/backend/jack/soloud_jack.cpp + src/src/backend/miniaudio/soloud_miniaudio.cpp + src/src/backend/nosound/soloud_nosound.cpp + src/src/backend/null/soloud_null.cpp + src/src/backend/openal/soloud_openal.cpp + src/src/backend/openal/soloud_openal_dll.c + src/src/backend/opensles/soloud_opensles.cpp + src/src/backend/oss/soloud_oss.cpp + src/src/backend/portaudio/soloud_portaudio.cpp + src/src/backend/portaudio/soloud_portaudio_dll.c + src/src/backend/sdl/soloud_sdl1.cpp + src/src/backend/sdl/soloud_sdl1_dll.c + src/src/backend/sdl/soloud_sdl2.cpp + src/src/backend/sdl/soloud_sdl2_dll.c + src/src/backend/sdl2_static/soloud_sdl2_static.cpp + src/src/backend/sdl_static/soloud_sdl_static.cpp + src/src/backend/wasapi/soloud_wasapi.cpp + src/src/backend/winmm/soloud_winmm.cpp + src/src/backend/xaudio2/soloud_xaudio2.cpp + + src/src/core/soloud.cpp + src/src/core/soloud_audiosource.cpp + src/src/core/soloud_bus.cpp + src/src/core/soloud_core_3d.cpp + src/src/core/soloud_core_basicops.cpp + src/src/core/soloud_core_faderops.cpp + src/src/core/soloud_core_filterops.cpp + src/src/core/soloud_core_getters.cpp + src/src/core/soloud_core_setters.cpp + src/src/core/soloud_core_voicegroup.cpp + src/src/core/soloud_core_voiceops.cpp + src/src/core/soloud_fader.cpp + src/src/core/soloud_fft.cpp + src/src/core/soloud_fft_lut.cpp + src/src/core/soloud_file.cpp + src/src/core/soloud_filter.cpp + src/src/core/soloud_misc.cpp + src/src/core/soloud_queue.cpp + src/src/core/soloud_thread.cpp + + # src/src/filter/soloud_bassboostfilter.cpp + # src/src/filter/soloud_biquadresonantfilter.cpp + # src/src/filter/soloud_dcremovalfilter.cpp + # src/src/filter/soloud_duckfilter.cpp + # src/src/filter/soloud_echofilter.cpp + # src/src/filter/soloud_eqfilter.cpp + # src/src/filter/soloud_fftfilter.cpp + # src/src/filter/soloud_flangerfilter.cpp + # src/src/filter/soloud_freeverbfilter.cpp + # src/src/filter/soloud_lofifilter.cpp + # src/src/filter/soloud_robotizefilter.cpp + # src/src/filter/soloud_waveshaperfilter.cpp +) +target_include_directories(soloud PRIVATE src/include) +target_include_directories(soloud SYSTEM INTERFACE src/include) + +target_link_libraries(soloud PRIVATE SDL2) + diff --git a/lib/soloud/src b/lib/soloud/src new file mode 160000 +Subproject e82fd32c1f62183922f08c14c814a02b58db187 diff --git a/mwe/audio/bgm.ogg b/mwe/audio/bgm.ogg Binary files differnew file mode 100644 index 0000000..d6397fb --- /dev/null +++ b/mwe/audio/bgm.ogg diff --git a/mwe/audio/sfx1.wav b/mwe/audio/sfx1.wav Binary files differnew file mode 100644 index 0000000..576377a --- /dev/null +++ b/mwe/audio/sfx1.wav diff --git a/mwe/audio/sfx2.wav b/mwe/audio/sfx2.wav Binary files differnew file mode 100644 index 0000000..908ec86 --- /dev/null +++ b/mwe/audio/sfx2.wav diff --git a/mwe/audio/sfx3.wav b/mwe/audio/sfx3.wav Binary files differnew file mode 100644 index 0000000..20b7c84 --- /dev/null +++ b/mwe/audio/sfx3.wav diff --git a/mwe/audio/soloud/CMakeLists.txt b/mwe/audio/soloud/CMakeLists.txt new file mode 100644 index 0000000..f2df20a --- /dev/null +++ b/mwe/audio/soloud/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.28) + +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) +set(CMAKE_BUILD_TYPE Debug) + +add_subdirectory(../../../lib/soloud soloud) + +project(poc C CXX) + +add_executable(main + main.cpp +) + +target_link_libraries(main + soloud +) + diff --git a/mwe/audio/soloud/main.cpp b/mwe/audio/soloud/main.cpp new file mode 100644 index 0000000..25ba003 --- /dev/null +++ b/mwe/audio/soloud/main.cpp @@ -0,0 +1,48 @@ +#include <soloud.h> +#include <soloud_wav.h> +#include <soloud_wavstream.h> + +#include <chrono> +#include <thread> + +using namespace std; +using namespace std::chrono_literals; + +int main() { + SoLoud::Soloud soloud; + soloud.init(); + + // load background track + SoLoud::WavStream bgm; + bgm.load("../bgm.ogg"); + // NOTE: SoLoud::Wav is poorly named as it also supports FLAC, MP3 and OGG + + // load three short samples + SoLoud::Wav sfx[3]; + sfx[0].load("../sfx1.wav"); + sfx[1].load("../sfx2.wav"); + sfx[2].load("../sfx3.wav"); + + // start the background track + SoLoud::handle bgm_handle = soloud.play(bgm); + + // play each sample sequentially + this_thread::sleep_for(500ms); + soloud.play(sfx[0]); + this_thread::sleep_for(500ms); + soloud.play(sfx[1]); + soloud.setPause(bgm_handle, true); + this_thread::sleep_for(500ms); + soloud.play(sfx[2]); + soloud.setPause(bgm_handle, false); + this_thread::sleep_for(500ms); + + // play all samples simultaniously + for (unsigned i = 0; i < 3; i++) + soloud.play(sfx[i]); + this_thread::sleep_for(1000ms); + + // stop all audio and exit + soloud.deinit(); + return 0; +} |