diff --git a/src/NotesLoaderSM.cpp b/src/NotesLoaderSM.cpp index 92c7f5d2ce..359dd5ddc5 100644 --- a/src/NotesLoaderSM.cpp +++ b/src/NotesLoaderSM.cpp @@ -308,6 +308,39 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) out.AddTimeSignatureSegment( seg ); } } + + else if( sValueName=="TICKCOUNTS" ) + { + vector arrayTickcountExpressions; + split( sParams[1], ",", arrayTickcountExpressions ); + + for( unsigned f=0; f 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) /* diff --git a/src/NotesWriterSM.cpp b/src/NotesWriterSM.cpp index 7d31865257..d5cb1741e1 100644 --- a/src/NotesWriterSM.cpp +++ b/src/NotesWriterSM.cpp @@ -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 #include -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()