Add a last beat hint. The real last beat will be at least as long as the hint.

This commit is contained in:
Steve Checkoway
2006-09-02 22:22:57 +00:00
parent 9613079a92
commit b939bdec8e
4 changed files with 9 additions and 2 deletions
+3
View File
@@ -293,6 +293,9 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out )
continue;
out.m_fMusicLengthSeconds = StringToFloat( sParams[1] );
}
else if( sValueName=="LASTBEATHINT" )
out.m_fSpecifiedLastBeat = StringToFloat( sParams[1] );
else if( sValueName=="MUSICBYTES" )
; /* ignore */
+2
View File
@@ -54,6 +54,8 @@ void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out )
f.PutLine( ssprintf( "#OFFSET:%.3f;", out.m_Timing.m_fBeat0OffsetInSeconds ) );
f.PutLine( ssprintf( "#SAMPLESTART:%.3f;", out.m_fMusicSampleStartSeconds ) );
f.PutLine( ssprintf( "#SAMPLELENGTH:%.3f;", out.m_fMusicSampleLengthSeconds ) );
if( out.m_fSpecifiedLastBeat > 0 )
f.PutLine( ssprintf("#LASTBEATHINT:%.3f;", out.m_fSpecifiedLastBeat) );
f.Write( "#SELECTABLE:" );
switch(out.m_SelectionDisplay) {
+3 -2
View File
@@ -33,7 +33,7 @@
#include <set>
#include <float.h>
const int FILE_CACHE_VERSION = 150; // increment this to invalidate cache
const int FILE_CACHE_VERSION = 151; // increment this to invalidate cache
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
@@ -53,6 +53,7 @@ Song::Song()
m_fMusicLengthSeconds = 0;
m_fFirstBeat = -1;
m_fLastBeat = -1;
m_fSpecifiedLastBeat = -1;
m_SelectionDisplay = SHOW_ALWAYS;
m_DisplayBPMType = DISPLAY_ACTUAL;
m_fSpecifiedBPMMin = 0;
@@ -657,7 +658,7 @@ void Song::TranslateTitles()
void Song::ReCalculateRadarValuesAndLastBeat()
{
float fFirstBeat = FLT_MAX; /* inf */
float fLastBeat = 0;
float fLastBeat = m_fSpecifiedLastBeat; // Make sure we're at least as long as the specified amount.
for( unsigned i=0; i<m_vpSteps.size(); i++ )
{
+1
View File
@@ -117,6 +117,7 @@ public:
float m_fMusicLengthSeconds;
float m_fFirstBeat; // beat of first note
float m_fLastBeat; // beat of last note
float m_fSpecifiedLastBeat; // specified last beat of the song
float m_fMusicSampleStartSeconds;
float m_fMusicSampleLengthSeconds;
enum { DISPLAY_ACTUAL, DISPLAY_SPECIFIED, DISPLAY_RANDOM } m_DisplayBPMType;