allow alternate loop music for music wheel
This commit is contained in:
@@ -0,0 +1 @@
|
||||
_common menu music
|
||||
@@ -462,6 +462,7 @@ Fallback="ScreenWithMenuElements"
|
||||
NextScreen=GetSelectMusicNext()
|
||||
PrevScreen=ScreenTitleBranch()
|
||||
MusicWheelType="MusicWheel"
|
||||
SampleMusicLoops=false
|
||||
ShowOptionsMessageSeconds=1.5
|
||||
BannerX=0
|
||||
BannerY=0
|
||||
|
||||
@@ -42,6 +42,8 @@ static FadeState g_FadeState = FADE_NONE;
|
||||
static float g_fDimVolume = 1.0f;
|
||||
static float g_fOriginalVolume = 1.0f;
|
||||
static float g_fDimDurationRemaining = 0.0f;
|
||||
static bool g_bWasPlayingOnLastUpdate = false;
|
||||
static RString g_sFallbackMusicPath;
|
||||
|
||||
struct MusicPlaying
|
||||
{
|
||||
@@ -85,7 +87,7 @@ struct MusicToPlay
|
||||
TimingData m_TimingData;
|
||||
NoteData m_LightsData;
|
||||
bool bForceLoop;
|
||||
float fStartSecond, fLengthSeconds, fFadeOutLengthSeconds;
|
||||
float fStartSecond, fLengthSeconds, fFadeInLengthSeconds, fFadeOutLengthSeconds;
|
||||
bool bAlignBeat;
|
||||
MusicToPlay()
|
||||
{
|
||||
@@ -235,6 +237,7 @@ static void StartMusic( MusicToPlay &ToPlay )
|
||||
RageSoundParams p;
|
||||
p.m_StartSecond = ToPlay.fStartSecond;
|
||||
p.m_LengthSeconds = ToPlay.fLengthSeconds;
|
||||
p.m_fFadeInSeconds = ToPlay.fFadeInLengthSeconds;
|
||||
p.m_fFadeOutSeconds = ToPlay.fFadeOutLengthSeconds;
|
||||
p.m_StartTime = when;
|
||||
if( ToPlay.bForceLoop )
|
||||
@@ -463,6 +466,18 @@ float GameSoundManager::GetFrameTimingAdjustment( float fDeltaTime )
|
||||
|
||||
void GameSoundManager::Update( float fDeltaTime )
|
||||
{
|
||||
{
|
||||
g_Mutex->Lock();
|
||||
bool bIsPlaying = g_Playing->m_Music->IsPlaying();
|
||||
g_Mutex->Unlock();
|
||||
if( !bIsPlaying && g_bWasPlayingOnLastUpdate && !g_sFallbackMusicPath.empty() )
|
||||
{
|
||||
PlayMusic( g_sFallbackMusicPath, NULL, false, 0, -1, 1.5f );
|
||||
g_sFallbackMusicPath = "";
|
||||
}
|
||||
g_bWasPlayingOnLastUpdate = bIsPlaying;
|
||||
}
|
||||
|
||||
LockMut( *g_Mutex );
|
||||
|
||||
{
|
||||
@@ -502,7 +517,6 @@ void GameSoundManager::Update( float fDeltaTime )
|
||||
return;
|
||||
|
||||
const float fAdjust = GetFrameTimingAdjustment( fDeltaTime );
|
||||
|
||||
if( !g_Playing->m_Music->IsPlaying() )
|
||||
{
|
||||
/* There's no song playing. Fake it. */
|
||||
@@ -630,14 +644,19 @@ RString GameSoundManager::GetMusicPath() const
|
||||
}
|
||||
|
||||
void GameSoundManager::PlayMusic(
|
||||
const RString &sFile,
|
||||
RString sFile,
|
||||
const TimingData *pTiming,
|
||||
bool bForceLoop,
|
||||
float fStartSecond,
|
||||
float fLengthSeconds,
|
||||
float fFadeInLengthSeconds,
|
||||
float fFadeOutLengthSeconds,
|
||||
bool bAlignBeat )
|
||||
bool bAlignBeat,
|
||||
RString sFallback
|
||||
)
|
||||
{
|
||||
g_sFallbackMusicPath = sFallback;
|
||||
|
||||
// LOG->Trace("play '%s' (current '%s')", file.c_str(), g_Playing->m_Music->GetLoadedFilePath().c_str());
|
||||
|
||||
MusicToPlay ToPlay;
|
||||
@@ -657,6 +676,7 @@ void GameSoundManager::PlayMusic(
|
||||
ToPlay.bForceLoop = bForceLoop;
|
||||
ToPlay.fStartSecond = fStartSecond;
|
||||
ToPlay.fLengthSeconds = fLengthSeconds;
|
||||
ToPlay.fFadeInLengthSeconds = fFadeInLengthSeconds;
|
||||
ToPlay.fFadeOutLengthSeconds = fFadeOutLengthSeconds;
|
||||
ToPlay.bAlignBeat = bAlignBeat;
|
||||
|
||||
|
||||
@@ -17,13 +17,15 @@ public:
|
||||
void Update( float fDeltaTime );
|
||||
|
||||
void PlayMusic(
|
||||
const RString &file,
|
||||
RString sFile,
|
||||
const TimingData *pTiming = NULL,
|
||||
bool force_loop = false,
|
||||
float start_sec = 0,
|
||||
float length_sec = -1,
|
||||
float fFadeInLengthSeconds = 0,
|
||||
float fade_len = 0,
|
||||
bool align_beat = true );
|
||||
bool align_beat = true,
|
||||
RString sFallback = "" );
|
||||
void StopMusic() { PlayMusic(""); }
|
||||
void DimMusic( float fVolume, float fDurationSeconds );
|
||||
RString GetMusicPath() const;
|
||||
|
||||
@@ -825,6 +825,7 @@ void ScreenEdit::PlayPreviewMusic()
|
||||
false,
|
||||
m_pSong->m_fMusicSampleStartSeconds,
|
||||
m_pSong->m_fMusicSampleLengthSeconds,
|
||||
0.0f,
|
||||
1.5f );
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ ScreenSelectMusic::ScreenSelectMusic()
|
||||
void ScreenSelectMusic::Init()
|
||||
{
|
||||
SAMPLE_MUSIC_DELAY.Load( m_sName, "SampleMusicDelay" );
|
||||
SAMPLE_MUSIC_LOOPS.Load( m_sName, "SampleMusicLoops" );
|
||||
DO_ROULETTE_ON_MENU_TIMER.Load( m_sName, "DoRouletteOnMenuTimer" );
|
||||
ALIGN_MUSIC_BEATS.Load( m_sName, "AlignMusicBeat" );
|
||||
CODES.Load( m_sName, "Codes" );
|
||||
@@ -89,6 +90,7 @@ void ScreenSelectMusic::Init()
|
||||
m_sRouletteMusicPath = THEME->GetPathS(m_sName,"roulette music");
|
||||
m_sRandomMusicPath = THEME->GetPathS(m_sName,"random music");
|
||||
m_sCourseMusicPath = THEME->GetPathS(m_sName,"course music");
|
||||
m_sLoopMusicPath = THEME->GetPathS(m_sName,"loop music");
|
||||
m_sFallbackCDTitlePath = THEME->GetPathG(m_sName,"fallback cdtitle");
|
||||
|
||||
|
||||
@@ -289,9 +291,11 @@ void ScreenSelectMusic::CheckBackgroundRequests( bool bForce )
|
||||
|
||||
SOUND->PlayMusic(
|
||||
m_sSampleMusicToPlay, m_pSampleMusicTimingData,
|
||||
true, m_fSampleStartSeconds, m_fSampleLengthSeconds,
|
||||
SAMPLE_MUSIC_LOOPS, m_fSampleStartSeconds, m_fSampleLengthSeconds,
|
||||
0.0f,
|
||||
1.5f, /* fade out for 1.5 seconds */
|
||||
ALIGN_MUSIC_BEATS );
|
||||
ALIGN_MUSIC_BEATS,
|
||||
m_sLoopMusicPath );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ protected:
|
||||
int m_iSelection[NUM_PLAYERS];
|
||||
|
||||
ThemeMetric<float> SAMPLE_MUSIC_DELAY;
|
||||
ThemeMetric<bool> SAMPLE_MUSIC_LOOPS;
|
||||
ThemeMetric<bool> DO_ROULETTE_ON_MENU_TIMER;
|
||||
ThemeMetric<bool> ALIGN_MUSIC_BEATS;
|
||||
ThemeMetric<RString> CODES;
|
||||
@@ -99,6 +100,7 @@ protected:
|
||||
RString m_sRouletteMusicPath;
|
||||
RString m_sRandomMusicPath;
|
||||
RString m_sCourseMusicPath;
|
||||
RString m_sLoopMusicPath;
|
||||
RString m_sFallbackCDTitlePath;
|
||||
|
||||
FadingBanner m_Banner;
|
||||
|
||||
Reference in New Issue
Block a user