From c210bb0e883976ffc879ebd3d66fd188717b38f9 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 15 Nov 2015 13:13:44 +0100 Subject: [PATCH] Fixed: Display title and artist name from ogg files in music player --- code/nel/src/sound/audio_mixer_user.cpp | 33 ++++++++++++------- .../client/src/interface_v3/music_player.cpp | 2 +- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/code/nel/src/sound/audio_mixer_user.cpp b/code/nel/src/sound/audio_mixer_user.cpp index bb79359e1..9ac90b3c7 100644 --- a/code/nel/src/sound/audio_mixer_user.cpp +++ b/code/nel/src/sound/audio_mixer_user.cpp @@ -2690,21 +2690,30 @@ bool CAudioMixerUser::getSongTitle(const std::string &filename, std::string &res { std::string artist; std::string title; - if (_SoundDriver->getMusicInfo(filename, artist, title)) + + if (!_SoundDriver->getMusicInfo(filename, artist, title)) { - if (!title.empty()) - { - if (!artist.empty()) result = artist + " - " + title; - else result = title; - } - else if (!artist.empty()) - { - result = artist + " - " + CFile::getFilename(filename); - } - else result = CFile::getFilename(filename); - return true; + // use 3rd party libraries supported formats + IAudioDecoder::getInfo(filename, artist, title); } + + if (!title.empty()) + { + if (!artist.empty()) result = artist + " - " + title; + else result = title; + } + else if (!artist.empty()) + { + result = artist + " - " + CFile::getFilename(filename); + } + else + { + result = CFile::getFilename(filename); + } + + return true; } + result = "???"; return false; } diff --git a/code/ryzom/client/src/interface_v3/music_player.cpp b/code/ryzom/client/src/interface_v3/music_player.cpp index 639c170c0..64107a916 100644 --- a/code/ryzom/client/src/interface_v3/music_player.cpp +++ b/code/ryzom/client/src/interface_v3/music_player.cpp @@ -83,7 +83,7 @@ void CMusicPlayer::play () CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:mp3_player:screen:text")); if (pVT) - pVT->setText (_Songs[_CurrentSong].Title); + pVT->setText (ucstring::makeFromUtf8(_Songs[_CurrentSong].Title)); } }