Skip to content

Commit

Permalink
dont attempt to play impossible sample music after playlist creation
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Nov 12, 2021
1 parent 048cb61 commit f8d1b0e
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions src/Etterna/Screen/Others/ScreenSelectMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ ScreenSelectMusic::Input(const InputEventPlus& input)
return true;
} else if (bHoldingCtrl && c == 'P' && m_MusicWheel.IsSettled() &&
input.type == IET_FIRST_PRESS) {
ScreenTextEntry::s_bMustResetInputRedirAtClose = true;
ScreenTextEntry::TextEntry(
SM_BackFromNamePlaylist, NAME_PLAYLIST, "", 128);
MESSAGEMAN->Broadcast("DisplayAll");
Expand Down Expand Up @@ -1079,22 +1080,24 @@ ScreenSelectMusic::HandleScreenMessage(const ScreenMessage& SM)
// restart preview music after finishing or cancelling playlist creation
// this is just copypasta'd and should be made a function? or we have
// something better? idk
GameSoundManager::PlayMusicParams PlayParams;
PlayParams.sFile = HandleLuaMusicFile(m_sSampleMusicToPlay);
PlayParams.pTiming = m_pSampleMusicTimingData;
PlayParams.bForceLoop = SAMPLE_MUSIC_LOOPS;
PlayParams.fStartSecond = m_fSampleStartSeconds;
PlayParams.fLengthSeconds = m_fSampleLengthSeconds;
PlayParams.fFadeOutLengthSeconds = SAMPLE_MUSIC_FADE_OUT_SECONDS;
PlayParams.bAlignBeat = ALIGN_MUSIC_BEATS;
PlayParams.bApplyMusicRate = true;
PlayParams.bAccurateSync = false;
GameSoundManager::PlayMusicParams FallbackMusic;
FallbackMusic.sFile = m_sLoopMusicPath;
FallbackMusic.fFadeInLengthSeconds =
SAMPLE_MUSIC_FALLBACK_FADE_IN_SECONDS;
FallbackMusic.bAlignBeat = ALIGN_MUSIC_BEATS;
SOUND->PlayMusic(PlayParams);
if (!m_sSampleMusicToPlay.empty()) {
GameSoundManager::PlayMusicParams PlayParams;
PlayParams.sFile = HandleLuaMusicFile(m_sSampleMusicToPlay);
PlayParams.pTiming = m_pSampleMusicTimingData;
PlayParams.bForceLoop = SAMPLE_MUSIC_LOOPS;
PlayParams.fStartSecond = m_fSampleStartSeconds;
PlayParams.fLengthSeconds = m_fSampleLengthSeconds;
PlayParams.fFadeOutLengthSeconds = SAMPLE_MUSIC_FADE_OUT_SECONDS;
PlayParams.bAlignBeat = ALIGN_MUSIC_BEATS;
PlayParams.bApplyMusicRate = true;
PlayParams.bAccurateSync = false;
GameSoundManager::PlayMusicParams FallbackMusic;
FallbackMusic.sFile = m_sLoopMusicPath;
FallbackMusic.fFadeInLengthSeconds =
SAMPLE_MUSIC_FALLBACK_FADE_IN_SECONDS;
FallbackMusic.bAlignBeat = ALIGN_MUSIC_BEATS;
SOUND->PlayMusic(PlayParams);
}
GAMESTATE->SetPaused(false);
MESSAGEMAN->Broadcast("PlayingSampleMusic");
}
Expand Down

0 comments on commit f8d1b0e

Please sign in to comment.