no message

This commit is contained in:
Chris Danford
2002-06-30 23:19:33 +00:00
parent a44b557d1b
commit f8118fea49
17 changed files with 370 additions and 551 deletions
-128
View File
@@ -36,43 +36,6 @@ NoteData::~NoteData()
{
}
void NoteData::WriteToCacheFile( FILE* file )
{
LOG->WriteLine( "NoteData::WriteToCacheFile()" );
ConvertHoldNotesTo2sAnd3s();
int iNumRows = GetLastRow();
fprintf( file, "%d\n", iNumRows );
fwrite( m_TapNotes, sizeof(TapNote), MAX_NOTE_TRACKS*iNumRows, file );
fprintf( file, "\n" );
Convert2sAnd3sToHoldNotes();
}
void NoteData::ReadFromCacheFile( FILE* file )
{
LOG->WriteLine( "NoteData::ReadFromCacheFile()" );
int iNumRows;
fscanf( file, "%d\n", &iNumRows );
fread( m_TapNotes, sizeof(TapNote), MAX_NOTE_TRACKS*iNumRows, file );
fscanf( file, "\n", &iNumRows );
Convert2sAnd3sToHoldNotes();
}
void NoteData::SkipOverDataInCacheFile( FILE* file )
{
LOG->WriteLine( "NoteData::SkipOverDataInCacheFile()" );
int iNumRows;
fscanf( file, "%d\n", &iNumRows );
int retval = fseek( file, sizeof(TapNote)*MAX_NOTE_TRACKS*iNumRows, SEEK_CUR );
ASSERT( retval == 0 );
fscanf( file, "\n", &iNumRows );
}
void NoteData::ClearRange( int iNoteIndexBegin, int iNoteIndexEnd )
{
@@ -633,97 +596,6 @@ void NoteData::SnapToNearestNoteType( NoteType nt1, NoteType nt2, float fBeginBe
}
void NoteData::GetMeasureStrings( CStringArray &arrayMeasureStrings )
{
ConvertHoldNotesTo2sAnd3s();
float fLastBeat = this->GetLastBeat();
int iLastMeasure = int( fLastBeat/BEATS_PER_MEASURE );
for( int m=0; m<=iLastMeasure; m++ ) // foreach measure
{
CString sMeasureString;
int iMeasureStartIndex = m * ELEMENTS_PER_MEASURE;
int iMeasureLastIndex = (m+1) * ELEMENTS_PER_MEASURE - 1;
// probe to find the smallest note type
NoteType nt;
int iNoteIndexSpacing;
for( nt=(NoteType)0; nt<NUM_NOTE_TYPES; nt=NoteType(nt+1) )
{
float fBeatSpacing = NoteTypeToBeat( nt );
iNoteIndexSpacing = roundf( fBeatSpacing * ELEMENTS_PER_BEAT );
bool bFoundSmallerNote = false;
for( int i=iMeasureStartIndex; i<=iMeasureLastIndex; i++ ) // for each index in this measure
{
if( i % iNoteIndexSpacing == 0 )
continue; // skip
if( !IsRowEmpty(i) )
{
bFoundSmallerNote = true;
break;
}
}
if( bFoundSmallerNote )
continue; // keep searching
else
break; // stop searching
}
if( nt == NUM_NOTE_TYPES ) // we didn't find one
iNoteIndexSpacing = 1;
for( int i=iMeasureStartIndex; i<=iMeasureLastIndex; i+=iNoteIndexSpacing )
{
for( int c=0; c<m_iNumTracks; c++ )
sMeasureString += m_TapNotes[c][i];
sMeasureString += '\n';
}
arrayMeasureStrings.Add( sMeasureString );
}
}
void NoteData::SetFromMeasureStrings( CStringArray &arrayMeasureStrings )
{
for( int m=0; m<arrayMeasureStrings.GetSize(); m++ )
{
CString sMeasureString = arrayMeasureStrings[m];
sMeasureString.TrimLeft();
sMeasureString.TrimRight();
CStringArray arrayNoteLines;
split( sMeasureString, "\n", arrayNoteLines );
int iNumNoteLines = arrayNoteLines.GetSize();
for( int l=0; l<arrayNoteLines.GetSize(); l++ )
{
const float fPercentIntoMeasure = l/(float)arrayNoteLines.GetSize();
const float fBeat = (m + fPercentIntoMeasure) * BEATS_PER_MEASURE;
const int iIndex = BeatToNoteRow( fBeat );
CString sNoteLine = arrayNoteLines[l];
sNoteLine.TrimRight();
m_iNumTracks = max( m_iNumTracks, sNoteLine.GetLength() );
for( int c=0; c<sNoteLine.GetLength(); c++ )
{
m_TapNotes[c][iIndex] = sNoteLine[c];
}
}
}
ASSERT( m_iNumTracks != 0 );
}
float NoteData::GetStreamRadarValue( float fSongSeconds )
{
// density of steps