hide NoteData::InsertHoldTails away in NoteDataUtils

This commit is contained in:
Glenn Maynard
2005-02-07 22:03:32 +00:00
parent 10bc0bf336
commit f752e1c3b0
3 changed files with 29 additions and 29 deletions
-25
View File
@@ -812,31 +812,6 @@ bool NoteData::GetNextTapNoteRowForAllTracks( int &rowInOut ) const
}
}
void NoteData::InsertHoldTails()
{
for( int t=0; t<GetNumTracks(); t++ )
{
iterator begin = this->begin(t), end = this->end(t);
for( ; begin != end; ++begin )
{
int iRow = begin->first;
const TapNote &tn = begin->second;
if( tn.type != TapNote::hold_head )
continue;
TapNote tail = tn;
tail.type = TapNote::hold_tail;
/* If iDuration is 0, we'd end up overwriting the head with the tail
* (and invalidating our iterator). Empty hold notes aren't valid. */
ASSERT( tn.iDuration != 0 );
SetTapNote( t, iRow + tn.iDuration, tail );
}
}
}
/*
* (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved.
-3
View File
@@ -141,9 +141,6 @@ public:
// Transformations
void LoadTransformed( const NoteData& original, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] ); // -1 for iOriginalTracksToTakeFrom means no track
/* hold_tail is only used to make SM parsing easier. */
void InsertHoldTails();
};
+29 -1
View File
@@ -227,13 +227,41 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData
}
}
namespace
{
void InsertHoldTails( NoteData &inout )
{
for( int t=0; t < inout.GetNumTracks(); t++ )
{
NoteData::iterator begin = inout.begin(t), end = inout.end(t);
for( ; begin != end; ++begin )
{
int iRow = begin->first;
const TapNote &tn = begin->second;
if( tn.type != TapNote::hold_head )
continue;
TapNote tail = tn;
tail.type = TapNote::hold_tail;
/* If iDuration is 0, we'd end up overwriting the head with the tail
* (and invalidating our iterator). Empty hold notes aren't valid. */
ASSERT( tn.iDuration != 0 );
inout.SetTapNote( t, iRow + tn.iDuration, tail );
}
}
}
};
void NoteDataUtil::GetSMNoteDataString( const NoteData &in_, CString &notes_out )
{
//
// Get note data
//
NoteData in( in_ );
in.InsertHoldTails();
InsertHoldTails( in );
float fLastBeat = in.GetLastBeat();
int iLastMeasure = int( fLastBeat/BEATS_PER_MEASURE );