Files
itgmania212121/stepmania/src/NoteData.cpp
T

558 lines
13 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2002-04-16 17:31:00 +00:00
/*
-----------------------------------------------------------------------------
2002-07-27 19:29:51 +00:00
Class: NoteData
2002-04-16 17:31:00 +00:00
2002-07-02 00:27:58 +00:00
Desc: See header.
2002-04-16 17:31:00 +00:00
2002-05-19 01:59:48 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
2002-04-16 17:31:00 +00:00
Chris Danford
-----------------------------------------------------------------------------
*/
#include "NoteData.h"
#include "RageUtil.h"
NoteData::NoteData()
2002-06-24 22:04:31 +00:00
{
Init();
}
void NoteData::Init()
2002-04-16 17:31:00 +00:00
{
m_iNumTracks = 0; // must do this before calling ClearAll()!
2003-02-09 19:16:25 +00:00
ClearAll();
2002-04-16 17:31:00 +00:00
}
2002-05-19 01:59:48 +00:00
NoteData::~NoteData()
{
}
2003-03-26 17:53:31 +00:00
int NoteData::GetNumTracks() const
2003-02-01 05:16:38 +00:00
{
return m_iNumTracks;
}
void NoteData::SetNumTracks( int iNewNumTracks )
{
m_iNumTracks = iNewNumTracks;
2003-02-01 05:27:49 +00:00
// Make sure that all tracks are of the same length
ASSERT( m_iNumTracks > 0 );
int rows = m_TapNotes[0].size();
for( int t=0; t<MAX_NOTE_TRACKS; t++ )
{
if( t<m_iNumTracks )
m_TapNotes[t].resize( rows, TAP_EMPTY );
else
m_TapNotes[t].clear();
}
2003-02-01 05:16:38 +00:00
}
/* Clear [iNoteIndexBegin,iNoteIndexEnd]; that is, including iNoteIndexEnd. */
2002-05-27 08:23:27 +00:00
void NoteData::ClearRange( int iNoteIndexBegin, int iNoteIndexEnd )
2002-04-16 17:31:00 +00:00
{
2002-08-25 05:00:23 +00:00
this->ConvertHoldNotesTo4s();
for( int c=0; c<m_iNumTracks; c++ )
2002-04-16 17:31:00 +00:00
{
2002-12-18 07:35:21 +00:00
for( int i=iNoteIndexBegin; i <= iNoteIndexEnd; i++ )
2002-10-25 05:19:27 +00:00
SetTapNote(c, i, TAP_EMPTY);
2002-04-16 17:31:00 +00:00
}
2002-08-25 05:00:23 +00:00
this->Convert4sToHoldNotes();
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()
{
for( int t=0; t<m_iNumTracks; t++ )
m_TapNotes[t].clear();
m_HoldNotes.clear();
}
2002-08-25 05:00:23 +00:00
/* Copy a range from pFrom to this. (Note that this does *not* overlay;
* all data in the range is overwritten.) */
2002-06-29 11:59:09 +00:00
void NoteData::CopyRange( NoteData* pFrom, int iFromIndexBegin, int iFromIndexEnd, int iToIndexBegin )
2002-04-16 17:31:00 +00:00
{
ASSERT( pFrom->m_iNumTracks == m_iNumTracks );
2002-06-29 11:59:09 +00:00
if( iToIndexBegin == -1 )
2002-07-02 00:27:58 +00:00
iToIndexBegin = 0;
2002-06-29 11:59:09 +00:00
2002-08-25 05:00:23 +00:00
pFrom->ConvertHoldNotesTo4s();
this->ConvertHoldNotesTo4s();
2002-04-16 17:31:00 +00:00
// copy recorded TapNotes
2002-08-25 05:00:23 +00:00
int f = iFromIndexBegin, t = iToIndexBegin;
2002-06-29 11:59:09 +00:00
while( f<=iFromIndexEnd )
2002-04-16 17:31:00 +00:00
{
for( int c=0; c<m_iNumTracks; c++ )
SetTapNote(c, t, pFrom->GetTapNote(c, f));
2002-06-29 11:59:09 +00:00
f++;
t++;
2002-04-16 17:31:00 +00:00
}
2002-08-25 05:00:23 +00:00
pFrom->Convert4sToHoldNotes();
this->Convert4sToHoldNotes();
2002-04-16 17:31:00 +00:00
}
2002-12-13 01:23:26 +00:00
void NoteData::Config( const NoteData &From )
{
m_iNumTracks = From.m_iNumTracks;
}
2003-10-04 02:30:06 +00:00
void NoteData::CopyAll( const NoteData* pFrom )
2002-12-13 01:23:26 +00:00
{
Config(*pFrom);
ClearAll();
2003-10-04 02:30:06 +00:00
for( int c=0; c<m_iNumTracks; c++ )
m_TapNotes[c] = pFrom->m_TapNotes[c];
m_HoldNotes = pFrom->m_HoldNotes;
2002-12-13 01:23:26 +00:00
}
2002-04-16 17:31:00 +00:00
void NoteData::AddHoldNote( HoldNote add )
{
ASSERT( add.fStartBeat>=0 && add.fEndBeat>=0 );
2002-04-16 17:31:00 +00:00
int i;
// look for other hold notes that overlap and merge them
// XXX: this is done implicitly with 4s, but 4s uses this function.
// Rework this later.
2002-11-02 22:59:12 +00:00
for( i=0; i<GetNumHoldNotes(); i++ ) // for each HoldNote
2002-04-16 17:31:00 +00:00
{
2002-11-02 22:53:04 +00:00
HoldNote &other = GetHoldNote(i);
if( add.iTrack == other.iTrack && // the tracks correspond
// they overlap
(
( other.fStartBeat <= add.fStartBeat && other.fEndBeat >= add.fEndBeat ) || // other consumes add
( other.fStartBeat >= add.fStartBeat && other.fEndBeat <= add.fEndBeat ) || // other inside add
( add.fStartBeat <= other.fStartBeat && other.fStartBeat <= add.fEndBeat ) || // other overlaps add
( add.fStartBeat <= other.fEndBeat && other.fEndBeat <= add.fEndBeat ) // other overlaps add
)
)
2002-04-16 17:31:00 +00:00
{
add.fStartBeat = min(add.fStartBeat, other.fStartBeat);
add.fEndBeat = max(add.fEndBeat, other.fEndBeat);
2002-04-16 17:31:00 +00:00
// delete this HoldNote
RemoveHoldNote( i );
--i;
2002-04-16 17:31:00 +00:00
}
}
int iAddStartIndex = BeatToNoteRow(add.fStartBeat);
int iAddEndIndex = BeatToNoteRow(add.fEndBeat);
2002-04-16 17:31:00 +00:00
// delete TapNotes under this HoldNote
for( i=iAddStartIndex+1; i<=iAddEndIndex; i++ )
SetTapNote(add.iTrack, i, TAP_EMPTY);
2002-04-16 17:31:00 +00:00
2002-06-14 22:25:22 +00:00
// add a tap note at the start of this hold
SetTapNote(add.iTrack, iAddStartIndex, TAP_HOLD_HEAD); // Hold begin marker. Don't draw this, but do grade it.
2002-06-14 22:25:22 +00:00
2002-11-02 23:10:38 +00:00
m_HoldNotes.push_back(add);
2002-04-16 17:31:00 +00:00
}
void NoteData::RemoveHoldNote( int iHoldIndex )
2002-04-16 17:31:00 +00:00
{
2002-11-02 23:10:38 +00:00
ASSERT( iHoldIndex >= 0 && iHoldIndex < GetNumHoldNotes() );
2002-11-02 22:53:04 +00:00
HoldNote& hn = GetHoldNote(iHoldIndex);
int iHoldStartIndex = BeatToNoteRow(hn.fStartBeat);
2002-04-16 17:31:00 +00:00
2002-06-14 22:25:22 +00:00
// delete a tap note at the start of this hold
SetTapNote(hn.iTrack, iHoldStartIndex, TAP_EMPTY);
2002-06-14 22:25:22 +00:00
// remove from list
2002-11-02 23:10:38 +00:00
m_HoldNotes.erase(m_HoldNotes.begin()+iHoldIndex, m_HoldNotes.begin()+iHoldIndex+1);
2002-04-16 17:31:00 +00:00
}
bool NoteData::IsThereATapAtRow( int iRow ) const
2002-06-24 22:04:31 +00:00
{
for( int t=0; t<m_iNumTracks; t++ )
2002-10-25 05:19:27 +00:00
if( GetTapNote(t, iRow) != TAP_EMPTY )
2002-06-24 22:04:31 +00:00
return true;
return false;
}
int NoteData::GetFirstRow() const
2002-04-16 17:31:00 +00:00
{
return BeatToNoteRow( GetFirstBeat() );
}
float NoteData::GetFirstBeat() const
{
2003-03-06 22:40:04 +00:00
float fEarliestBeatFoundSoFar = -1;
2002-04-16 17:31:00 +00:00
int i;
2003-03-06 22:40:04 +00:00
for( i=0; i <= int(m_TapNotes[0].size()); i++ )
2002-07-11 19:02:26 +00:00
{
if( !IsRowEmpty(i) )
{
fEarliestBeatFoundSoFar = NoteRowToBeat(i);
2002-07-11 19:02:26 +00:00
break;
}
}
2002-11-02 22:59:12 +00:00
for( i=0; i<GetNumHoldNotes(); i++ )
2003-03-06 22:40:04 +00:00
{
if( fEarliestBeatFoundSoFar == -1 ||
GetHoldNote(i).fStartBeat < fEarliestBeatFoundSoFar )
fEarliestBeatFoundSoFar = GetHoldNote(i).fStartBeat;
2003-03-06 22:40:04 +00:00
}
2002-04-16 17:31:00 +00:00
2003-03-06 22:40:04 +00:00
if( fEarliestBeatFoundSoFar == -1 ) // there are no notes
return 0;
2003-03-06 22:40:04 +00:00
return fEarliestBeatFoundSoFar;
2002-07-11 19:02:26 +00:00
}
2002-12-13 22:40:42 +00:00
int NoteData::GetLastRow() const
2002-07-11 19:02:26 +00:00
{
return BeatToNoteRow( GetLastBeat() );
2002-07-11 19:02:26 +00:00
}
2002-12-13 22:40:42 +00:00
float NoteData::GetLastBeat() const
2002-07-11 19:02:26 +00:00
{
float fOldestBeatFoundSoFar = 0;
2002-07-11 19:02:26 +00:00
int i;
2002-12-20 02:45:23 +00:00
for( i = int(m_TapNotes[0].size()); i>=0; i-- ) // iterate back to front
2002-04-16 17:31:00 +00:00
{
2002-07-11 19:02:26 +00:00
if( !IsRowEmpty(i) )
2002-04-16 17:31:00 +00:00
{
fOldestBeatFoundSoFar = NoteRowToBeat(i);
2002-07-11 19:02:26 +00:00
break;
2002-04-16 17:31:00 +00:00
}
}
2002-11-02 22:59:12 +00:00
for( i=0; i<GetNumHoldNotes(); i++ )
2002-07-11 19:02:26 +00:00
{
if( GetHoldNote(i).fEndBeat > fOldestBeatFoundSoFar )
fOldestBeatFoundSoFar = GetHoldNote(i).fEndBeat;
2002-07-11 19:02:26 +00:00
}
2002-04-16 17:31:00 +00:00
return fOldestBeatFoundSoFar;
2002-04-16 17:31:00 +00:00
}
2003-02-25 19:49:16 +00:00
int NoteData::GetNumTapNotes( float fStartBeat, float fEndBeat ) const
2002-12-14 20:34:38 +00:00
{
2002-06-24 22:04:31 +00:00
int iNumNotes = 0;
2003-01-02 09:44:09 +00:00
2003-02-25 19:49:16 +00:00
if(fEndBeat == -1) fEndBeat = GetMaxBeat();
2002-05-19 01:59:48 +00:00
int iStartIndex = BeatToNoteRow( fStartBeat );
int iEndIndex = BeatToNoteRow( fEndBeat );
2003-01-02 09:44:09 +00:00
2002-12-14 20:34:38 +00:00
for( int t=0; t<m_iNumTracks; t++ )
{
2002-12-19 04:46:55 +00:00
for( int i=iStartIndex; i<=iEndIndex; i++ )
2002-12-14 20:34:38 +00:00
{
2002-10-25 05:19:27 +00:00
if( GetTapNote(t, i) != TAP_EMPTY )
2002-06-24 22:04:31 +00:00
iNumNotes++;
2002-12-14 20:34:38 +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
}
int NoteData::GetNumRowsWithTaps( float fStartBeat, float fEndBeat ) const
{
int iNumNotes = 0;
if(fEndBeat == -1) fEndBeat = GetMaxBeat();
int iStartIndex = BeatToNoteRow( fStartBeat );
int iEndIndex = BeatToNoteRow( fEndBeat );
for( int i=iStartIndex; i<=iEndIndex; i++ )
if( IsThereATapAtRow(i) )
iNumNotes++;
return iNumNotes;
}
2003-02-25 19:49:16 +00:00
int NoteData::GetNumDoubles( float fStartBeat, float fEndBeat ) const
2002-05-19 01:59:48 +00:00
{
int iNumDoubles = 0;
2003-02-25 19:49:16 +00:00
if(fEndBeat == -1) fEndBeat = GetMaxBeat();
2002-05-19 01:59:48 +00:00
int iStartIndex = BeatToNoteRow( fStartBeat );
int iEndIndex = BeatToNoteRow( fEndBeat );
2002-12-18 07:35:21 +00:00
for( int i=iStartIndex; i<=iEndIndex; i++ )
2002-05-19 01:59:48 +00:00
{
int iNumNotesThisIndex = 0;
for( int t=0; t<m_iNumTracks; t++ )
{
2002-10-25 05:19:27 +00:00
if( GetTapNote(t, i) != TAP_EMPTY )
2002-05-19 01:59:48 +00:00
iNumNotesThisIndex++;
}
if( iNumNotesThisIndex >= 2 )
iNumDoubles++;
}
return iNumDoubles;
}
2003-02-25 19:49:16 +00:00
int NoteData::GetNumHoldNotes( float fStartBeat, float fEndBeat ) const
2002-05-19 01:59:48 +00:00
{
2002-06-24 22:04:31 +00:00
int iNumHolds = 0;
2002-05-19 01:59:48 +00:00
2003-02-25 19:49:16 +00:00
if(fEndBeat == -1) fEndBeat = GetMaxBeat();
2002-11-02 22:59:12 +00:00
for( int i=0; i<GetNumHoldNotes(); i++ )
2002-05-19 01:59:48 +00:00
{
2002-11-02 22:53:04 +00:00
const HoldNote &hn = GetHoldNote(i);
if( fStartBeat <= hn.fStartBeat && hn.fEndBeat <= fEndBeat )
2002-06-24 22:04:31 +00:00
iNumHolds++;
2002-05-19 01:59:48 +00:00
}
2002-06-24 22:04:31 +00:00
return iNumHolds;
2002-04-16 17:31:00 +00:00
}
void NoteData::Convert2sAnd3sToHoldNotes()
{
2002-10-25 05:06:52 +00:00
// Any note will end a hold (not just a TAP_HOLD_TAIL). This makes parsing DWIs much easier.
// Plus, allowing tap notes in the middle of a hold doesn't make sense!
2002-04-16 17:31:00 +00:00
2002-11-24 06:59:58 +00:00
int rows = GetLastRow();
2002-04-16 17:31:00 +00:00
for( int col=0; col<m_iNumTracks; col++ ) // foreach column
{
2002-11-24 06:59:58 +00:00
for( int i=0; i<=rows; i++ ) // foreach TapNote element
2002-04-16 17:31:00 +00:00
{
2002-10-25 05:19:27 +00:00
if( GetTapNote(col, i) != TAP_HOLD_HEAD ) // this is a HoldNote begin marker
continue;
2002-10-25 05:19:27 +00:00
SetTapNote(col, i, TAP_EMPTY);
2002-11-24 06:59:58 +00:00
for( int j=i+1; j<=rows; j++ ) // search for end of HoldNote
2002-04-16 17:31:00 +00:00
{
// end hold on the next note we see
2002-10-25 05:19:27 +00:00
if( GetTapNote(col, j) == TAP_EMPTY )
continue;
2002-10-25 05:19:27 +00:00
SetTapNote(col, j, TAP_EMPTY);
2003-04-05 21:18:18 +00:00
AddHoldNote( HoldNote(col, NoteRowToBeat(i), NoteRowToBeat(j)) );
break;
2002-04-16 17:31:00 +00:00
}
}
}
}
2002-08-25 05:00:23 +00:00
/* "102000301" ==
* "104444001" */
2002-04-16 17:31:00 +00:00
void NoteData::ConvertHoldNotesTo2sAnd3s()
{
// copy HoldNotes into the new structure, but expand them into 2s and 3s
2002-11-02 22:59:12 +00:00
for( int i=0; i<GetNumHoldNotes(); i++ )
2002-04-16 17:31:00 +00:00
{
2002-11-02 22:53:04 +00:00
const HoldNote &hn = GetHoldNote(i);
int iHoldStartIndex = max(BeatToNoteRow(hn.fStartBeat), 0);
int iHoldEndIndex = max(BeatToNoteRow(hn.fEndBeat), 0);
/* If they're the same, then they got clamped together, so just ignore it. */
if(iHoldStartIndex != iHoldEndIndex) {
SetTapNote(hn.iTrack, iHoldStartIndex, TAP_HOLD_HEAD);
SetTapNote(hn.iTrack, iHoldEndIndex, TAP_HOLD_TAIL);
}
2002-04-16 17:31:00 +00:00
}
2002-11-02 23:10:38 +00:00
m_HoldNotes.clear();
2002-04-16 17:31:00 +00:00
}
void NoteData::Get2sAnd3s( NoteData &out ) const
{
out.CopyAll( this );
out.ConvertHoldNotesTo2sAnd3s();
}
2002-08-25 05:00:23 +00:00
/* "104444001" ==
* "102000301"
*
* "4441" basically means "hold for three rows then hold for another tap";
* since taps don't really have a length, it's equivalent to "4440".
* So, make sure the character after a 4 is always a 0. */
void NoteData::Convert4sToHoldNotes()
{
int rows = GetLastRow();
2002-08-25 05:00:23 +00:00
for( int col=0; col<m_iNumTracks; col++ ) // foreach column
{
for( int i=0; i<=rows; i++ ) // foreach TapNote element
2002-08-25 05:00:23 +00:00
{
2002-10-25 05:19:27 +00:00
if( GetTapNote(col, i) != TAP_HOLD ) // this is a HoldNote body
2002-08-25 05:00:23 +00:00
continue;
2003-04-05 21:18:18 +00:00
HoldNote hn( col, NoteRowToBeat(i), 0 );
2002-08-25 05:00:23 +00:00
// search for end of HoldNote
do {
2002-10-25 04:59:12 +00:00
SetTapNote(col, i, TAP_EMPTY);
2002-08-25 05:00:23 +00:00
i++;
2002-10-25 05:06:52 +00:00
} while( GetTapNote(col, i) == TAP_HOLD);
2002-10-25 04:59:12 +00:00
SetTapNote(col, i, TAP_EMPTY);
2002-08-25 05:00:23 +00:00
hn.fEndBeat = NoteRowToBeat(i);
2002-08-25 05:00:23 +00:00
AddHoldNote( hn );
}
}
}
void NoteData::ConvertHoldNotesTo4s()
{
// copy HoldNotes into the new structure, but expand them into 4s
2002-11-02 22:59:12 +00:00
for( int i=0; i<GetNumHoldNotes(); i++ )
2002-08-25 05:00:23 +00:00
{
2002-11-02 22:53:04 +00:00
const HoldNote &hn = GetHoldNote(i);
int iHoldStartIndex = max(BeatToNoteRow(hn.fStartBeat), 0);
int iHoldEndIndex = max(BeatToNoteRow(hn.fEndBeat), 0);
2002-08-25 05:00:23 +00:00
for( int j = iHoldStartIndex; j < iHoldEndIndex; ++j)
SetTapNote(hn.iTrack, j, TAP_HOLD);
2002-08-25 05:00:23 +00:00
}
2002-11-02 23:10:38 +00:00
m_HoldNotes.clear();
2002-08-25 05:00:23 +00:00
}
// -1 for iOriginalTracksToTakeFrom means no track
void NoteData::LoadTransformed( NoteData* pOriginal, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] )
2002-04-16 17:31:00 +00:00
{
// reset all notes
2002-07-03 21:27:26 +00:00
Init();
2002-04-16 17:31:00 +00:00
2002-10-20 19:34:17 +00:00
pOriginal->ConvertHoldNotesTo4s();
2002-12-13 01:23:26 +00:00
Config(*pOriginal);
2002-04-16 17:31:00 +00:00
m_iNumTracks = iNewNumTracks;
// copy tracks
for( int t=0; t<m_iNumTracks; t++ )
{
const int iOriginalTrack = iOriginalTrackToTakeFrom[t];
2002-12-28 16:07:19 +00:00
2002-12-29 02:02:24 +00:00
ASSERT( iOriginalTrack < pOriginal->m_iNumTracks );
2002-12-28 16:07:19 +00:00
if( iOriginalTrack == -1 )
continue;
m_TapNotes[t] = pOriginal->m_TapNotes[iOriginalTrack];
2002-04-16 17:31:00 +00:00
}
pOriginal->Convert4sToHoldNotes();
Convert4sToHoldNotes();
2002-04-16 17:31:00 +00:00
}
2003-01-02 09:44:09 +00:00
#include "RageLog.h"
2002-06-24 22:04:31 +00:00
void NoteData::LoadTransformedSlidingWindow( NoteData* pOriginal, int iNewNumTracks )
{
2002-10-20 19:34:17 +00:00
// reset all notes
Init();
pOriginal->ConvertHoldNotesTo4s();
2002-12-13 01:23:26 +00:00
Config(*pOriginal);
m_iNumTracks = iNewNumTracks;
2002-12-19 04:39:16 +00:00
2002-10-05 20:03:14 +00:00
int iCurTrackOffset = 0;
int iTrackOffsetMin = 0;
int iTrackOffsetMax = abs( iNewNumTracks - pOriginal->m_iNumTracks );
int bOffsetIncreasing = true;
int iLastRow = pOriginal->GetLastRow();
for( int r=0; r<=iLastRow; )
{
2002-12-19 04:39:16 +00:00
// copy notes in this measure
for( int t=0; t<pOriginal->m_iNumTracks; t++ )
{
int iOldTrack = t;
int iNewTrack = (iOldTrack + iCurTrackOffset) % iNewNumTracks;
2003-01-02 09:44:09 +00:00
this->SetTapNote(iNewTrack, r, pOriginal->GetTapNote(iOldTrack, r));
}
2002-12-19 04:39:16 +00:00
r++;
if( r % (ROWS_PER_MEASURE*4) == 0 ) // adjust sliding window every 4 measures
{
2002-10-05 20:03:14 +00:00
// See if there is a hold crossing the beginning of this measure
bool bHoldCrossesThisMeasure = false;
if( r )
for( int t=0; t<=pOriginal->m_iNumTracks; t++ )
{
2002-10-25 05:19:27 +00:00
if( pOriginal->GetTapNote(t, r) == TAP_HOLD &&
pOriginal->GetTapNote(t, r-1) == TAP_HOLD)
{
bHoldCrossesThisMeasure = true;
break;
}
}
2002-10-05 20:03:14 +00:00
// adjust offset
if( !bHoldCrossesThisMeasure )
{
iCurTrackOffset += bOffsetIncreasing ? 1 : -1;
if( iCurTrackOffset == iTrackOffsetMin || iCurTrackOffset == iTrackOffsetMax )
bOffsetIncreasing ^= true;
CLAMP( iCurTrackOffset, iTrackOffsetMin, iTrackOffsetMax );
}
}
}
pOriginal->Convert4sToHoldNotes();
Convert4sToHoldNotes();
}
void NoteData::PadTapNotes(int rows)
{
2003-02-01 05:27:49 +00:00
int needed = rows - m_TapNotes[0].size() + 1;
if(needed < 0)
return;
needed += 100; /* optimization: give it a little more than it needs */
2002-11-03 01:33:33 +00:00
for(int track = 0; track < m_iNumTracks; ++track)
2002-11-03 21:37:08 +00:00
m_TapNotes[track].insert(m_TapNotes[track].end(), needed, TAP_EMPTY);
}
2002-11-02 21:04:00 +00:00
void NoteData::MoveTapNoteTrack(int dest, int src)
{
if(dest == src) return;
m_TapNotes[dest] = m_TapNotes[src];
m_TapNotes[src].clear();
}
void NoteData::SetTapNote(int track, int row, TapNote t)
{
if(row < 0) return;
2002-12-13 01:23:26 +00:00
PadTapNotes(row);
m_TapNotes[track][row]=t;
}
2003-09-21 23:16:44 +00:00
void NoteData::EliminateAllButOneTap(int row)
{
if(row < 0) return;
PadTapNotes(row);
int track;
for(track = 0; track < m_iNumTracks; ++track)
2003-09-21 23:16:44 +00:00
{
if( m_TapNotes[track][row] == TAP_TAP )
break;
}
track++;
for( ; track < m_iNumTracks; ++track)
{
if( m_TapNotes[track][row] == TAP_TAP )
m_TapNotes[track][row] = TAP_EMPTY;
}
}