diff options
| author | stonedDiscord <stoned@derpymail.org> | 2020-04-19 16:10:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-19 16:10:59 +0200 |
| commit | 1e2d71fb96ca85fa50c172c2f1cf22b2620bacd2 (patch) | |
| tree | 0a44410f2422bbaeec1cb6672a8ab5611344029c | |
| parent | c0f579864bc00cf20c6cccbaa389a100858d20bc (diff) | |
| parent | 02dd9b0a35a2617a02f8f8abba03404c49b98ca2 (diff) | |
Merge pull request #134 from AttorneyOnline/streammusic
Streaming music
| -rw-r--r-- | src/aomusicplayer.cpp | 6 | ||||
| -rw-r--r-- | src/path_functions.cpp | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 74dcc639..93878898 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -18,7 +18,11 @@ void AOMusicPlayer::play(QString p_song) f_path = ao_app->get_music_path(p_song); - m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + if (p_song.startsWith("http")) { + m_stream = BASS_StreamCreateURL(f_path.toStdWString().c_str(), 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE, NULL, NULL); + } else { + m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + } this->set_volume(m_volume); diff --git a/src/path_functions.cpp b/src/path_functions.cpp index 72b7accc..37daa038 100644 --- a/src/path_functions.cpp +++ b/src/path_functions.cpp @@ -99,7 +99,11 @@ QString AOApplication::get_music_path(QString p_song) QString withending_check = get_base_path() + "sounds/music/" + p_song; QString mp3_check = get_base_path() + "sounds/music/" + p_song + ".mp3"; QString opus_check = get_base_path() + "sounds/music/" + p_song + ".opus"; - if (file_exists(opus_check)) + if (p_song.startsWith("http")) { + //it's an URL + return p_song; + } + else if (file_exists(opus_check)) { #ifndef CASE_SENSITIVE_FILESYSTEM return opus_check; |
