diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index f24a760d..694c78bd 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -82,6 +82,7 @@ void SoundEngine::stopStreamingNow() m_StreamState = eMusicStreamState_Idle; m_musicID = -1; m_iMusicDelay = 0; + m_bCurrentStreamIsMenuMusic = false; } #ifdef _WINDOWS64 @@ -470,6 +471,7 @@ SoundEngine::SoundEngine() m_musicFadeSecondsRemaining = 0.0f; m_musicFadeLastUpdateTime = std::chrono::steady_clock::now(); m_bCurrentStreamIsCustom = false; + m_bCurrentStreamIsMenuMusic = true; memset(CurrentSoundsPlaying,0,sizeof(int)*(eSoundType_MAX+eSFX_MAX)); memset(m_ListenerA,0,sizeof(AUDIO_LISTENER)*XUSER_MAX_COUNT); @@ -847,6 +849,11 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, m_StreamingAudioInfo.volume = volume; m_StreamingAudioInfo.pitch = pitch; + if (name.empty() && m_musicStreamActive && isPlayingMenuMusic() && !isCustomMusicRequest(name)) + { + return; + } + bool bNextCustom = isCustomMusicRequest(name); bool bCurrentCustom = m_musicStreamActive && m_bCurrentStreamIsCustom; @@ -868,6 +875,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, { // music, or stop CD m_StreamingAudioInfo.bIs3D = false; + m_bCurrentStreamIsMenuMusic = false; // random delay of up to 3 minutes for music m_iMusicDelay = random->nextInt(20 * 60 * 3); @@ -921,6 +929,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, { // jukebox m_StreamingAudioInfo.bIs3D=true; + m_bCurrentStreamIsMenuMusic = false; m_musicID = getMusicID(name); m_iMusicDelay = 0; @@ -933,6 +942,11 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, } } +bool SoundEngine::isPlayingMenuMusic() const +{ + return m_musicStreamActive && m_bCurrentStreamIsMenuMusic; +} + bool SoundEngine::isCustomMusicRequest(const wstring& name) const { if (!name.empty()) diff --git a/Minecraft.Client/Common/Audio/SoundEngine.h b/Minecraft.Client/Common/Audio/SoundEngine.h index 3fe3f9dd..3d5be955 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.h +++ b/Minecraft.Client/Common/Audio/SoundEngine.h @@ -136,6 +136,7 @@ public: void stopElytraSound(); void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) override; void stopStreamingNow(); + bool isPlayingMenuMusic() const; void playUI(int iSound, float volume, float pitch) override; void playMusicTick() override; void updateMusicVolume(float fVal) override; @@ -173,6 +174,7 @@ private: float m_musicFadeSecondsRemaining; std::chrono::steady_clock::time_point m_musicFadeLastUpdateTime; bool m_bCurrentStreamIsCustom; + bool m_bCurrentStreamIsMenuMusic; ma_engine m_engine; ma_engine_config m_engineConfig; diff --git a/Minecraft.Client/Common/Media/MediaWindows64/Graphics/ControlType/HD/windowsHD.swf b/Minecraft.Client/Common/Media/MediaWindows64/Graphics/ControlType/HD/windowsHD.swf index 6dd961b2..f720dc6f 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/Graphics/ControlType/HD/windowsHD.swf and b/Minecraft.Client/Common/Media/MediaWindows64/Graphics/ControlType/HD/windowsHD.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/Graphics/ControlType/HD/xboxOne.swf b/Minecraft.Client/Common/Media/MediaWindows64/Graphics/ControlType/HD/xboxOne.swf deleted file mode 100644 index 464cb346..00000000 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/Graphics/ControlType/HD/xboxOne.swf and /dev/null differ diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 3174d358..11cb68d9 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -4563,8 +4563,17 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt // Stop menu music and transition to game music for the new level if (soundEngine != nullptr) { - soundEngine->stopStreamingNow(); - soundEngine->playStreaming(L"", 0, 0, 0, 1, 1); + const bool hasCustomMusic = (Minecraft::GetInstance() != nullptr && + Minecraft::GetInstance()->skins != nullptr && + Minecraft::GetInstance()->skins->getSelected() != nullptr && + Minecraft::GetInstance()->skins->getSelected()->hasAudio()); + const bool isMenuMusic = soundEngine->isPlayingMenuMusic(); + + if (hasCustomMusic || !isMenuMusic) + { + soundEngine->stopStreamingNow(); + soundEngine->playStreaming(L"", 0, 0, 0, 1, 1); + } } // 4J - stop update thread from processing this level, which blocks until it is safe to move on - will be re-enabled if we set the level to be non-nullptr