Interface cleanup, const fix, minor optimizations.

This commit is contained in:
Glenn Maynard
2003-10-04 03:04:44 +00:00
parent 8b78e58841
commit 23bf8cb1ca
3 changed files with 12 additions and 10 deletions
+7 -7
View File
@@ -127,14 +127,18 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData
out.Convert2sAnd3sToHoldNotes(); out.Convert2sAnd3sToHoldNotes();
} }
CString NoteDataUtil::GetSMNoteDataString(NoteData &in) void NoteDataUtil::GetSMNoteDataString( const NoteData &in_, CString &out )
{ {
in.ConvertHoldNotesTo2sAnd3s(); NoteData in;
in_.Get2sAnd3s( in );
float fLastBeat = in.GetLastBeat(); float fLastBeat = in.GetLastBeat();
int iLastMeasure = int( fLastBeat/BEATS_PER_MEASURE ); int iLastMeasure = int( fLastBeat/BEATS_PER_MEASURE );
CString sRet = "\n"; /* data begins on a new line when written to disk */ CString &sRet = out;
sRet = "\n"; /* data begins on a new line when written to disk */
sRet.reserve( 1024*32 );
for( int m=0; m<=iLastMeasure; m++ ) // foreach measure for( int m=0; m<=iLastMeasure; m++ ) // foreach measure
{ {
@@ -170,10 +174,6 @@ CString NoteDataUtil::GetSMNoteDataString(NoteData &in)
sRet.append(1, ','); sRet.append(1, ',');
} }
in.Convert2sAnd3sToHoldNotes();
return sRet;
} }
float NoteDataUtil::GetRadarValue( const NoteData &in, RadarCategory rv, float fSongSeconds ) float NoteDataUtil::GetRadarValue( const NoteData &in, RadarCategory rv, float fSongSeconds )
+1 -1
View File
@@ -28,7 +28,7 @@ namespace NoteDataUtil
{ {
NoteType GetSmallestNoteTypeForMeasure( const NoteData &n, int iMeasureIndex ); NoteType GetSmallestNoteTypeForMeasure( const NoteData &n, int iMeasureIndex );
void LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData ); void LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData );
CString GetSMNoteDataString(NoteData &in); void GetSMNoteDataString( const NoteData &in, CString &out );
float GetStreamRadarValue( const NoteData &in, float fSongSeconds ); float GetStreamRadarValue( const NoteData &in, float fSongSeconds );
float GetVoltageRadarValue( const NoteData &in, float fSongSeconds ); float GetVoltageRadarValue( const NoteData &in, float fSongSeconds );
+4 -2
View File
@@ -101,7 +101,8 @@ CString Steps::GetSMNoteData() const
if(!notes_comp) if(!notes_comp)
{ {
if(!notes) return ""; /* no data is no data */ if(!notes) return ""; /* no data is no data */
notes_comp = new CString(NoteDataUtil::GetSMNoteDataString(*notes)); notes_comp = new CString;
NoteDataUtil::GetSMNoteDataString( *notes, *notes_comp );
} }
return *notes_comp; return *notes_comp;
@@ -195,7 +196,8 @@ void Steps::Compress() const
if(!notes_comp) if(!notes_comp)
{ {
if(!notes) return; /* no data is no data */ if(!notes) return; /* no data is no data */
notes_comp = new CString(NoteDataUtil::GetSMNoteDataString(*notes)); notes_comp = new CString;
NoteDataUtil::GetSMNoteDataString( *notes, *notes_comp );
} }
delete notes; delete notes;