Ignore invalid BPM changes. No more nonpositive BPMs.
This commit is contained in:
@@ -604,10 +604,18 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
|
||||
|
||||
if( GetTagFromMap( mapNameToData, "#bpm", sData ) )
|
||||
{
|
||||
BPMSegment newSeg( 0, StringToFloat(sData) );
|
||||
out.AddBPMSegment( newSeg );
|
||||
|
||||
LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", NoteRowToBeat(newSeg.m_iStartIndex), newSeg.GetBPM() );
|
||||
const float fBPM = StringToFloat( sData );
|
||||
|
||||
if( fBPM > 0.0f )
|
||||
{
|
||||
BPMSegment newSeg( 0, fBPM );
|
||||
out.AddBPMSegment( newSeg );
|
||||
LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", NoteRowToBeat(0), fBPM );
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG->Trace( "Invalid BPM change at beat %f, BPM %f.", NoteRowToBeat(0), fBPM );
|
||||
}
|
||||
}
|
||||
|
||||
NameToData_t::const_iterator it;
|
||||
@@ -681,10 +689,18 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
|
||||
switch( iBMSTrackNo )
|
||||
{
|
||||
case BMS_TRACK_BPM:
|
||||
out.SetBPMAtBeat( fBeat, (float) iVal );
|
||||
LOG->Trace( "Inserting new BPM change at beat %f, BPM %i", fBeat, iVal );
|
||||
if( iVal > 0 )
|
||||
{
|
||||
out.SetBPMAtBeat( fBeat, (float) iVal );
|
||||
LOG->Trace( "Inserting new BPM change at beat %f, BPM %i", fBeat, iVal );
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is too loud for warn.
|
||||
LOG->Trace( "Invalid BPM change at beat %f, BPM %d.", fBeat, iVal );
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case BMS_TRACK_BPM_REF:
|
||||
{
|
||||
RString sTagToLookFor = ssprintf( "#bpm%02x", iVal );
|
||||
@@ -693,11 +709,16 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
|
||||
{
|
||||
float fBPM = StringToFloat( sBPM );
|
||||
|
||||
BPMSegment newSeg;
|
||||
newSeg.m_iStartIndex = BeatToNoteRow(fBeat);
|
||||
newSeg.SetBPM( fBPM );
|
||||
out.AddBPMSegment( newSeg );
|
||||
LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", fBeat, newSeg.GetBPM() );
|
||||
if( fBPM > 0.0f )
|
||||
{
|
||||
BPMSegment newSeg( BeatToNoteRow(fBeat), fBPM );
|
||||
out.AddBPMSegment( newSeg );
|
||||
LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", fBeat, newSeg.GetBPM() );
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG->Trace( "Invalid BPM change at beat %f, BPM %f", fBeat, fBPM );
|
||||
}
|
||||
}
|
||||
else
|
||||
LOG->Warn( "Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), m_sDir.c_str() );
|
||||
@@ -739,11 +760,17 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
|
||||
{
|
||||
float fBPM = StringToFloat( sBPM );
|
||||
|
||||
BPMSegment newSeg;
|
||||
newSeg.m_iStartIndex = iStepIndex;
|
||||
newSeg.SetBPM( fBPM );
|
||||
out.AddBPMSegment( newSeg );
|
||||
LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", NoteRowToBeat(newSeg.m_iStartIndex), newSeg.GetBPM() );
|
||||
if( fBPM > 0.0f )
|
||||
{
|
||||
BPMSegment newSeg( iStepIndex, fBPM );
|
||||
out.AddBPMSegment( newSeg );
|
||||
LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", NoteRowToBeat(newSeg.m_iStartIndex), newSeg.GetBPM() );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG->Trace( "Invalid BPM change at beat %f, BPM %f.", NoteRowToBeat(iStepIndex), fBPM );
|
||||
}
|
||||
}
|
||||
else
|
||||
LOG->Warn( "Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), m_sDir.c_str() );
|
||||
|
||||
@@ -404,8 +404,14 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out )
|
||||
out.m_sCDTitleFile = sParams[1];
|
||||
|
||||
else if( 0==stricmp(sValueName,"BPM") )
|
||||
out.AddBPMSegment( BPMSegment(0, StringToFloat(sParams[1])) );
|
||||
|
||||
{
|
||||
const float fBPM = StringToFloat( sParams[1] );
|
||||
|
||||
if( fBPM > 0.0f )
|
||||
out.AddBPMSegment( BPMSegment(0, fBPM) );
|
||||
else
|
||||
LOG->Trace( "Invalid BPM change at beat %f, BPM %f.", NoteRowToBeat(0), fBPM );
|
||||
}
|
||||
else if( 0==stricmp(sValueName,"DISPLAYBPM") )
|
||||
{
|
||||
// #DISPLAYBPM:[xxx..xxx]|[xxx]|[*];
|
||||
@@ -477,10 +483,17 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out )
|
||||
continue;
|
||||
}
|
||||
|
||||
BPMSegment bs;
|
||||
bs.m_iStartIndex = BeatToNoteRow( StringToFloat(arrayBPMChangeValues[0]) / 4.0f );
|
||||
bs.SetBPM( StringToFloat( arrayBPMChangeValues[1] ) );
|
||||
out.AddBPMSegment( bs );
|
||||
int iStartIndex = BeatToNoteRow( StringToFloat(arrayBPMChangeValues[0]) / 4.0f );
|
||||
float fBPM = StringToFloat( arrayBPMChangeValues[1] );
|
||||
if( fBPM > 0.0f )
|
||||
{
|
||||
BPMSegment bs( iStartIndex, fBPM );
|
||||
out.AddBPMSegment( bs );
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG->Trace( "Invalid BPM change at beat %f, BPM %f.", NoteRowToBeat(iStartIndex), fBPM );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,9 +118,7 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out )
|
||||
const float fFreezeBeat = StringToFloat( arrayFreezeValues[0] );
|
||||
const float fFreezeSeconds = StringToFloat( arrayFreezeValues[1] );
|
||||
|
||||
StopSegment new_seg;
|
||||
new_seg.m_iStartRow = BeatToNoteRow(fFreezeBeat);
|
||||
new_seg.m_fStopSeconds = fFreezeSeconds;
|
||||
StopSegment new_seg( BeatToNoteRow(fFreezeBeat), fFreezeSeconds );
|
||||
|
||||
// LOG->Trace( "Adding a freeze segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fStopSeconds );
|
||||
|
||||
@@ -149,11 +147,10 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out )
|
||||
const float fBeat = StringToFloat( arrayBPMChangeValues[0] );
|
||||
const float fNewBPM = StringToFloat( arrayBPMChangeValues[1] );
|
||||
|
||||
BPMSegment new_seg;
|
||||
new_seg.m_iStartIndex = BeatToNoteRow(fBeat);
|
||||
new_seg.SetBPM( fNewBPM );
|
||||
|
||||
out.AddBPMSegment( new_seg );
|
||||
if( fNewBPM > 0.0f )
|
||||
out.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) );
|
||||
else
|
||||
LOG->Trace( "Invalid BPM change at beat %f, BPM %f.", fBeat, fNewBPM );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user