Skip to content

Commit

Permalink
actually do what 0c976a2 was meant to
Browse files Browse the repository at this point in the history
this alters the condition that ignores queued music if it's the same as the currently playing music, seeing as there's no way to access the params for playing without changing the currently playing music, waiting for the updates to finish setting properly, then changing the music back to what we originally wanted to play, and given that for whatever reason this breaks completely when using actual song timing, the condition now requires the songtiming for the queued musictoplay to be not null in order to ignore the playmusic request
  • Loading branch information
MinaciousGrace committed Nov 25, 2018
1 parent a47dc0a commit 8921bff
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ local function toggleNoteField()
return end

if song then
song:Borp()
if mcbootlarder:GetVisible() then
mcbootlarder:visible(false)
mcbootlarder:GetChild("NoteField"):visible(false)
MESSAGEMAN:Broadcast("ChartPreviewOff")
else
mcbootlarder:visible(true)
mcbootlarder:GetChild("NoteField"):visible(true)
song:Borp()
MESSAGEMAN:Broadcast("ChartPreviewOn")
end
end
Expand Down
3 changes: 2 additions & 1 deletion src/GameSoundManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ StartMusic(MusicToPlay& ToPlay)
{
LockMutex L(*g_Mutex);
if (g_Playing->m_Music->IsPlaying() &&
g_Playing->m_Music->GetLoadedFilePath().EqualsNoCase(ToPlay.m_sFile))
g_Playing->m_Music->GetLoadedFilePath().EqualsNoCase(ToPlay.m_sFile) &&
ToPlay.HasTiming)
return;

/* We're changing or stopping the music. If we were dimming, reset. */
Expand Down
20 changes: 16 additions & 4 deletions src/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2052,15 +2052,27 @@ void
Song::Borp()
{
GameSoundManager::PlayMusicParams PlayParams;
PlayParams.sFile = m_sMusicFile;
PlayParams.pTiming = &this->m_SongTiming;
PlayParams.sFile = GetMusicPath();
PlayParams.pTiming = nullptr;
PlayParams.bForceLoop = true;
PlayParams.fStartSecond = m_fMusicSampleStartSeconds;
PlayParams.fLengthSeconds = GetLastSecond() + 2.f;
PlayParams.fLengthSeconds = GetLastSecond() - m_fMusicSampleStartSeconds + 2.f;
PlayParams.fFadeOutLengthSeconds = 1.f;
PlayParams.bAlignBeat = true;
PlayParams.bApplyMusicRate = true;
SOUND->PlayMusic(PlayParams);

GameSoundManager::PlayMusicParams FallbackMusic;
FallbackMusic.sFile = GetMusicPath();
FallbackMusic.fFadeInLengthSeconds = 1.f;
FallbackMusic.bAlignBeat = true;

if (PlayParams.fLengthSeconds <
3.f) { // if the songpreview is after the last note
PlayParams.fStartSecond =
5.f; // chartpreview wont play, just set it near the start -mina
PlayParams.fLengthSeconds = GetLastSecond() + 2.f;
}
SOUND->PlayMusic(PlayParams, FallbackMusic);
}

// lua start
Expand Down

0 comments on commit 8921bff

Please sign in to comment.