From a8d2299c47bd09283cb817102a1558d001b46bf1 Mon Sep 17 00:00:00 2001 From: TrickyLeifa Date: Sun, 7 Jul 2024 14:23:14 +0200 Subject: [PATCH 1/2] Removed MIDI, removed undocumented (yet supported) formats Resolve #1006 --- CMakeLists.txt | 12 +++++++++++- src/aoapplication.cpp | 8 +------- src/aomusicplayer.cpp | 14 ++------------ src/text_file_functions.cpp | 2 +- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fabdcffc..8488259b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,7 +117,17 @@ endif() target_include_directories(Attorney_Online PRIVATE src lib) target_link_directories(Attorney_Online PRIVATE lib) -target_link_libraries(Attorney_Online PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Concurrent Qt${QT_VERSION_MAJOR}::WebSockets Qt${QT_VERSION_MAJOR}::UiTools bass bassopus bassmidi) +target_link_libraries(Attorney_Online PRIVATE + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::Network + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Concurrent + Qt${QT_VERSION_MAJOR}::WebSockets + Qt${QT_VERSION_MAJOR}::UiTools + bass + bassopus +) if(AO_ENABLE_DISCORD_RPC) target_compile_definitions(Attorney_Online PRIVATE AO_ENABLE_DISCORD_RPC) diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index f3260ed23..7a8e4ea3e 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -7,10 +7,9 @@ #include "options.h" #include "widgets/aooptionsdialog.h" -#include - static QtMessageHandler original_message_handler; static AOApplication *message_handler_context; + void message_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { Q_EMIT message_handler_context->qt_log_message(type, context, msg); @@ -221,33 +220,28 @@ void AOApplication::initBASS() BASS_Init(static_cast(a), 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); load_bass_plugins(); qInfo() << info.name << "was set as the default audio output device."; - BASS_SetConfigPtr(BASS_CONFIG_MIDI_DEFFONT, QString(get_base_path() + "soundfont.sf2").toStdString().c_str()); return; } } BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); load_bass_plugins(); } - BASS_SetConfigPtr(BASS_CONFIG_MIDI_DEFFONT, QString(get_base_path() + "soundfont.sf2").toStdString().c_str()); } #if (defined(_WIN32) || defined(_WIN64)) void AOApplication::load_bass_plugins() { BASS_PluginLoad("bassopus.dll", 0); - BASS_PluginLoad("bassmidi.dll", 0); } #elif defined __APPLE__ void AOApplication::load_bass_plugins() { BASS_PluginLoad("libbassopus.dylib", 0); - BASS_PluginLoad("libbassmidi.dylib", 0); } #elif (defined(LINUX) || defined(__linux__)) void AOApplication::load_bass_plugins() { BASS_PluginLoad("libbassopus.so", 0); - BASS_PluginLoad("libbassmidi.so", 0); } #else #error This operating system is unsupported for BASS plugins. diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 4265a4637..c4a562cb1 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -35,7 +35,7 @@ QString AOMusicPlayer::playStream(QString song, int streamId, bool loopEnabled, } QString f_path = song; - DWORD newstream; + HSTREAM newstream; if (f_path.startsWith("http")) { if (!Options::getInstance().streamingEnabled()) @@ -51,17 +51,7 @@ QString AOMusicPlayer::playStream(QString song, int streamId, bool loopEnabled, flags |= BASS_STREAM_PRESCAN | BASS_UNICODE | BASS_ASYNCFILE; f_path = ao_app->get_real_path(ao_app->get_music_path(song)); - - QString extension = f_path.split('.').last(); - static const QStringList VALID_EXTENSION_LIST{"mo3", "xm", "mod", "s3m", "it", "mtm", "umx"}; - if (VALID_EXTENSION_LIST.contains(extension, Qt::CaseInsensitive)) - { - newstream = BASS_MusicLoad(FALSE, f_path.utf16(), 0, 0, flags, 1); - } - else - { - newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); - } + newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); } int error = BASS_ErrorGetCode(); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 35efe20c3..763efb58e 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -360,7 +360,7 @@ QString AOApplication::get_court_sfx(QString p_identifier, QString p_misc) QString AOApplication::get_sfx_suffix(VPath sound_to_check) { - QStringList suffixes = {".opus", ".ogg", ".mp3", ".wav", ".mid", ".midi", ".xm", ".it", ".s3m", ".mod", ".mtm", ".umx"}; + QStringList suffixes = {".opus", ".ogg", ".mp3", ".wav"}; // Check if we were provided a direct filepath with a suffix already QString path = sound_to_check.toQString(); // Loop through our suffixes From 53354e85a5fa1cd2d70c53e4dda4811dd7cd49f0 Mon Sep 17 00:00:00 2001 From: TrickyLeifa Date: Sun, 7 Jul 2024 14:26:24 +0200 Subject: [PATCH 2/2] Adjusted CI for MIDI removal --- .github/workflows/build.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 93f18fd9f..b0fd027e5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,12 +60,6 @@ jobs: cp ./bass/c/x64/bass.lib ./lib/ cp ./bass/x64/bass.dll ./bin/ - curl http://www.un4seen.com/files/bassmidi24.zip -o bassmidi.zip - unzip -d bass -o bassmidi.zip - cp ./bass/c/bassmidi.h ./lib - cp ./bass/c/x64/bassmidi.lib ./lib/ - cp ./bass/x64/bassmidi.dll ./bin/ - curl http://www.un4seen.com/files/bassopus24.zip -o bassopus.zip unzip -d bass -o bassopus.zip cp ./bass/c/bassopus.h ./lib @@ -149,12 +143,6 @@ jobs: cp ./bass/libs/x86_64/libbass.so ./lib/ cp ./bass/libs/x86_64/libbass.so ./bin/ - curl http://www.un4seen.com/files/bassmidi24-linux.zip -o bassmidi.zip - unzip -d bass -o bassmidi.zip - cp ./bass/bassmidi.h ./lib - cp ./bass/libs/x86_64/libbassmidi.so ./lib/ - cp ./bass/libs/x86_64/libbassmidi.so ./bin/ - curl http://www.un4seen.com/files/bassopus24-linux.zip -o bassopus.zip unzip -d bass -o bassopus.zip cp ./bass/bassopus.h ./lib