Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed MIDI, removed undocumented (yet supported) formats #1008

Merged
merged 2 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 1 addition & 7 deletions src/aoapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
#include "options.h"
#include "widgets/aooptionsdialog.h"

#include <bassmidi.h>

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);
Expand Down Expand Up @@ -221,33 +220,28 @@ void AOApplication::initBASS()
BASS_Init(static_cast<int>(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.
Expand Down
14 changes: 2 additions & 12 deletions src/aomusicplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/text_file_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down