Read and write TICKCOUNTS. Invalidate cache.
At this time, the tag does nothing. That will hopefully change within the week.
This commit is contained in:
@@ -308,6 +308,39 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out )
|
||||
out.AddTimeSignatureSegment( seg );
|
||||
}
|
||||
}
|
||||
|
||||
else if( sValueName=="TICKCOUNTS" )
|
||||
{
|
||||
vector<RString> arrayTickcountExpressions;
|
||||
split( sParams[1], ",", arrayTickcountExpressions );
|
||||
|
||||
for( unsigned f=0; f<arrayTickcountExpressions.size(); f++ )
|
||||
{
|
||||
vector<RString> arrayTickcountValues;
|
||||
split( arrayTickcountExpressions[f], "=", arrayTickcountValues );
|
||||
if( arrayTickcountValues.size() != 2 )
|
||||
{
|
||||
// XXX: Hard to tell which file caused this.
|
||||
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #%s value \"%s\" (must have exactly one '='), ignored.",
|
||||
sValueName.c_str(), arrayTickcountExpressions[f].c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
const float fTickcountBeat = StringToFloat( arrayTickcountValues[0] );
|
||||
const int iTicks = atoi( arrayTickcountValues[1] );
|
||||
TickcountSegment new_seg( BeatToNoteRow(fTickcountBeat), iTicks );
|
||||
|
||||
if(iTicks >= 1 && iTicks <= ROWS_PER_BEAT ) // Constants
|
||||
{
|
||||
// LOG->Trace( "Adding a tickcount segment: beat: %f, ticks = %d", fTickcountBeat, iTicks );
|
||||
out.AddTickcountSegment( new_seg );
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid tickcount at beat %f, ticks %d.", fTickcountBeat, iTicks );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// warps (replacement for Negative BPM and Negative Stops)
|
||||
/*
|
||||
|
||||
@@ -162,6 +162,18 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
|
||||
}
|
||||
f.PutLine( ";" );
|
||||
|
||||
ASSERT( !out.m_Timing.m_TickcountSegments.empty() );
|
||||
f.Write( "#TICKCOUNTS:" );
|
||||
for( unsigned i=0; i<out.m_Timing.m_TickcountSegments.size(); i++ )
|
||||
{
|
||||
const TickcountSegment &ts = out.m_Timing.m_TickcountSegments[i];
|
||||
|
||||
f.PutLine( ssprintf( "%.6f=%d", NoteRowToBeat(ts.m_iStartRow), ts.m_iTicks ) );
|
||||
if( i != out.m_Timing.m_TickcountSegments.size()-1 )
|
||||
f.Write( "," );
|
||||
}
|
||||
f.PutLine( ";" );
|
||||
|
||||
FOREACH_BackgroundLayer( b )
|
||||
{
|
||||
if( b==0 )
|
||||
|
||||
+14
-1
@@ -34,7 +34,7 @@
|
||||
#include <set>
|
||||
#include <float.h>
|
||||
|
||||
const int FILE_CACHE_VERSION = 161; // increment this to invalidate cache
|
||||
const int FILE_CACHE_VERSION = 162; // increment this to invalidate cache
|
||||
|
||||
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
|
||||
|
||||
@@ -758,6 +758,19 @@ void Song::TidyUpData()
|
||||
seg.m_iDenominator = 4;
|
||||
m_Timing.m_vTimeSignatureSegments.push_back( seg );
|
||||
}
|
||||
|
||||
/*
|
||||
* Likewise, if no tickcount signature is specified, assume 2 ticks
|
||||
* per beat for the entire song. The default of 2 is chosen more
|
||||
* for compatibility with the Pump Pro series than anything else.
|
||||
*/
|
||||
if( m_Timing.m_TickcountSegments.empty() )
|
||||
{
|
||||
TickcountSegment seg;
|
||||
seg.m_iStartRow = 0;
|
||||
seg.m_iTicks = 2;
|
||||
m_Timing.m_TickcountSegments.push_back( seg );
|
||||
}
|
||||
}
|
||||
|
||||
void Song::TranslateTitles()
|
||||
|
||||
Reference in New Issue
Block a user