2002-04-16 17:31:00 +00:00
|
|
|
/*
|
2004-05-31 22:42:12 +00:00
|
|
|
* NoteData is organized by:
|
|
|
|
|
* track - corresponds to different columns of notes on the screen
|
|
|
|
|
* row/index - corresponds to subdivisions of beats
|
|
|
|
|
*/
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2004-05-31 22:42:12 +00:00
|
|
|
#include "global.h"
|
2002-04-16 17:31:00 +00:00
|
|
|
#include "NoteData.h"
|
|
|
|
|
#include "RageUtil.h"
|
2003-10-04 04:14:30 +00:00
|
|
|
#include "RageLog.h"
|
2005-11-22 21:18:45 +00:00
|
|
|
#include "XmlFile.h"
|
|
|
|
|
#include "Foreach.h"
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2005-07-03 03:05:54 +00:00
|
|
|
#include "RageUtil_AutoPtr.h"
|
|
|
|
|
REGISTER_CLASS_TRAITS( NoteData, new NoteData(*pCopy) )
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2002-06-24 22:04:31 +00:00
|
|
|
void NoteData::Init()
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2005-03-08 21:18:00 +00:00
|
|
|
m_TapNotes = vector<TrackMap>(); // ensure that the memory is freed
|
2002-04-16 17:31:00 +00:00
|
|
|
}
|
|
|
|
|
|
2003-02-01 05:16:38 +00:00
|
|
|
void NoteData::SetNumTracks( int iNewNumTracks )
|
|
|
|
|
{
|
2004-09-25 07:59:56 +00:00
|
|
|
ASSERT( iNewNumTracks > 0 );
|
2003-02-01 05:27:49 +00:00
|
|
|
|
2004-09-25 07:59:56 +00:00
|
|
|
m_TapNotes.resize( iNewNumTracks );
|
2003-02-01 05:16:38 +00:00
|
|
|
}
|
|
|
|
|
|
2006-06-26 09:33:11 +00:00
|
|
|
bool NoteData::IsComposite() const
|
|
|
|
|
{
|
|
|
|
|
for( int track = 0; track < GetNumTracks(); ++track )
|
|
|
|
|
{
|
|
|
|
|
FOREACHM_CONST( int, TapNote, m_TapNotes[track], tn )
|
|
|
|
|
if( tn->second.pn != PLAYER_INVALID )
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2003-02-01 05:16:38 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
/* Clear [rowBegin,rowEnd). */
|
2005-01-23 05:31:55 +00:00
|
|
|
void NoteData::ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack )
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2005-01-23 05:31:55 +00:00
|
|
|
/* Optimization: if the range encloses everything, just clear the whole maps. */
|
|
|
|
|
if( rowBegin == 0 && rowEnd == MAX_NOTE_ROW )
|
|
|
|
|
{
|
|
|
|
|
m_TapNotes[iTrack].clear();
|
2005-01-25 05:02:35 +00:00
|
|
|
return;
|
2005-01-23 05:31:55 +00:00
|
|
|
}
|
|
|
|
|
|
2005-07-30 07:08:50 +00:00
|
|
|
/* If the range is empty, don't do anything. Otherwise, an empty range will cause
|
|
|
|
|
* hold notes to be split when they shouldn't be. */
|
|
|
|
|
if( rowBegin == rowEnd )
|
|
|
|
|
return;
|
|
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
iterator begin, end;
|
|
|
|
|
GetTapNoteRangeInclusive( iTrack, rowBegin, rowEnd, begin, end );
|
|
|
|
|
|
|
|
|
|
if( begin != end && begin->first < rowBegin && begin->first + begin->second.iDuration > rowEnd )
|
2005-01-23 04:57:43 +00:00
|
|
|
{
|
2005-01-25 05:02:35 +00:00
|
|
|
/* A hold note overlaps the whole range. Truncate it, and add the remainder to
|
|
|
|
|
* the end. */
|
|
|
|
|
TapNote tn1 = begin->second;
|
|
|
|
|
TapNote tn2 = tn1;
|
2005-01-23 05:31:55 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
int iEndRow = begin->first + tn1.iDuration;
|
|
|
|
|
int iRow = begin->first;
|
2005-01-23 04:57:43 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
tn1.iDuration = rowBegin - iRow;
|
|
|
|
|
tn2.iDuration = iEndRow - rowEnd;
|
2005-01-23 04:57:43 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
SetTapNote( iTrack, iRow, tn1 );
|
|
|
|
|
SetTapNote( iTrack, rowEnd, tn2 );
|
2005-01-23 04:57:43 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
/* We may have invalidated our iterators. */
|
|
|
|
|
GetTapNoteRangeInclusive( iTrack, rowBegin, rowEnd, begin, end );
|
|
|
|
|
}
|
|
|
|
|
else if( begin != end && begin->first < rowBegin )
|
|
|
|
|
{
|
|
|
|
|
/* A hold note overlaps the beginning of the range. Truncate it. */
|
|
|
|
|
TapNote &tn1 = begin->second;
|
|
|
|
|
int iRow = begin->first;
|
|
|
|
|
tn1.iDuration = rowBegin - iRow;
|
|
|
|
|
|
|
|
|
|
++begin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( begin != end )
|
|
|
|
|
{
|
|
|
|
|
iterator prev = end;
|
|
|
|
|
--prev;
|
|
|
|
|
TapNote tn = begin->second;
|
|
|
|
|
int iRow = prev->first;
|
|
|
|
|
if( tn.type == TapNote::hold_head && iRow + tn.iDuration > rowEnd )
|
2005-01-23 04:57:43 +00:00
|
|
|
{
|
2005-01-25 05:02:35 +00:00
|
|
|
/* A hold note overlaps the end of the range. Separate it. */
|
|
|
|
|
SetTapNote( iTrack, iRow, TAP_EMPTY );
|
|
|
|
|
|
|
|
|
|
int iAdd = rowEnd - iRow;
|
|
|
|
|
tn.iDuration -= iAdd;
|
|
|
|
|
iRow += iAdd;
|
|
|
|
|
SetTapNote( iTrack, iRow, tn );
|
|
|
|
|
end = prev;
|
2005-01-23 04:57:43 +00:00
|
|
|
}
|
|
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
/* We may have invalidated our iterators. */
|
|
|
|
|
GetTapNoteRangeInclusive( iTrack, rowBegin, rowEnd, begin, end );
|
2005-01-23 04:57:43 +00:00
|
|
|
}
|
|
|
|
|
|
2005-10-07 02:57:54 +00:00
|
|
|
m_TapNotes[iTrack].erase( begin, end );
|
2005-01-23 05:31:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NoteData::ClearRange( int rowBegin, int rowEnd )
|
|
|
|
|
{
|
|
|
|
|
for( int t=0; t < GetNumTracks(); ++t )
|
|
|
|
|
ClearRangeForTrack( rowBegin, rowEnd, t );
|
2002-04-16 17:31:00 +00:00
|
|
|
}
|
2002-08-25 05:00:23 +00:00
|
|
|
|
2002-12-14 20:30:49 +00:00
|
|
|
void NoteData::ClearAll()
|
|
|
|
|
{
|
2004-10-02 05:08:59 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2004-05-24 04:26:54 +00:00
|
|
|
m_TapNotes[t].clear();
|
2002-12-14 20:30:49 +00:00
|
|
|
}
|
|
|
|
|
|
2005-07-30 05:59:39 +00:00
|
|
|
/* Copy [rowFromBegin,rowFromEnd) from pFrom to this. (Note that this does *not* overlay;
|
2002-08-25 05:00:23 +00:00
|
|
|
* all data in the range is overwritten.) */
|
2004-10-24 10:20:24 +00:00
|
|
|
void NoteData::CopyRange( const NoteData& from, int rowFromBegin, int rowFromEnd, int rowToBegin )
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2004-10-23 17:43:49 +00:00
|
|
|
ASSERT( from.GetNumTracks() == GetNumTracks() );
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
if( rowFromBegin > rowFromEnd )
|
|
|
|
|
return; /* empty range */
|
|
|
|
|
|
|
|
|
|
const int rowToEnd = (rowFromEnd-rowFromBegin) + rowToBegin;
|
|
|
|
|
const int iMoveBy = rowToBegin-rowFromBegin;
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2005-01-23 04:57:43 +00:00
|
|
|
/* Clear the region. */
|
|
|
|
|
ClearRange( rowToBegin, rowToEnd );
|
|
|
|
|
|
2004-09-29 06:43:57 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2005-01-25 05:02:35 +00:00
|
|
|
const_iterator begin, end;
|
|
|
|
|
from.GetTapNoteRangeInclusive( t, rowFromBegin, rowFromEnd, begin, end );
|
|
|
|
|
for( ; begin != end; ++begin )
|
2003-11-17 03:38:24 +00:00
|
|
|
{
|
2005-01-25 05:02:35 +00:00
|
|
|
TapNote head = begin->second;
|
|
|
|
|
if( head.type == TapNote::empty )
|
2005-01-23 04:57:43 +00:00
|
|
|
continue;
|
|
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
if( head.type == TapNote::hold_head )
|
|
|
|
|
{
|
|
|
|
|
int iStartRow = begin->first + iMoveBy;
|
|
|
|
|
int iEndRow = iStartRow + head.iDuration;
|
2005-01-23 04:57:43 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
iStartRow = clamp( iStartRow, rowToBegin, rowToEnd );
|
|
|
|
|
iEndRow = clamp( iEndRow, rowToBegin, rowToEnd );
|
2005-01-23 04:57:43 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
this->AddHoldNote( t, iStartRow, iEndRow, head );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int iTo = begin->first + iMoveBy;
|
|
|
|
|
if( iTo >= rowToBegin && iTo <= rowToEnd )
|
|
|
|
|
this->SetTapNote( t, iTo, head );
|
|
|
|
|
}
|
2005-01-23 04:57:43 +00:00
|
|
|
}
|
|
|
|
|
}
|
2002-04-16 17:31:00 +00:00
|
|
|
}
|
|
|
|
|
|
2004-10-23 17:43:49 +00:00
|
|
|
void NoteData::CopyAll( const NoteData& from )
|
2002-12-13 01:23:26 +00:00
|
|
|
{
|
2006-08-23 22:05:35 +00:00
|
|
|
*this = from;
|
2002-12-13 01:23:26 +00:00
|
|
|
}
|
|
|
|
|
|
2004-10-24 10:20:24 +00:00
|
|
|
bool NoteData::IsRowEmpty( int row ) const
|
2003-12-11 04:52:23 +00:00
|
|
|
{
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2004-10-25 03:16:40 +00:00
|
|
|
if( GetTapNote(t, row).type != TapNote::empty )
|
2003-12-11 04:52:23 +00:00
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-24 10:20:24 +00:00
|
|
|
bool NoteData::IsRangeEmpty( int track, int rowBegin, int rowEnd ) const
|
2004-02-25 08:40:03 +00:00
|
|
|
{
|
2004-09-25 07:59:56 +00:00
|
|
|
ASSERT( track < GetNumTracks() );
|
2004-02-25 08:40:03 +00:00
|
|
|
|
2004-10-24 10:20:24 +00:00
|
|
|
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, track, r, rowBegin, rowEnd )
|
2004-10-25 03:16:40 +00:00
|
|
|
if( GetTapNote(track,r).type != TapNote::empty )
|
2004-02-25 08:40:03 +00:00
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-24 10:20:24 +00:00
|
|
|
int NoteData::GetNumTapNonEmptyTracks( int row ) const
|
2003-12-11 04:52:23 +00:00
|
|
|
{
|
|
|
|
|
int iNum = 0;
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2004-10-24 10:20:24 +00:00
|
|
|
if( GetTapNote(t, row).type != TapNote::empty )
|
2003-12-11 04:52:23 +00:00
|
|
|
iNum++;
|
|
|
|
|
return iNum;
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-24 10:20:24 +00:00
|
|
|
void NoteData::GetTapNonEmptyTracks( int row, set<int>& addTo ) const
|
2004-05-15 03:00:43 +00:00
|
|
|
{
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2004-10-24 10:20:24 +00:00
|
|
|
if( GetTapNote(t, row).type != TapNote::empty )
|
2004-05-15 03:00:43 +00:00
|
|
|
addTo.insert(t);
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-24 10:20:24 +00:00
|
|
|
bool NoteData::GetTapFirstNonEmptyTrack( int row, int &iNonEmptyTrackOut ) const
|
2003-12-11 04:52:23 +00:00
|
|
|
{
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2004-10-24 10:20:24 +00:00
|
|
|
{
|
2004-10-25 03:16:40 +00:00
|
|
|
if( GetTapNote( t, row ).type != TapNote::empty )
|
2004-10-24 10:20:24 +00:00
|
|
|
{
|
|
|
|
|
iNonEmptyTrackOut = t;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool NoteData::GetTapFirstEmptyTrack( int row, int &iEmptyTrackOut ) const
|
|
|
|
|
{
|
|
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
|
|
|
|
{
|
2004-10-25 03:16:40 +00:00
|
|
|
if( GetTapNote( t, row ).type == TapNote::empty )
|
2004-10-24 10:20:24 +00:00
|
|
|
{
|
|
|
|
|
iEmptyTrackOut = t;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool NoteData::GetTapLastEmptyTrack( int row, int &iEmptyTrackOut ) const
|
|
|
|
|
{
|
|
|
|
|
for( int t=GetNumTracks()-1; t>=0; t-- )
|
|
|
|
|
{
|
2004-10-25 03:16:40 +00:00
|
|
|
if( GetTapNote( t, row ).type == TapNote::empty )
|
2004-10-24 10:20:24 +00:00
|
|
|
{
|
|
|
|
|
iEmptyTrackOut = t;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2003-12-11 04:52:23 +00:00
|
|
|
}
|
|
|
|
|
|
2004-10-24 10:20:24 +00:00
|
|
|
int NoteData::GetNumTracksWithTap( int row ) const
|
2003-12-11 04:52:23 +00:00
|
|
|
{
|
|
|
|
|
int iNum = 0;
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2003-12-11 04:52:23 +00:00
|
|
|
{
|
2004-10-25 03:16:40 +00:00
|
|
|
const TapNote &tn = GetTapNote( t, row );
|
2004-09-12 05:56:24 +00:00
|
|
|
if( tn.type == TapNote::tap )
|
2003-12-11 04:52:23 +00:00
|
|
|
iNum++;
|
|
|
|
|
}
|
|
|
|
|
return iNum;
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-24 10:20:24 +00:00
|
|
|
int NoteData::GetNumTracksWithTapOrHoldHead( int row ) const
|
2003-12-11 04:52:23 +00:00
|
|
|
{
|
|
|
|
|
int iNum = 0;
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2003-12-11 04:52:23 +00:00
|
|
|
{
|
2004-10-25 03:16:40 +00:00
|
|
|
const TapNote &tn = GetTapNote( t, row );
|
2004-09-12 05:56:24 +00:00
|
|
|
if( tn.type == TapNote::tap || tn.type == TapNote::hold_head )
|
2003-12-11 04:52:23 +00:00
|
|
|
iNum++;
|
|
|
|
|
}
|
|
|
|
|
return iNum;
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-24 10:20:24 +00:00
|
|
|
int NoteData::GetFirstTrackWithTap( int row ) const
|
2003-12-11 04:52:23 +00:00
|
|
|
{
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2003-12-11 04:52:23 +00:00
|
|
|
{
|
2004-10-25 03:16:40 +00:00
|
|
|
const TapNote &tn = GetTapNote( t, row );
|
2004-09-12 05:56:24 +00:00
|
|
|
if( tn.type == TapNote::tap )
|
2003-12-11 04:52:23 +00:00
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-24 10:20:24 +00:00
|
|
|
int NoteData::GetFirstTrackWithTapOrHoldHead( int row ) const
|
2003-12-11 04:52:23 +00:00
|
|
|
{
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2003-12-11 04:52:23 +00:00
|
|
|
{
|
2004-10-25 03:16:40 +00:00
|
|
|
const TapNote &tn = GetTapNote( t, row );
|
2004-09-12 05:56:24 +00:00
|
|
|
if( tn.type == TapNote::tap || tn.type == TapNote::hold_head )
|
2003-12-11 04:52:23 +00:00
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
void NoteData::AddHoldNote( int iTrack, int iStartRow, int iEndRow, TapNote tn )
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2005-01-25 05:02:35 +00:00
|
|
|
ASSERT( iStartRow>=0 && iEndRow>=0 );
|
2006-06-14 10:14:49 +00:00
|
|
|
ASSERT_M( iEndRow >= iStartRow, ssprintf("%d %d",iEndRow,iStartRow) );
|
2005-01-25 05:02:35 +00:00
|
|
|
|
|
|
|
|
/* Include adjacent (non-overlapping) hold notes, since we need to merge with them. */
|
|
|
|
|
iterator begin, end;
|
2005-04-07 19:30:40 +00:00
|
|
|
GetTapNoteRangeInclusive( iTrack, iStartRow, iEndRow, begin, end, true );
|
2002-09-09 05:22:02 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
/* Look for other hold notes that overlap and merge them into add. */
|
|
|
|
|
for( iterator it = begin; it != end; ++it )
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2005-04-07 19:30:40 +00:00
|
|
|
int iOtherRow = it->first;
|
|
|
|
|
const TapNote &tnOther = it->second;
|
|
|
|
|
if( tnOther.type == TapNote::hold_head )
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2005-04-07 19:30:40 +00:00
|
|
|
iStartRow = min( iStartRow, iOtherRow );
|
|
|
|
|
iEndRow = max( iEndRow, iOtherRow + tnOther.iDuration );
|
2002-04-16 17:31:00 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-07 19:30:40 +00:00
|
|
|
tn.iDuration = iEndRow - iStartRow;
|
|
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
/* Remove everything in the range. */
|
|
|
|
|
while( begin != end )
|
|
|
|
|
{
|
|
|
|
|
iterator next = begin;
|
|
|
|
|
++next;
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
RemoveTapNote( iTrack, begin );
|
|
|
|
|
|
|
|
|
|
begin = next;
|
|
|
|
|
}
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
/* Additionally, if there's a tap note lying at the end of our range, remove it,
|
|
|
|
|
* too. */
|
|
|
|
|
SetTapNote( iTrack, iEndRow, TAP_EMPTY );
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
// add a tap note at the start of this hold
|
|
|
|
|
SetTapNote( iTrack, iStartRow, tn );
|
2002-04-16 17:31:00 +00:00
|
|
|
}
|
|
|
|
|
|
2005-07-22 00:34:54 +00:00
|
|
|
/* Determine if a hold note lies on the given spot. Return true if so. If
|
|
|
|
|
* pHeadRow is non-NULL, return the row of the head. */
|
|
|
|
|
bool NoteData::IsHoldHeadOrBodyAtRow( int iTrack, int iRow, int *pHeadRow ) const
|
|
|
|
|
{
|
|
|
|
|
const TapNote &tn = GetTapNote( iTrack, iRow );
|
|
|
|
|
if( tn.type == TapNote::hold_head )
|
|
|
|
|
{
|
|
|
|
|
if( pHeadRow != NULL )
|
|
|
|
|
*pHeadRow = iRow;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return IsHoldNoteAtRow( iTrack, iRow, pHeadRow );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Determine if a hold note lies on the given spot. Return true if so. If
|
|
|
|
|
* pHeadRow is non-NULL, return the row of the head. (Note that this returns
|
|
|
|
|
* false if a hold head lies on iRow itself.) */
|
|
|
|
|
/* XXX: rename this to IsHoldBodyAtRow */
|
2005-07-22 00:14:24 +00:00
|
|
|
bool NoteData::IsHoldNoteAtRow( int iTrack, int iRow, int *pHeadRow ) const
|
2003-12-18 02:34:59 +00:00
|
|
|
{
|
2005-01-23 17:58:32 +00:00
|
|
|
int iDummy;
|
|
|
|
|
if( pHeadRow == NULL )
|
|
|
|
|
pHeadRow = &iDummy;
|
|
|
|
|
|
|
|
|
|
bool bFoundHead = false;
|
2005-01-25 05:02:35 +00:00
|
|
|
/* Starting at iRow, search upwards. If we find a TapNote::hold_head, we're within
|
|
|
|
|
* a hold. If we find a tap, mine or attack, we're not--those never lie within hold
|
|
|
|
|
* notes. Ignore autoKeysound. */
|
|
|
|
|
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE_REVERSE( *this, iTrack, r, 0, iRow )
|
2003-12-18 02:34:59 +00:00
|
|
|
{
|
2005-01-25 05:02:35 +00:00
|
|
|
const TapNote &tn = GetTapNote( iTrack, r );
|
|
|
|
|
switch( tn.type )
|
2005-01-22 20:22:12 +00:00
|
|
|
{
|
2005-01-25 05:02:35 +00:00
|
|
|
case TapNote::hold_head:
|
|
|
|
|
if( tn.iDuration + r < iRow )
|
2005-01-23 17:58:32 +00:00
|
|
|
return false;
|
2005-01-25 05:02:35 +00:00
|
|
|
*pHeadRow = r;
|
|
|
|
|
return true;
|
2005-01-23 17:58:32 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
case TapNote::tap:
|
|
|
|
|
case TapNote::mine:
|
|
|
|
|
case TapNote::attack:
|
2006-08-19 20:05:43 +00:00
|
|
|
case TapNote::lift:
|
2005-01-23 17:58:32 +00:00
|
|
|
return false;
|
|
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
case TapNote::empty:
|
|
|
|
|
case TapNote::autoKeysound:
|
|
|
|
|
/* ignore */
|
|
|
|
|
continue;
|
2006-08-19 19:55:05 +00:00
|
|
|
DEFAULT_FAIL( tn.type );
|
2005-01-23 17:58:32 +00:00
|
|
|
}
|
2005-01-25 05:02:35 +00:00
|
|
|
|
|
|
|
|
if( bFoundHead )
|
|
|
|
|
break;
|
2005-01-23 17:58:32 +00:00
|
|
|
}
|
2005-01-25 05:02:35 +00:00
|
|
|
|
|
|
|
|
return bFoundHead;
|
2003-12-18 02:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
2005-03-29 20:25:14 +00:00
|
|
|
bool NoteData::IsEmpty() const
|
|
|
|
|
{
|
|
|
|
|
for( int t=0; t < GetNumTracks(); t++ )
|
|
|
|
|
{
|
|
|
|
|
int iRow = -1;
|
|
|
|
|
if( !GetNextTapNoteRowForTrack( t, iRow ) )
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-14 20:27:52 +00:00
|
|
|
int NoteData::GetFirstRow() const
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2003-12-16 04:00:39 +00:00
|
|
|
int iEarliestRowFoundSoFar = -1;
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2004-10-02 05:08:59 +00:00
|
|
|
for( int t=0; t < GetNumTracks(); t++ )
|
2002-07-11 19:02:26 +00:00
|
|
|
{
|
2004-10-25 03:36:42 +00:00
|
|
|
int iRow = -1;
|
|
|
|
|
if( !GetNextTapNoteRowForTrack( t, iRow ) )
|
2004-09-29 06:43:57 +00:00
|
|
|
continue;
|
2004-10-25 03:36:42 +00:00
|
|
|
|
2004-09-29 06:43:57 +00:00
|
|
|
if( iEarliestRowFoundSoFar == -1 )
|
2004-10-25 03:36:42 +00:00
|
|
|
iEarliestRowFoundSoFar = iRow;
|
2004-09-29 06:43:57 +00:00
|
|
|
else
|
2004-10-25 03:36:42 +00:00
|
|
|
iEarliestRowFoundSoFar = min( iEarliestRowFoundSoFar, iRow );
|
2002-07-11 19:02:26 +00:00
|
|
|
}
|
|
|
|
|
|
2003-12-16 04:00:39 +00:00
|
|
|
if( iEarliestRowFoundSoFar == -1 ) // there are no notes
|
2002-08-13 23:26:46 +00:00
|
|
|
return 0;
|
2003-03-06 22:40:04 +00:00
|
|
|
|
2003-12-16 04:00:39 +00:00
|
|
|
return iEarliestRowFoundSoFar;
|
2002-07-11 19:02:26 +00:00
|
|
|
}
|
|
|
|
|
|
2003-12-16 04:00:39 +00:00
|
|
|
int NoteData::GetLastRow() const
|
2002-07-11 19:02:26 +00:00
|
|
|
{
|
2003-12-16 04:00:39 +00:00
|
|
|
int iOldestRowFoundSoFar = 0;
|
2002-07-11 19:02:26 +00:00
|
|
|
|
2004-10-02 05:08:59 +00:00
|
|
|
for( int t=0; t < GetNumTracks(); t++ )
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2005-01-22 19:18:42 +00:00
|
|
|
int iRow = MAX_NOTE_ROW;
|
2004-10-25 03:36:42 +00:00
|
|
|
if( !GetPrevTapNoteRowForTrack( t, iRow ) )
|
2004-09-29 06:43:57 +00:00
|
|
|
continue;
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
/* XXX: We might have a hold note near the end with autoplay sounds
|
|
|
|
|
* after it. Do something else with autoplay sounds ... */
|
|
|
|
|
const TapNote &tn = GetTapNote( t, iRow );
|
|
|
|
|
if( tn.type == TapNote::hold_head )
|
|
|
|
|
iRow += tn.iDuration;
|
|
|
|
|
|
|
|
|
|
iOldestRowFoundSoFar = max( iOldestRowFoundSoFar, iRow );
|
2002-07-11 19:02:26 +00:00
|
|
|
}
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2003-12-16 04:00:39 +00:00
|
|
|
return iOldestRowFoundSoFar;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-22 17:34:10 +00:00
|
|
|
int NoteData::GetNumTapNotes( int iStartIndex, int iEndIndex ) const
|
2002-12-14 20:34:38 +00:00
|
|
|
{
|
2004-09-29 06:43:57 +00:00
|
|
|
int iNumNotes = 0;
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2002-09-06 00:21:49 +00:00
|
|
|
{
|
2004-10-24 10:20:24 +00:00
|
|
|
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
|
2002-12-14 20:34:38 +00:00
|
|
|
{
|
2004-10-25 03:16:40 +00:00
|
|
|
const TapNote &tn = GetTapNote(t, r);
|
2004-09-12 05:56:24 +00:00
|
|
|
if( tn.type != TapNote::empty && tn.type != TapNote::mine )
|
2002-06-24 22:04:31 +00:00
|
|
|
iNumNotes++;
|
2002-12-14 20:34:38 +00:00
|
|
|
}
|
2002-09-06 00:21:49 +00:00
|
|
|
}
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2002-06-24 22:04:31 +00:00
|
|
|
return iNumNotes;
|
2002-04-16 17:31:00 +00:00
|
|
|
}
|
|
|
|
|
|
2005-01-22 17:34:10 +00:00
|
|
|
int NoteData::GetNumRowsWithTap( int iStartIndex, int iEndIndex ) const
|
2003-03-16 18:57:34 +00:00
|
|
|
{
|
|
|
|
|
int iNumNotes = 0;
|
2004-10-24 10:20:24 +00:00
|
|
|
FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( *this, r, iStartIndex, iEndIndex )
|
|
|
|
|
if( IsThereATapAtRow(r) )
|
2003-03-16 18:57:34 +00:00
|
|
|
iNumNotes++;
|
|
|
|
|
|
|
|
|
|
return iNumNotes;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-22 17:34:10 +00:00
|
|
|
int NoteData::GetNumMines( int iStartIndex, int iEndIndex ) const
|
2003-11-26 04:21:59 +00:00
|
|
|
{
|
2004-09-29 06:43:57 +00:00
|
|
|
int iNumMines = 0;
|
2003-12-11 04:52:23 +00:00
|
|
|
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2003-11-26 04:21:59 +00:00
|
|
|
{
|
2004-10-24 10:20:24 +00:00
|
|
|
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
|
2004-10-25 03:16:40 +00:00
|
|
|
if( GetTapNote(t, r).type == TapNote::mine )
|
2003-11-26 04:21:59 +00:00
|
|
|
iNumMines++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return iNumMines;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-22 17:34:10 +00:00
|
|
|
int NoteData::GetNumRowsWithTapOrHoldHead( int iStartIndex, int iEndIndex ) const
|
2003-11-10 01:24:46 +00:00
|
|
|
{
|
|
|
|
|
int iNumNotes = 0;
|
2004-10-24 10:20:24 +00:00
|
|
|
FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( *this, r, iStartIndex, iEndIndex )
|
|
|
|
|
if( IsThereATapOrHoldHeadAtRow(r) )
|
2003-11-10 01:24:46 +00:00
|
|
|
iNumNotes++;
|
|
|
|
|
|
|
|
|
|
return iNumNotes;
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-20 20:15:41 +00:00
|
|
|
bool NoteData::RowNeedsAtLeastSimultaneousPresses( int iMinSimultaneousPresses, const int row ) const
|
2003-12-16 07:58:37 +00:00
|
|
|
{
|
|
|
|
|
int iNumNotesThisIndex = 0;
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2003-12-16 07:58:37 +00:00
|
|
|
{
|
2004-10-25 03:16:40 +00:00
|
|
|
const TapNote &tn = GetTapNote(t, row);
|
2004-09-12 05:56:24 +00:00
|
|
|
switch( tn.type )
|
|
|
|
|
{
|
|
|
|
|
case TapNote::mine:
|
|
|
|
|
case TapNote::empty:
|
|
|
|
|
continue; // skip these types - they don't count
|
|
|
|
|
}
|
2003-12-16 07:58:37 +00:00
|
|
|
++iNumNotesThisIndex;
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-23 10:37:36 +00:00
|
|
|
/* We must have at least one tap or hold head at this row to count it. */
|
2003-12-16 07:58:37 +00:00
|
|
|
if( !iNumNotesThisIndex )
|
|
|
|
|
return false;
|
|
|
|
|
|
2005-03-20 20:15:41 +00:00
|
|
|
if( iNumNotesThisIndex < iMinSimultaneousPresses )
|
2003-12-16 07:58:37 +00:00
|
|
|
{
|
2005-01-25 05:02:35 +00:00
|
|
|
/* We have at least one, but not enough. Count holds. Do count adjacent holds. */
|
|
|
|
|
for( int t=0; t<GetNumTracks(); ++t )
|
2003-12-16 07:58:37 +00:00
|
|
|
{
|
2005-07-22 00:14:24 +00:00
|
|
|
if( IsHoldNoteAtRow(t, row) )
|
2003-12-16 07:58:37 +00:00
|
|
|
++iNumNotesThisIndex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-20 20:15:41 +00:00
|
|
|
return iNumNotesThisIndex >= iMinSimultaneousPresses;
|
2003-12-16 07:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
2005-03-20 20:15:41 +00:00
|
|
|
int NoteData::GetNumRowsWithSimultaneousPresses( int iMinSimultaneousPresses, int iStartIndex, int iEndIndex ) const
|
2003-11-26 04:31:29 +00:00
|
|
|
{
|
2003-12-16 04:00:39 +00:00
|
|
|
/* Count the number of times you have to use your hands. This includes
|
|
|
|
|
* three taps at the same time, a tap while two hold notes are being held,
|
|
|
|
|
* etc. Only count rows that have at least one tap note (hold heads count).
|
|
|
|
|
* Otherwise, every row of hold notes counts, so three simultaneous hold
|
|
|
|
|
* notes will count as hundreds of "hands". */
|
2003-11-26 04:31:29 +00:00
|
|
|
int iNum = 0;
|
2004-10-24 10:20:24 +00:00
|
|
|
FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( *this, r, iStartIndex, iEndIndex )
|
2003-11-26 04:31:29 +00:00
|
|
|
{
|
2005-03-20 20:15:41 +00:00
|
|
|
if( !RowNeedsAtLeastSimultaneousPresses(iMinSimultaneousPresses,r) )
|
2003-12-16 04:00:39 +00:00
|
|
|
continue;
|
2003-12-16 04:01:26 +00:00
|
|
|
|
2003-12-16 07:58:37 +00:00
|
|
|
iNum++;
|
2003-11-26 04:31:29 +00:00
|
|
|
}
|
2003-12-16 04:01:26 +00:00
|
|
|
|
2003-11-26 04:31:29 +00:00
|
|
|
return iNum;
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-20 20:15:41 +00:00
|
|
|
int NoteData::GetNumRowsWithSimultaneousTaps( int iMinTaps, int iStartIndex, int iEndIndex ) const
|
2002-05-19 01:59:48 +00:00
|
|
|
{
|
2003-11-26 04:21:59 +00:00
|
|
|
int iNum = 0;
|
2004-10-24 10:20:24 +00:00
|
|
|
FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( *this, r, iStartIndex, iEndIndex )
|
2002-05-19 01:59:48 +00:00
|
|
|
{
|
|
|
|
|
int iNumNotesThisIndex = 0;
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2002-05-19 01:59:48 +00:00
|
|
|
{
|
2004-10-25 03:16:40 +00:00
|
|
|
const TapNote &tn = GetTapNote(t, r);
|
2004-09-12 05:56:24 +00:00
|
|
|
if( tn.type != TapNote::mine && tn.type != TapNote::empty ) // mines don't count
|
2002-05-19 01:59:48 +00:00
|
|
|
iNumNotesThisIndex++;
|
|
|
|
|
}
|
2004-10-24 10:20:24 +00:00
|
|
|
if( iNumNotesThisIndex >= iMinTaps )
|
2003-11-26 04:21:59 +00:00
|
|
|
iNum++;
|
2002-05-19 01:59:48 +00:00
|
|
|
}
|
|
|
|
|
|
2003-11-26 04:21:59 +00:00
|
|
|
return iNum;
|
2002-05-19 01:59:48 +00:00
|
|
|
}
|
|
|
|
|
|
2005-01-22 17:34:10 +00:00
|
|
|
int NoteData::GetNumHoldNotes( int iStartIndex, int iEndIndex ) const
|
2002-05-19 01:59:48 +00:00
|
|
|
{
|
2003-12-16 04:00:39 +00:00
|
|
|
int iNumHolds = 0;
|
2005-01-25 05:02:35 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); ++t )
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2005-01-25 05:02:35 +00:00
|
|
|
const_iterator begin, end;
|
|
|
|
|
GetTapNoteRangeExclusive( t, iStartIndex, iEndIndex, begin, end );
|
|
|
|
|
for( ; begin != end; ++begin )
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2005-05-09 06:15:59 +00:00
|
|
|
if( begin->second.type != TapNote::hold_head ||
|
|
|
|
|
begin->second.subType != TapNote::hold_head_hold )
|
2005-01-25 05:02:35 +00:00
|
|
|
continue;
|
|
|
|
|
iNumHolds++;
|
2002-04-16 17:31:00 +00:00
|
|
|
}
|
|
|
|
|
}
|
2005-01-25 05:02:35 +00:00
|
|
|
return iNumHolds;
|
2003-10-04 03:02:26 +00:00
|
|
|
}
|
|
|
|
|
|
2005-04-25 09:33:58 +00:00
|
|
|
int NoteData::GetNumRolls( int iStartIndex, int iEndIndex ) const
|
|
|
|
|
{
|
|
|
|
|
int iNumRolls = 0;
|
|
|
|
|
for( int t=0; t<GetNumTracks(); ++t )
|
|
|
|
|
{
|
|
|
|
|
const_iterator begin, end;
|
|
|
|
|
GetTapNoteRangeExclusive( t, iStartIndex, iEndIndex, begin, end );
|
|
|
|
|
for( ; begin != end; ++begin )
|
|
|
|
|
{
|
|
|
|
|
if( begin->second.type != TapNote::hold_head ||
|
|
|
|
|
begin->second.subType != TapNote::hold_head_roll )
|
|
|
|
|
continue;
|
|
|
|
|
iNumRolls++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return iNumRolls;
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 19:00:12 +00:00
|
|
|
// -1 for iOriginalTracksToTakeFrom means no track
|
2005-01-22 20:22:12 +00:00
|
|
|
void NoteData::LoadTransformed( const NoteData& in, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] )
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2002-08-25 19:00:12 +00:00
|
|
|
// reset all notes
|
2002-07-03 21:27:26 +00:00
|
|
|
Init();
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2004-09-25 07:59:56 +00:00
|
|
|
SetNumTracks( iNewNumTracks );
|
2002-04-16 17:31:00 +00:00
|
|
|
|
|
|
|
|
// copy tracks
|
2004-09-28 02:14:56 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2002-08-25 19:00:12 +00:00
|
|
|
const int iOriginalTrack = iOriginalTrackToTakeFrom[t];
|
2005-01-22 20:22:12 +00:00
|
|
|
ASSERT_M( iOriginalTrack < in.GetNumTracks(), ssprintf("from %i >= %i (to %i)",
|
|
|
|
|
iOriginalTrack, in.GetNumTracks(), iOriginalTrackToTakeFrom[t]));
|
2002-12-28 16:07:19 +00:00
|
|
|
|
2002-08-25 19:00:12 +00:00
|
|
|
if( iOriginalTrack == -1 )
|
|
|
|
|
continue;
|
2005-01-25 05:02:35 +00:00
|
|
|
m_TapNotes[t] = in.m_TapNotes[iOriginalTrack];
|
2005-01-23 05:15:18 +00:00
|
|
|
}
|
2002-04-16 17:31:00 +00:00
|
|
|
}
|
2002-06-24 22:04:31 +00:00
|
|
|
|
2004-10-24 10:20:24 +00:00
|
|
|
void NoteData::MoveTapNoteTrack( int dest, int src )
|
2002-11-02 21:04:00 +00:00
|
|
|
{
|
|
|
|
|
if(dest == src) return;
|
2004-05-24 04:26:54 +00:00
|
|
|
m_TapNotes[dest] = m_TapNotes[src];
|
|
|
|
|
m_TapNotes[src].clear();
|
2002-11-02 21:04:00 +00:00
|
|
|
}
|
|
|
|
|
|
2004-10-24 10:20:24 +00:00
|
|
|
void NoteData::SetTapNote( int track, int row, const TapNote& t )
|
2002-10-25 23:32:50 +00:00
|
|
|
{
|
2004-09-25 07:59:56 +00:00
|
|
|
DEBUG_ASSERT( track>=0 && track<GetNumTracks() );
|
|
|
|
|
|
2004-09-29 06:43:57 +00:00
|
|
|
if( row < 0 )
|
|
|
|
|
return;
|
2002-12-13 01:23:26 +00:00
|
|
|
|
2004-09-29 06:43:57 +00:00
|
|
|
// There's no point in inserting empty notes into the map.
|
|
|
|
|
// Any blank space in the map is defined to be empty.
|
|
|
|
|
// If we're trying to insert an empty at a spot where
|
|
|
|
|
// another note already exists, then we're really deleting
|
|
|
|
|
// from the map.
|
|
|
|
|
if( t == TAP_EMPTY )
|
|
|
|
|
{
|
|
|
|
|
TrackMap &trackMap = m_TapNotes[track];
|
|
|
|
|
// remove the element at this position (if any). This will return either 0 or 1.
|
2004-10-02 05:08:59 +00:00
|
|
|
trackMap.erase( row );
|
2004-09-29 06:43:57 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_TapNotes[track][row] = t;
|
|
|
|
|
}
|
2002-10-25 23:32:50 +00:00
|
|
|
}
|
2003-09-21 23:16:44 +00:00
|
|
|
|
2004-05-15 03:00:43 +00:00
|
|
|
void NoteData::GetTracksHeldAtRow( int row, set<int>& addTo )
|
2003-11-07 05:17:41 +00:00
|
|
|
{
|
2005-01-25 05:02:35 +00:00
|
|
|
for( int t=0; t<GetNumTracks(); ++t )
|
2005-07-22 00:14:24 +00:00
|
|
|
if( IsHoldNoteAtRow( t, row ) )
|
2005-01-25 05:02:35 +00:00
|
|
|
addTo.insert( t );
|
2003-11-07 09:27:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int NoteData::GetNumTracksHeldAtRow( int row )
|
|
|
|
|
{
|
2004-05-15 03:00:43 +00:00
|
|
|
static set<int> viTracks;
|
2003-11-07 09:27:28 +00:00
|
|
|
viTracks.clear();
|
|
|
|
|
GetTracksHeldAtRow( row, viTracks );
|
|
|
|
|
return viTracks.size();
|
2003-11-10 01:34:55 +00:00
|
|
|
}
|
2004-05-31 22:42:12 +00:00
|
|
|
|
2004-09-29 06:43:57 +00:00
|
|
|
bool NoteData::GetNextTapNoteRowForTrack( int track, int &rowInOut ) const
|
|
|
|
|
{
|
|
|
|
|
const TrackMap &mapTrack = m_TapNotes[track];
|
|
|
|
|
|
|
|
|
|
// lower_bound and upper_bound have the same effect here because duplicate
|
|
|
|
|
// keys aren't allowed.
|
2004-10-24 23:49:33 +00:00
|
|
|
//
|
|
|
|
|
// lower_bound "finds the first element whose key is not less than k" (>=);
|
|
|
|
|
// upper_bound "finds the first element whose key greater than k". They don't
|
|
|
|
|
// have the same effect, but lower_bound(row+1) should equal upper_bound(row). -glenn
|
2004-09-29 06:43:57 +00:00
|
|
|
TrackMap::const_iterator iter = mapTrack.lower_bound( rowInOut+1 ); // "find the first note for which row+1 < key == false"
|
2004-10-24 23:49:33 +00:00
|
|
|
if( iter == mapTrack.end() )
|
2004-09-29 06:43:57 +00:00
|
|
|
return false;
|
2004-10-24 23:49:33 +00:00
|
|
|
|
|
|
|
|
ASSERT( iter->first > rowInOut );
|
|
|
|
|
rowInOut = iter->first;
|
|
|
|
|
return true;
|
2004-09-29 06:43:57 +00:00
|
|
|
}
|
|
|
|
|
|
2004-10-25 00:25:49 +00:00
|
|
|
bool NoteData::GetPrevTapNoteRowForTrack( int track, int &rowInOut ) const
|
|
|
|
|
{
|
|
|
|
|
const TrackMap &mapTrack = m_TapNotes[track];
|
|
|
|
|
|
|
|
|
|
/* Find the first note >= rowInOut. */
|
|
|
|
|
TrackMap::const_iterator iter = mapTrack.lower_bound( rowInOut );
|
|
|
|
|
|
|
|
|
|
/* If we're at the beginning, we can't move back any more. */
|
|
|
|
|
if( iter == mapTrack.begin() )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
/* Move back by one. */
|
|
|
|
|
--iter;
|
|
|
|
|
ASSERT( iter->first < rowInOut );
|
|
|
|
|
rowInOut = iter->first;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
/* Return an iterator range for [rowBegin,rowEnd). This can be used to efficiently
|
|
|
|
|
* iterate trackwise over a range of notes. It's like FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE,
|
|
|
|
|
* except it only requires two map searches (iterating is constant time), but the iterators will
|
|
|
|
|
* become invalid if the notes they represent disappear, so you need to pay attention to
|
|
|
|
|
* how you modify the data. */
|
|
|
|
|
void NoteData::GetTapNoteRange( int iTrack, int iStartRow, int iEndRow, TrackMap::iterator &begin, TrackMap::iterator &end )
|
2005-01-22 03:11:29 +00:00
|
|
|
{
|
|
|
|
|
ASSERT_M( iTrack < GetNumTracks(), ssprintf("%i,%i", iTrack, GetNumTracks()) );
|
2005-01-25 05:02:35 +00:00
|
|
|
TrackMap &mapTrack = m_TapNotes[iTrack];
|
|
|
|
|
|
|
|
|
|
if( iStartRow > iEndRow )
|
|
|
|
|
{
|
|
|
|
|
begin = end = mapTrack.end();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-25 19:36:38 +00:00
|
|
|
if( iStartRow <= 0 )
|
2005-01-25 05:02:35 +00:00
|
|
|
begin = mapTrack.begin(); /* optimization */
|
2005-01-25 19:36:38 +00:00
|
|
|
else if( iStartRow >= MAX_NOTE_ROW )
|
2005-01-25 05:02:35 +00:00
|
|
|
begin = mapTrack.end(); /* optimization */
|
|
|
|
|
else
|
|
|
|
|
begin = mapTrack.lower_bound( iStartRow );
|
2005-01-22 03:11:29 +00:00
|
|
|
|
2005-01-25 19:36:38 +00:00
|
|
|
if( iEndRow <= 0 )
|
2005-01-25 05:02:35 +00:00
|
|
|
end = mapTrack.begin(); /* optimization */
|
2005-01-25 19:36:38 +00:00
|
|
|
else if( iEndRow >= MAX_NOTE_ROW )
|
2005-01-25 05:02:35 +00:00
|
|
|
end = mapTrack.end(); /* optimization */
|
|
|
|
|
else
|
|
|
|
|
end = mapTrack.lower_bound( iEndRow );
|
2005-01-22 03:11:29 +00:00
|
|
|
}
|
|
|
|
|
|
2005-01-25 05:02:35 +00:00
|
|
|
|
|
|
|
|
/* Include hold notes that overlap the edges. If a hold note completely surrounds the given
|
|
|
|
|
* range, included it, too. If bIncludeAdjacent is true, also include hold notes adjacent to,
|
|
|
|
|
* but not overlapping, the edge. */
|
|
|
|
|
void NoteData::GetTapNoteRangeInclusive( int iTrack, int iStartRow, int iEndRow, iterator &begin, iterator &end, bool bIncludeAdjacent )
|
|
|
|
|
{
|
|
|
|
|
GetTapNoteRange( iTrack, iStartRow, iEndRow, begin, end );
|
|
|
|
|
|
|
|
|
|
if( begin != this->begin(iTrack) )
|
|
|
|
|
{
|
|
|
|
|
iterator prev = Decrement(begin);
|
|
|
|
|
|
|
|
|
|
const TapNote &tn = prev->second;
|
|
|
|
|
if( tn.type == TapNote::hold_head )
|
|
|
|
|
{
|
|
|
|
|
int iHoldStartRow = prev->first;
|
|
|
|
|
int iHoldEndRow = iHoldStartRow + tn.iDuration;
|
2005-01-25 19:36:38 +00:00
|
|
|
if( bIncludeAdjacent )
|
|
|
|
|
++iHoldEndRow;
|
|
|
|
|
if( iHoldEndRow > iStartRow )
|
2005-01-25 05:02:35 +00:00
|
|
|
{
|
|
|
|
|
/* The previous note is a hold. */
|
|
|
|
|
begin = prev;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( bIncludeAdjacent && end != this->end(iTrack) )
|
|
|
|
|
{
|
|
|
|
|
/* Include the next note if it's a hold and starts on iEndRow. */
|
|
|
|
|
const TapNote &tn = end->second;
|
|
|
|
|
int iHoldStartRow = end->first;
|
|
|
|
|
if( tn.type == TapNote::hold_head && iHoldStartRow == iEndRow )
|
|
|
|
|
++end;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NoteData::GetTapNoteRangeExclusive( int iTrack, int iStartRow, int iEndRow, iterator &begin, iterator &end )
|
|
|
|
|
{
|
|
|
|
|
GetTapNoteRange( iTrack, iStartRow, iEndRow, begin, end );
|
|
|
|
|
|
|
|
|
|
/* If end-1 is a hold_head, and extends beyond iEndRow, exclude it. */
|
|
|
|
|
if( begin != end && end != this->begin(iTrack) )
|
|
|
|
|
{
|
|
|
|
|
iterator prev = end;
|
|
|
|
|
--prev;
|
|
|
|
|
if( prev->second.type == TapNote::hold_head )
|
|
|
|
|
{
|
|
|
|
|
int iStartRow = prev->first;
|
|
|
|
|
const TapNote &tn = prev->second;
|
|
|
|
|
if( iStartRow + tn.iDuration >= iEndRow )
|
|
|
|
|
end = prev;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NoteData::GetTapNoteRange( int iTrack, int iStartRow, int iEndRow, TrackMap::const_iterator &begin, TrackMap::const_iterator &end ) const
|
|
|
|
|
{
|
|
|
|
|
TrackMap::iterator const_begin, const_end;
|
|
|
|
|
const_cast<NoteData *>(this)->GetTapNoteRange( iTrack, iStartRow, iEndRow, const_begin, const_end );
|
|
|
|
|
begin = const_begin;
|
|
|
|
|
end = const_end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NoteData::GetTapNoteRangeInclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::const_iterator &begin, TrackMap::const_iterator &end, bool bIncludeAdjacent ) const
|
|
|
|
|
{
|
|
|
|
|
TrackMap::iterator const_begin, const_end;
|
|
|
|
|
const_cast<NoteData *>(this)->GetTapNoteRangeInclusive( iTrack, iStartRow, iEndRow, const_begin, const_end, bIncludeAdjacent );
|
|
|
|
|
begin = const_begin;
|
|
|
|
|
end = const_end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NoteData::GetTapNoteRangeExclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::const_iterator &begin, TrackMap::const_iterator &end ) const
|
|
|
|
|
{
|
|
|
|
|
TrackMap::iterator const_begin, const_end;
|
|
|
|
|
const_cast<NoteData *>(this)->GetTapNoteRange( iTrack, iStartRow, iEndRow, const_begin, const_end );
|
|
|
|
|
begin = const_begin;
|
|
|
|
|
end = const_end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-09-29 06:43:57 +00:00
|
|
|
bool NoteData::GetNextTapNoteRowForAllTracks( int &rowInOut ) const
|
|
|
|
|
{
|
2005-01-22 19:18:42 +00:00
|
|
|
int iClosestNextRow = MAX_NOTE_ROW;
|
2004-09-29 06:43:57 +00:00
|
|
|
bool bAnyHaveNextNote = false;
|
|
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
|
|
|
|
{
|
|
|
|
|
int iNewRowThisTrack = rowInOut;
|
|
|
|
|
if( GetNextTapNoteRowForTrack( t, iNewRowThisTrack ) )
|
|
|
|
|
{
|
|
|
|
|
bAnyHaveNextNote = true;
|
2005-01-22 19:18:42 +00:00
|
|
|
ASSERT( iNewRowThisTrack < MAX_NOTE_ROW );
|
2004-09-29 06:43:57 +00:00
|
|
|
iClosestNextRow = min( iClosestNextRow, iNewRowThisTrack );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( bAnyHaveNextNote )
|
|
|
|
|
{
|
|
|
|
|
rowInOut = iClosestNextRow;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-21 22:30:00 +00:00
|
|
|
bool NoteData::GetPrevTapNoteRowForAllTracks( int &rowInOut ) const
|
|
|
|
|
{
|
|
|
|
|
int iClosestPrevRow = 0;
|
|
|
|
|
bool bAnyHavePrevNote = false;
|
|
|
|
|
for( int t=0; t<GetNumTracks(); t++ )
|
|
|
|
|
{
|
|
|
|
|
int iNewRowThisTrack = rowInOut;
|
|
|
|
|
if( GetPrevTapNoteRowForTrack( t, iNewRowThisTrack ) )
|
|
|
|
|
{
|
|
|
|
|
bAnyHavePrevNote = true;
|
|
|
|
|
ASSERT( iNewRowThisTrack < MAX_NOTE_ROW );
|
|
|
|
|
iClosestPrevRow = max( iClosestPrevRow, iNewRowThisTrack );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( bAnyHavePrevNote )
|
|
|
|
|
{
|
|
|
|
|
rowInOut = iClosestPrevRow;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-11-22 21:18:45 +00:00
|
|
|
XNode* NoteData::CreateNode() const
|
|
|
|
|
{
|
2006-10-01 14:51:50 +00:00
|
|
|
XNode *p = new XNode( "NoteData" );
|
2006-07-21 07:59:41 +00:00
|
|
|
|
2006-08-16 11:57:24 +00:00
|
|
|
all_tracks_const_iterator iter = GetTapNoteRangeAllTracks( 0, GetLastRow() );
|
2006-07-21 07:59:41 +00:00
|
|
|
|
|
|
|
|
for( ; !iter.IsAtEnd(); ++iter )
|
2005-11-22 21:18:45 +00:00
|
|
|
{
|
2006-07-21 07:59:41 +00:00
|
|
|
XNode *p2 = iter->CreateNode();
|
|
|
|
|
|
|
|
|
|
p2->AppendAttr( "Track", iter.Track() );
|
|
|
|
|
p2->AppendAttr( "Row", iter.Row() );
|
|
|
|
|
p->AppendChild( p2 );
|
2005-11-22 21:18:45 +00:00
|
|
|
}
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NoteData::LoadFromNode( const XNode* pNode )
|
|
|
|
|
{
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-22 23:08:13 +00:00
|
|
|
NoteData::reverse_iterator NoteData::rlower_bound( int iTrack, int iRow )
|
|
|
|
|
{
|
|
|
|
|
// TODO: optimize this
|
|
|
|
|
reverse_iterator i = m_TapNotes[iTrack].rbegin();
|
|
|
|
|
for( ; i != m_TapNotes[iTrack].rend(); ++i )
|
|
|
|
|
{
|
|
|
|
|
int first = i->first;
|
|
|
|
|
if( i->first <= iRow )
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NoteData::const_reverse_iterator NoteData::rlower_bound( int iTrack, int iRow ) const
|
|
|
|
|
{
|
|
|
|
|
NoteData::reverse_iterator iter = ((NoteData*)this)->rlower_bound( iTrack, iRow );
|
|
|
|
|
return iter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename ND, typename iter, typename TN, bool bReverse, typename iterMethodInt, iterMethodInt mybegin, iterMethodInt myend, typename iterMethodIntInt, iterMethodIntInt mylower_bound>
|
|
|
|
|
void NoteData::_all_tracks_iterator<ND, iter, TN, bReverse, iterMethodInt, mybegin, myend, iterMethodIntInt, mylower_bound>::Find()
|
2006-08-16 11:37:38 +00:00
|
|
|
{
|
2006-08-17 17:58:45 +00:00
|
|
|
int iMinRow = m_iEndRow+1;
|
2006-10-22 23:08:13 +00:00
|
|
|
int iMaxRow = m_iStartRow-1;
|
2006-08-16 11:37:38 +00:00
|
|
|
|
2006-08-17 18:05:42 +00:00
|
|
|
// If no notes can be found in the range, m_iTrack will stay -1 and IsAtEnd() will return true.
|
|
|
|
|
m_iTrack = -1;
|
2006-08-16 11:37:38 +00:00
|
|
|
for( int iTrack = 0; iTrack < m_NoteData.GetNumTracks(); ++iTrack )
|
|
|
|
|
{
|
2006-08-17 17:58:45 +00:00
|
|
|
iter &i = m_vIters[iTrack];
|
|
|
|
|
if( m_Cond )
|
2006-10-22 23:08:13 +00:00
|
|
|
{
|
|
|
|
|
while( i != (m_NoteData.*myend)(iTrack) && (bReverse ? (i->first > iMaxRow) : (i->first < iMinRow)) && !m_Cond(i->second) )
|
2006-08-17 17:58:45 +00:00
|
|
|
++i;
|
2006-10-22 23:08:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( i != (m_NoteData.*myend)(iTrack) && (bReverse ? (i->first > iMaxRow) : (i->first < iMinRow)) )
|
2006-08-16 11:37:38 +00:00
|
|
|
{
|
2006-10-22 23:08:13 +00:00
|
|
|
bReverse ? iMaxRow : iMinRow = i->first;
|
2006-08-17 17:58:45 +00:00
|
|
|
m_iTrack = iTrack;
|
2006-08-16 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-22 23:08:13 +00:00
|
|
|
template<typename ND, typename iter, typename TN, bool bReverse, typename iterMethodInt, iterMethodInt mybegin, iterMethodInt myend, typename iterMethodIntInt, iterMethodIntInt mylower_bound>
|
|
|
|
|
NoteData::_all_tracks_iterator<ND, iter, TN, bReverse, iterMethodInt, mybegin, myend, iterMethodIntInt, mylower_bound>::_all_tracks_iterator( ND &nd, int iStartRow, int iEndRow, NoteData::IteratorCond cond ) :
|
|
|
|
|
m_NoteData(nd), m_iTrack(0), m_iStartRow(iStartRow), m_iEndRow(iEndRow), m_Cond(cond)
|
2006-08-16 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
ASSERT( m_NoteData.GetNumTracks() > 0 );
|
2006-08-17 17:58:45 +00:00
|
|
|
for( int iTrack = 0; iTrack < m_NoteData.GetNumTracks(); ++iTrack )
|
2006-10-22 23:08:13 +00:00
|
|
|
{
|
|
|
|
|
iter i = (m_NoteData.*mylower_bound)(iTrack, bReverse?iEndRow:iStartRow);
|
|
|
|
|
iter end = (m_NoteData.*myend)(iTrack);
|
|
|
|
|
m_vIters.push_back( i );
|
|
|
|
|
}
|
2006-08-16 11:37:38 +00:00
|
|
|
Find();
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-22 23:08:13 +00:00
|
|
|
template<typename ND, typename iter, typename TN, bool bReverse, typename iterMethodInt, iterMethodInt mybegin, iterMethodInt myend, typename iterMethodIntInt, iterMethodIntInt mylower_bound>
|
|
|
|
|
NoteData::_all_tracks_iterator<ND, iter, TN, bReverse, iterMethodInt, mybegin, myend, iterMethodIntInt, mylower_bound> &NoteData::_all_tracks_iterator<ND, iter, TN, bReverse, iterMethodInt, mybegin, myend, iterMethodIntInt, mylower_bound>::operator++() // preincrement
|
2006-08-16 11:37:38 +00:00
|
|
|
{
|
2006-08-17 17:58:45 +00:00
|
|
|
++m_vIters[m_iTrack];
|
2006-08-16 11:37:38 +00:00
|
|
|
Find();
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-22 23:08:13 +00:00
|
|
|
template<typename ND, typename iter, typename TN, bool bReverse, typename iterMethodInt, iterMethodInt mybegin, iterMethodInt myend, typename iterMethodIntInt, iterMethodIntInt mylower_bound>
|
|
|
|
|
NoteData::_all_tracks_iterator<ND, iter, TN, bReverse, iterMethodInt, mybegin, myend, iterMethodIntInt, mylower_bound> NoteData::_all_tracks_iterator<ND, iter, TN, bReverse, iterMethodInt, mybegin, myend, iterMethodIntInt, mylower_bound>::operator++( int dummy ) // postincrement
|
2006-08-16 11:37:38 +00:00
|
|
|
{
|
2006-10-22 23:08:13 +00:00
|
|
|
_all_tracks_iterator<ND, iter, TN, bReverse, iterMethodInt, mybegin, myend, iterMethodIntInt, mylower_bound> ret(*this);
|
2006-08-16 11:37:38 +00:00
|
|
|
operator++();
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-22 23:08:13 +00:00
|
|
|
|
2006-08-16 11:37:38 +00:00
|
|
|
// Explicit instantiation.
|
2006-10-23 00:14:12 +00:00
|
|
|
template class NoteData::_all_tracks_iterator<NoteData, NoteData::iterator, TapNote, false, NoteData::iterator_method_int, &NoteData::begin, &NoteData::end, NoteData::iterator_method_int_int, &NoteData::lower_bound>;
|
|
|
|
|
template class NoteData::_all_tracks_iterator<const NoteData, NoteData::const_iterator, const TapNote, false, NoteData::const_iterator_method_int, &NoteData::begin, &NoteData::end, NoteData::const_iterator_method_int_int, &NoteData::lower_bound>;
|
|
|
|
|
template class NoteData::_all_tracks_iterator<NoteData, NoteData::reverse_iterator, TapNote, true, NoteData::reverse_iterator_method_int, &NoteData::rbegin, &NoteData::rend, NoteData::reverse_iterator_method_int_int, &NoteData::rlower_bound>;
|
|
|
|
|
template class NoteData::_all_tracks_iterator<const NoteData, NoteData::const_reverse_iterator, const TapNote, true, NoteData::const_reverse_iterator_method_int, &NoteData::rbegin, &NoteData::rend, NoteData::const_reverse_iterator_method_int_int, &NoteData::rlower_bound>;
|
2005-11-22 21:18:45 +00:00
|
|
|
|
2004-05-31 22:42:12 +00:00
|
|
|
/*
|
|
|
|
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|