From ebb75008f8552ad3e4a1ee7d46d28efa586b691a Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 14 Sep 2023 09:17:59 +0400 Subject: [PATCH] Do not use playlist for title music --- apps/openmw/engine.cpp | 8 +++++++- apps/openmw/mwsound/soundmanagerimp.cpp | 17 ++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 2966800014..df89cd3eb6 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -913,7 +913,13 @@ void OMW::Engine::go() { // start in main menu mWindowManager->pushGuiMode(MWGui::GM_MainMenu); - mSoundManager->playPlaylist("Title"); + + std::string titlefile = "music/special/morrowind title.mp3"; + if (mVFS->exists(titlefile)) + mSoundManager->streamMusic(titlefile, MWSound::MusicType::Special); + else + Log(Debug::Warning) << "Title music not found"; + std::string_view logo = Fallback::Map::getString("Movies_Morrowind_Logo"); if (!logo.empty()) mWindowManager->playVideo(logo, /*allowSkipping*/ true, /*overrideSounds*/ false); diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 9cc67f5af4..be8bae20a6 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -132,15 +132,6 @@ namespace MWSound Log(Debug::Info) << stream.str(); } - - // TODO: dehardcode this - std::vector titleMusic; - std::string_view titlefile = "music/special/morrowind title.mp3"; - if (mVFS->exists(titlefile)) - titleMusic.emplace_back(titlefile); - else - Log(Debug::Warning) << "Title music not found"; - mMusicFiles["Title"] = titleMusic; } SoundManager::~SoundManager() @@ -1143,6 +1134,14 @@ namespace MWSound if (!mOutput->isInitialized() || mPlaybackPaused) return; + MWBase::StateManager::State state = MWBase::Environment::get().getStateManager()->getState(); + if (state == MWBase::StateManager::State_NoGame && !isMusicPlaying()) + { + std::string titlefile = "music/special/morrowind title.mp3"; + if (mVFS->exists(titlefile)) + streamMusic(titlefile, MWSound::MusicType::Special); + } + updateSounds(duration); if (MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_NoGame) {