sort input
clear input, so we don't accumulate if we load twice
This commit is contained in:
@@ -13,6 +13,10 @@
|
||||
#include <map>
|
||||
using namespace std;
|
||||
|
||||
static int CompareLyricSegments(const LyricSegment &seg1, const LyricSegment &seg2)
|
||||
{
|
||||
return seg1.m_fStartTime < seg2.m_fStartTime;
|
||||
}
|
||||
|
||||
bool LyricsLoader::LoadFromLRCFile( CString sPath, Song &out )
|
||||
{
|
||||
@@ -29,6 +33,8 @@ bool LyricsLoader::LoadFromLRCFile( CString sPath, Song &out )
|
||||
|
||||
RageColor CurrentColor(0,1,0,1);
|
||||
|
||||
out.m_LyricSegments.clear();
|
||||
|
||||
while(input.good() && getline(input, line))
|
||||
{
|
||||
if(!line.compare(0, 2, "//"))
|
||||
@@ -83,6 +89,8 @@ bool LyricsLoader::LoadFromLRCFile( CString sPath, Song &out )
|
||||
|
||||
}
|
||||
|
||||
sort( out.m_LyricSegments.begin(), out.m_LyricSegments.end(), CompareLyricSegments );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user