aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/courtroom.h1
-rw-r--r--src/aomusicplayer.cpp22
-rw-r--r--src/courtroom.cpp10
-rw-r--r--src/path_functions.cpp3
4 files changed, 30 insertions, 6 deletions
diff --git a/include/courtroom.h b/include/courtroom.h
index 4610130..eb33fd8 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -58,6 +58,7 @@
#include <QTextCharFormat>
//#include <QRandomGenerator>
+#include <algorithm>
#include <stack>
class AOApplication;
diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp
index 6c61b9a..585a7f4 100644
--- a/src/aomusicplayer.cpp
+++ b/src/aomusicplayer.cpp
@@ -23,14 +23,26 @@ void AOMusicPlayer::play(QString p_song, int channel, bool loop,
unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE |
BASS_UNICODE | BASS_ASYNCFILE;
- if (loop)
+ unsigned int streaming_flags = BASS_STREAM_AUTOFREE;
+ if (loop) {
flags |= BASS_SAMPLE_LOOP;
+ streaming_flags |= BASS_SAMPLE_LOOP;
+ }
DWORD newstream;
- if (f_path.endsWith(".opus"))
- newstream = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags);
- else
- newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags);
+ if (f_path.startsWith("http")) {
+ if (f_path.endsWith(".opus"))
+ newstream = BASS_OPUS_StreamCreateURL(f_path.toStdString().c_str(), 0, streaming_flags, nullptr, 0);
+ else
+ newstream = BASS_StreamCreateURL(f_path.toStdString().c_str(), 0, streaming_flags, nullptr, 0);
+
+ } else {
+ if (f_path.endsWith(".opus"))
+ newstream = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags);
+ else
+ newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags);
+ }
+
if (ao_app->get_audio_output_device() != "default")
BASS_ChannelSetDevice(m_stream_list[channel], BASS_GetDevice());
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 5f9d206..a03300e 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -3592,7 +3592,15 @@ void Courtroom::on_ooc_return_pressed()
new AOPacket("DE#" + QString::number(i) + "#%"));
}
- foreach (QString evi, casefile.childGroups()) {
+ // sort the case_evidence numerically
+ QStringList case_evidence = casefile.childGroups();
+ std::sort(case_evidence.begin(), case_evidence.end(),
+ [] (const QString &a, const QString &b) {
+ return a.toInt() < b.toInt();
+ });
+
+ // load evidence
+ foreach (QString evi, case_evidence) {
if (evi == "General")
continue;
diff --git a/src/path_functions.cpp b/src/path_functions.cpp
index b1d7976..c6c73a8 100644
--- a/src/path_functions.cpp
+++ b/src/path_functions.cpp
@@ -73,6 +73,9 @@ QString AOApplication::get_sounds_path(QString p_file)
QString AOApplication::get_music_path(QString p_song)
{
+ if (p_song.startsWith("http")) {
+ return p_song; // url
+ }
QString path = get_base_path() + "sounds/music/" + p_song;
return get_case_sensitive_path(path);
}