remove NoteData::RemoveHoldTails
cleanup
This commit is contained in:
@@ -816,8 +816,7 @@ void NoteData::InsertHoldTails()
|
|||||||
{
|
{
|
||||||
for( int t=0; t<GetNumTracks(); t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
iterator begin, end;
|
iterator begin = this->begin(t), end = this->end(t);
|
||||||
GetTapNoteRange( t, 0, MAX_NOTE_ROW, begin, end );
|
|
||||||
|
|
||||||
for( ; begin != end; ++begin )
|
for( ; begin != end; ++begin )
|
||||||
{
|
{
|
||||||
@@ -828,52 +827,16 @@ void NoteData::InsertHoldTails()
|
|||||||
|
|
||||||
TapNote tail = tn;
|
TapNote tail = tn;
|
||||||
tail.type = TapNote::hold_tail;
|
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 );
|
SetTapNote( t, iRow + tn.iDuration, tail );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteData::RemoveHoldTails()
|
|
||||||
{
|
|
||||||
for( int t=0; t<GetNumTracks(); t++ )
|
|
||||||
{
|
|
||||||
iterator begin, end;
|
|
||||||
GetTapNoteRange( t, 0, MAX_NOTE_ROW, begin, end );
|
|
||||||
|
|
||||||
iterator next;
|
|
||||||
for( ; begin != end; begin = next )
|
|
||||||
{
|
|
||||||
next = begin; ++next;
|
|
||||||
|
|
||||||
int iStartRow = begin->first;
|
|
||||||
const TapNote &tn = begin->second;
|
|
||||||
if( tn.type != TapNote::hold_head )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Search forward until we find a hold_tail. */
|
|
||||||
iterator tail = begin;
|
|
||||||
|
|
||||||
while( tail != end && tail->second.type != TapNote::hold_tail )
|
|
||||||
++tail;
|
|
||||||
|
|
||||||
if( tail == end )
|
|
||||||
{
|
|
||||||
/* If we didn't find one, the hold is invalid; delete it. */
|
|
||||||
RemoveTapNote( t, begin );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Delete the tail, and update iDuration of the head. */
|
|
||||||
if( next == tail )
|
|
||||||
++next;
|
|
||||||
int iEndRow = tail->first;
|
|
||||||
begin->second.iDuration = iEndRow - iStartRow;
|
|
||||||
RemoveTapNote( t, tail );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -144,7 +144,6 @@ public:
|
|||||||
|
|
||||||
/* hold_tail is only used to make SM parsing easier. */
|
/* hold_tail is only used to make SM parsing easier. */
|
||||||
void InsertHoldTails();
|
void InsertHoldTails();
|
||||||
void RemoveHoldTails(); /* adjusts iDuration */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user