From 3f6fb17deddd1b366d16db5a2531c82407ced9db Mon Sep 17 00:00:00 2001 From: Osmium Sorcerer Date: Tue, 24 Mar 2026 02:56:23 +0000 Subject: Rewrite audio engine: replace BASS with miniaudio SFX and blip players largely remain the same. For the music player, we now have to implement network streaming natively, we no longer have a convenient function that did everything for us. I introduced QNetworkRequest to download the stream in memory and signal when it's ready to be decoded and played back. The size is guarded to prevent the client from accidentally downloading terabytes of audio. Delete QFutureWatcher, we no longer need it for concurrency. miniaudio uses a separate audio thread. Network donwloads and communication with the track name display are handled by Qt signals. Also, delete an odd "music.txt" feature. Its purpose was specifying offsets for loops in a text file per track, but it remained obscure and unused in practice. Unsupported: - Large streams, including unbounded ones (radio). We'll need a ring buffer for that, and a mechanism to write to it from the network and feed it to the audio thread. - Effect flags: fade in, fade out, sync pos. Ignored. - Audio device selection. --- CMakeLists.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 4942736..c7700c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,9 @@ option(AO_ENABLE_DISCORD_RPC "Enable Discord Rich Presence" OFF) find_package(QT NAMES Qt6) find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets Concurrent WebSockets UiTools) +find_package(PkgConfig REQUIRED) +pkg_check_modules(Vorbisfile REQUIRED IMPORTED_TARGET vorbisfile) +pkg_check_modules(Opusfile REQUIRED IMPORTED_TARGET opusfile) qt_add_executable(Attorney_Online src/aoapplication.cpp @@ -103,6 +106,12 @@ qt_add_executable(Attorney_Online src/screenslidetimer.h src/screenslidetimer.cpp src/moderation_functions.h src/moderation_functions.cpp src/network/serverinfo.h src/network/serverinfo.cpp + third_party/miniaudio.h + third_party/miniaudio.c + third_party/miniaudio_libvorbis.h + third_party/miniaudio_libvorbis.c + third_party/miniaudio_libopus.h + third_party/miniaudio_libopus.c ) if(CMAKE_BUILD_TYPE STREQUAL "Dev") @@ -131,7 +140,7 @@ if(WIN32) endif() endif() -target_include_directories(Attorney_Online PRIVATE src lib) +target_include_directories(Attorney_Online PRIVATE src lib third_party) target_link_directories(Attorney_Online PRIVATE lib) target_link_libraries(Attorney_Online PRIVATE Qt${QT_VERSION_MAJOR}::Core @@ -141,8 +150,8 @@ target_link_libraries(Attorney_Online PRIVATE Qt${QT_VERSION_MAJOR}::Concurrent Qt${QT_VERSION_MAJOR}::WebSockets Qt${QT_VERSION_MAJOR}::UiTools - bass - bassopus + PkgConfig::Vorbisfile + PkgConfig::Opusfile ) if(AO_ENABLE_DISCORD_RPC) -- cgit