diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f53b981..81c2f605 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,12 +22,18 @@ else() endif() if(TARGET SDL3::SDL3) - target_sources(mcpelauncher-client PRIVATE src/jni/sdl3audio.cpp src/jni/sdl3audio.h) + message(VERBOSE "USING SDL3") target_link_libraries(mcpelauncher-client SDL3::SDL3) - target_compile_definitions(mcpelauncher-client PRIVATE HAVE_SDL3AUDIO) -else() - find_package(PulseAudio) + if (USE_SDL3_AUDIO) + message(VERBOSE "USING SDL3AUDIO") + target_sources(mcpelauncher-client PRIVATE src/jni/sdl3audio.cpp src/jni/sdl3audio.h) + target_compile_definitions(mcpelauncher-client PRIVATE HAVE_SDL3AUDIO) + endif() +endif() +if (NOT USE_SDL3_AUDIO) + find_package(PulseAudio) + message(STATUS "USING EXPERIMENTAL PULSEAUDIO BACKEND") if (PULSEAUDIO_FOUND AND PULSEAUDIOSIMPLE_FOUND) target_sources(mcpelauncher-client PRIVATE src/jni/pulseaudio.cpp src/jni/pulseaudio.h) target_link_libraries(mcpelauncher-client ${PULSEAUDIO_LIBRARIES} ${PULSEAUDIOSIMPLE_LIBRARIES}) diff --git a/src/jni/pulseaudio.cpp b/src/jni/pulseaudio.cpp index e783281b..1c812cd9 100644 --- a/src/jni/pulseaudio.cpp +++ b/src/jni/pulseaudio.cpp @@ -52,7 +52,7 @@ void AudioDevice::write(std::shared_ptr data, FakeJni::JInt void AudioDevice::write2(std::shared_ptr data, FakeJni::JInt length) { int error = 0; - if(s && pa_simple_write(s, data->getArray(), length, &error)) { + if(s && pa_simple_write(s, data->getArray(), length * 2, &error)) { pa_simple_free(s); s = nullptr; auto errormsg = pa_strerror(error);