aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2022-02-20 19:17:11 -0600
committerGitHub <noreply@github.com>2022-02-20 19:17:11 -0600
commitf3d2e7078cbb0ffa9669f3c585f5f61be3947dcd (patch)
tree70053531267442ce4694ef2aab98602dc88b02e9
parent7ecb43d3a26747f16a6d8692528f0cf1835de368 (diff)
parent39fbd4a881d590d26211e5bbf2a4a6c0f554fe2a (diff)
Merge pull request #664 from AttorneyOnline/fix-music-segfaults
Don't run the base content vpath shenanigans if music path is HTTP
-rw-r--r--src/aomusicplayer.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp
index 16d6df7a..5d9df792 100644
--- a/src/aomusicplayer.cpp
+++ b/src/aomusicplayer.cpp
@@ -20,8 +20,6 @@ QString AOMusicPlayer::play(QString p_song, int channel, bool loop,
channel = channel % m_channelmax;
if (channel < 0) // wtf?
return "[ERROR] Invalid Channel";
- QString f_path = ao_app->get_real_path(ao_app->get_music_path(p_song));
-
unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE |
BASS_UNICODE | BASS_ASYNCFILE;
unsigned int streaming_flags = BASS_STREAM_AUTOFREE;
@@ -29,7 +27,7 @@ QString AOMusicPlayer::play(QString p_song, int channel, bool loop,
flags |= BASS_SAMPLE_LOOP;
streaming_flags |= BASS_SAMPLE_LOOP;
}
-
+ QString f_path = p_song;
DWORD newstream;
if (f_path.startsWith("http")) {
if (f_path.endsWith(".opus"))
@@ -38,6 +36,7 @@ QString AOMusicPlayer::play(QString p_song, int channel, bool loop,
newstream = BASS_StreamCreateURL(f_path.toStdString().c_str(), 0, streaming_flags, nullptr, 0);
} else {
+ f_path = ao_app->get_real_path(ao_app->get_music_path(p_song));
if (f_path.endsWith(".opus"))
newstream = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags);
else
@@ -46,7 +45,7 @@ QString AOMusicPlayer::play(QString p_song, int channel, bool loop,
int error_code = BASS_ErrorGetCode();
- if (invoking_future.isCanceled() && channel == 0) {
+ if (invoking_future.isCanceled()) {
// Target future has changed. This stream has become irrelevant.
// So even if the stream manages to finish after the latest one, we don't run
// into order issues.