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. --- src/widgets/aooptionsdialog.cpp | 32 ++------------------------------ src/widgets/aooptionsdialog.h | 1 - 2 files changed, 2 insertions(+), 31 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/aooptionsdialog.cpp b/src/widgets/aooptionsdialog.cpp index 81d5eb7..eeab53b 100644 --- a/src/widgets/aooptionsdialog.cpp +++ b/src/widgets/aooptionsdialog.cpp @@ -7,7 +7,6 @@ #include "networkmanager.h" #include "options.h" -#include #include #include @@ -26,16 +25,8 @@ AOOptionsDialog::AOOptionsDialog(AOApplication *p_ao_app, QWidget *parent) void AOOptionsDialog::populateAudioDevices() { ui_audio_device_combobox->clear(); - if (needsDefaultAudioDevice()) - { - ui_audio_device_combobox->addItem("default", "default"); - } - - BASS_DEVICEINFO info; - for (int a = 0; BASS_GetDeviceInfo(a, &info); a++) - { - ui_audio_device_combobox->addItem(info.name, info.name); - } + ui_audio_device_combobox->addItem("Device selection not implemented"); + ui_audio_device_combobox->setEnabled(false); } template <> @@ -621,22 +612,3 @@ void AOOptionsDialog::timestampCbChanged(int state) { ui_log_timestamp_format_combobox->setDisabled(state == 0); } - -#if (defined(_WIN32) || defined(_WIN64)) -bool AOOptionsDialog::needsDefaultAudioDevice() -{ - return true; -} -#elif (defined(LINUX) || defined(__linux__)) -bool AOOptionsDialog::needsDefaultAudioDevice() -{ - return false; -} -#elif defined __APPLE__ -bool AOOptionsDialog::needsDefaultAudioDevice() -{ - return true; -} -#else -#error This operating system is not supported. -#endif diff --git a/src/widgets/aooptionsdialog.h b/src/widgets/aooptionsdialog.h index b89607d..ab59916 100644 --- a/src/widgets/aooptionsdialog.h +++ b/src/widgets/aooptionsdialog.h @@ -125,7 +125,6 @@ private: bool asset_cache_dirty = false; - bool needsDefaultAudioDevice(); void populateAudioDevices(); void updateValues(); -- cgit