本文整理汇总了C++中NoteData类的典型用法代码示例。如果您正苦于以下问题:C++ NoteData类的具体用法?C++ NoteData怎么用?C++ NoteData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NoteData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FOREACH_PlayerNumber
void Steps::CalculateRadarValues( float fMusicLengthSeconds )
{
// If we're autogen, don't calculate values. GetRadarValues will take from our parent.
if( parent != NULL )
return;
// Do write radar values, and leave it up to the reading app whether they want to trust
// the cached values without recalculating them.
/*
// If we're an edit, leave the RadarValues invalid.
if( IsAnEdit() )
return;
*/
NoteData tempNoteData;
this->GetNoteData( tempNoteData );
FOREACH_PlayerNumber( pn )
m_CachedRadarValues[pn].Zero();
if( tempNoteData.IsComposite() )
{
vector<NoteData> vParts;
NoteDataUtil::SplitCompositeNoteData( tempNoteData, vParts );
for( size_t pn = 0; pn < min(vParts.size(), size_t(NUM_PLAYERS)); ++pn )
NoteDataUtil::CalculateRadarValues( vParts[pn], fMusicLengthSeconds, m_CachedRadarValues[pn] );
}
else
{
NoteDataUtil::CalculateRadarValues( tempNoteData, fMusicLengthSeconds, m_CachedRadarValues[0] );
fill_n( m_CachedRadarValues + 1, NUM_PLAYERS-1, m_CachedRadarValues[0] );
}
}
示例2: CreateBlank
void Steps::CreateBlank( StepsType ntTo )
{
m_StepsType = ntTo;
NoteData noteData;
noteData.SetNumTracks( GAMEMAN->GetStepsTypeInfo(ntTo).iNumTracks );
this->SetNoteData( noteData );
}
示例3: Init
// -1 for iOriginalTracksToTakeFrom means no track
void NoteData::LoadTransformed( const NoteData* pOriginal, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] )
{
// reset all notes
Init();
NoteData Original;
Original.To4s( *pOriginal );
Config( Original );
m_iNumTracks = iNewNumTracks;
// copy tracks
for( int t=0; t<m_iNumTracks; t++ )
{
const int iOriginalTrack = iOriginalTrackToTakeFrom[t];
ASSERT_M( iOriginalTrack < Original.m_iNumTracks, ssprintf("from %i >= %i (to %i)",
iOriginalTrack, Original.m_iNumTracks, iOriginalTrackToTakeFrom[t]));
if( iOriginalTrack == -1 )
continue;
m_TapNotes[t] = Original.m_TapNotes[iOriginalTrack];
}
Convert4sToHoldNotes();
m_AttackMap = Original.GetAttackMap();
}
示例4: FOREACH_PlayerNumber
void Steps::CalculateRadarValues( float fMusicLengthSeconds )
{
// If we're autogen, don't calculate values. GetRadarValues will take from our parent.
if( parent != NULL )
return;
if( m_bAreCachedRadarValuesJustLoaded )
{
m_bAreCachedRadarValuesJustLoaded = false;
return;
}
// Do write radar values, and leave it up to the reading app whether they want to trust
// the cached values without recalculating them.
/*
// If we're an edit, leave the RadarValues invalid.
if( IsAnEdit() )
return;
*/
NoteData tempNoteData;
this->GetNoteData( tempNoteData );
FOREACH_PlayerNumber( pn )
m_CachedRadarValues[pn].Zero();
GAMESTATE->SetProcessedTimingData(this->GetTimingData());
if( tempNoteData.IsComposite() )
{
vector<NoteData> vParts;
NoteDataUtil::SplitCompositeNoteData( tempNoteData, vParts );
for( size_t pn = 0; pn < min(vParts.size(), size_t(NUM_PLAYERS)); ++pn )
NoteDataUtil::CalculateRadarValues( vParts[pn], fMusicLengthSeconds, m_CachedRadarValues[pn] );
}
else if (GAMEMAN->GetStepsTypeInfo(this->m_StepsType).m_StepsTypeCategory == StepsTypeCategory_Couple)
{
NoteData p1 = tempNoteData;
// XXX: Assumption that couple will always have an even number of notes.
const int tracks = tempNoteData.GetNumTracks() / 2;
p1.SetNumTracks(tracks);
NoteDataUtil::CalculateRadarValues(p1,
fMusicLengthSeconds,
m_CachedRadarValues[PLAYER_1]);
// at this point, p2 is tempNoteData.
NoteDataUtil::ShiftTracks(tempNoteData, tracks);
tempNoteData.SetNumTracks(tracks);
NoteDataUtil::CalculateRadarValues(tempNoteData,
fMusicLengthSeconds,
m_CachedRadarValues[PLAYER_2]);
}
else
{
NoteDataUtil::CalculateRadarValues( tempNoteData, fMusicLengthSeconds, m_CachedRadarValues[0] );
fill_n( m_CachedRadarValues + 1, NUM_PLAYERS-1, m_CachedRadarValues[0] );
}
GAMESTATE->SetProcessedTimingData(NULL);
}
示例5: CopyFrom
void Steps::CopyFrom( Steps* pSource, StepsType ntTo, float fMusicLengthSeconds ) // pSource does not have to be of the same StepsType
{
m_StepsType = ntTo;
NoteData noteData;
pSource->GetNoteData( noteData );
noteData.SetNumTracks( GAMEMAN->GetStepsTypeInfo(ntTo).iNumTracks );
parent = NULL;
this->SetNoteData( noteData );
this->SetDescription( pSource->GetDescription() );
this->SetDifficulty( pSource->GetDifficulty() );
this->SetMeter( pSource->GetMeter() );
this->CalculateRadarValues( fMusicLengthSeconds );
}
示例6: Decompress
void Steps::GetNoteData( NoteData& noteDataOut ) const
{
Decompress();
if( m_bNoteDataIsFilled )
{
noteDataOut = *m_pNoteData;
}
else
{
noteDataOut.ClearAll();
noteDataOut.SetNumTracks( GAMEMAN->GetStepsTypeInfo(m_StepsType).iNumTracks );
}
}
示例7: createNoteData
void MidiOut::playPart(mid_data &part)
{
NoteData *nd = createNoteData();
resetPlayData();
event = part.list;
tick = part.tempo * part.ippqn;
initClock();
while(1)
{
if(event)
{
if(playEvent(part, nd))
{
// We managed to play the event without having to wait. Move to the next one.
event = event->next;
}
}
else
{
if(loop_num >= 0)
{
popLoop();
}
else if(part.repeat)
{
// Repeat the part.
last_tick = 0;
last_time = 0;
initClock();
event = part.list;
// Handle note-offs?
nd->play();
}
else
{
// We played the last event, exit.
break;
}
}
if(show_notes)
nd->show(part.tempo);
endLoopDelay();
}
delete nd;
}
示例8: BeatToNoteRow
void KSFLoader::RemoveHoles( NoteData &out, const Song &song )
{
/* Start at the second BPM segment; the first one is already aligned. */
for( unsigned seg = 1; seg < song.m_Timing.m_BPMSegments.size(); ++seg )
{
// const float FromBeat = song.m_Timing.m_BPMSegments[seg].m_fStartBeat;
const float FromBeat = song.m_Timing.m_BPMSegments[seg].m_fStartBeat * song.m_BPMSegments[seg].m_fBPM / song.m_BPMSegments[0].m_fBPM;
const int FromRow = (int) BeatToNoteRow(FromBeat);
const int ToRow = (int) BeatToNoteRow(song.m_Timing.m_BPMSegments[seg].m_fStartBeat);
LOG->Trace("from %f (%i) to (%i)", FromBeat, FromRow, ToRow);
// const int ToRow = (int) roundf(FromRow * song.m_Timing.m_BPMSegments[0].m_fBPM / song.m_BPMSegments[seg].m_fBPM);
// const int Rows = out.GetLastRow() - FromRow + 1;
// int LastRow;
// if(seg+1 < song.m_Timing.m_BPMSegments().size())
// LastRow = (int) NoteRowToBeat( song.m_Timing.m_BPMSegments[seg+1].m_fStartBeat ) - 1;
// else
// LastRow = out.GetLastRow();
NoteData tmp;
tmp.SetNumTracks(out.GetNumTracks());
tmp.CopyRange( &out, FromRow, out.GetLastRow() );
out.ClearRange( FromRow, out.GetLastRow() );
out.CopyRange( &tmp, 0, tmp.GetLastRow(), ToRow );
}
/*
out.ConvertHoldNotesTo2sAnd3s();
for( t = 0; t < notedata.GetNumTracks(); ++t )
{
const float CurBPM = song.GetBPMAtBeat( NoteRowToBeat(row) );
song.m_Timing.m_BPMSegments.size()
for( int row = 0; row <= notedata.GetLastRow(); ++row )
{
TapNote tn = notedata.GetTapNote(t, row);
if( tn == TAP_EMPTY )
continue;
const int RealRow = (int) roundf(row * OrigBPM / CurBPM);
if( RealRow == row )
continue;
LOG->Trace("from %i to %i", row, RealRow);
notedata.SetTapNote( t, RealRow, tn );
notedata.SetTapNote( t, row, TAP_EMPTY );
}
}
out.Convert2sAnd3sToHoldNotes();
*/
}
示例9: MinTapNoteScore
/* Return the minimum tap score of a row. If the row isn't complete (not all
* taps have been hit), return TNS_None or TNS_Miss. */
TapNoteScore NoteDataWithScoring::MinTapNoteScore( const NoteData &in, unsigned row, PlayerNumber plnum )
{
//LOG->Trace("Hey I'm NoteDataWithScoring::MinTapNoteScore");
TapNoteScore score = TNS_W1;
for( int t=0; t<in.GetNumTracks(); t++ )
{
// Ignore mines (and fake arrows), or the score will always be TNS_None.
const TapNote &tn = in.GetTapNote( t, row );
if (tn.type == TapNoteType_Empty ||
tn.type == TapNoteType_Mine ||
tn.type == TapNoteType_Fake ||
tn.type == TapNoteType_AutoKeysound ||
( plnum != PlayerNumber_Invalid && tn.pn != plnum ) )
continue;
score = min( score, tn.result.tns );
}
//LOG->Trace( ssprintf("OMG score is?? %s",TapNoteScoreToString(score).c_str()) );
return score;
}
示例10: GetRowCounts
void ScoreKeeperNormal::GetRowCounts( const NoteData &nd, int iRow,
int &iNumHitContinueCombo, int &iNumHitMaintainCombo,
int &iNumBreakCombo )
{
iNumHitContinueCombo = iNumHitMaintainCombo = iNumBreakCombo = 0;
for( int track = 0; track < nd.GetNumTracks(); ++track )
{
const TapNote &tn = nd.GetTapNote( track, iRow );
if( tn.type != TapNoteType_Tap && tn.type != TapNoteType_HoldHead && tn.type != TapNoteType_Lift )
continue;
TapNoteScore tns = tn.result.tns;
if( tns >= m_MinScoreToContinueCombo )
++iNumHitContinueCombo;
else if( tns >= m_MinScoreToMaintainCombo )
++iNumHitMaintainCombo;
else
++iNumBreakCombo;
}
}
示例11: ASSERT
void Steps::SetNoteData( const NoteData& noteDataNew )
{
ASSERT( noteDataNew.GetNumTracks() == GAMEMAN->GetStepsTypeInfo(m_StepsType).iNumTracks );
DeAutogen( false );
*m_pNoteData = noteDataNew;
m_bNoteDataIsFilled = true;
m_sNoteDataCompressed = RString();
m_iHash = 0;
}
示例12: ASSERT
void Steps::SetNoteData( const NoteData& noteDataNew )
{
ASSERT( noteDataNew.GetNumTracks() == GAMEMAN->GetStepsTypeInfo(m_StepsType).iNumTracks );
DeAutogen( false );
*m_pNoteData = noteDataNew;
m_bNoteDataIsFilled = true;
m_sNoteDataCompressed = RString();
m_iHash = 0;
m_sFilename = RString(); // We can no longer read from the file because it has changed in memory.
}
示例13: DetermineStepsType
static StepsType DetermineStepsType( int iPlayer, const NoteData &nd, const RString &sPath )
{
ASSERT( NUM_PMS_TRACKS == nd.GetNumTracks() );
bool bTrackHasNote[NUM_NON_AUTO_KEYSOUND_TRACKS];
ZERO( bTrackHasNote );
int iLastRow = nd.GetLastRow();
for( int t=0; t<NUM_NON_AUTO_KEYSOUND_TRACKS; t++ )
{
for( int r=0; r<=iLastRow; r++ )
{
if( nd.GetTapNote(t, r).type != TapNote::empty )
{
bTrackHasNote[t] = true;
break;
}
}
}
int iNumNonEmptyTracks = 0;
for( int t=0; t<NUM_NON_AUTO_KEYSOUND_TRACKS; t++ )
if( bTrackHasNote[t] )
iNumNonEmptyTracks++;
switch( iPlayer )
{
case 1:
switch( iNumNonEmptyTracks )
{
case 5: return StepsType_popn_five;
case 9: return StepsType_popn_nine;
default: return StepsType_Invalid;
}
default:
LOG->UserLog( "Song file", sPath, "has an invalid #PLAYER value %d.", iPlayer );
return StepsType_Invalid;
}
}
示例14: GetTransformedNoteDataForStyle
void Style::GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData& original, NoteData& noteDataOut ) const
{
ASSERT( pn >=0 && pn <= NUM_PLAYERS );
int iNewToOriginalTrack[MAX_COLS_PER_PLAYER];
for( int col=0; col<m_iColsPerPlayer; col++ )
{
ColumnInfo colInfo = m_ColumnInfo[pn][col];
iNewToOriginalTrack[col] = colInfo.track;
}
noteDataOut.LoadTransformed( original, m_iColsPerPlayer, iNewToOriginalTrack );
}
示例15: Serialize
static void Serialize( const NoteData &o, Json::Value &root )
{
root = Json::Value(Json::arrayValue);
for(int t=0; t < o.GetNumTracks(); t++ )
{
NoteData::TrackMap::const_iterator begin, end;
o.GetTapNoteRange( t, 0, MAX_NOTE_ROW, begin, end );
//NoteData::TrackMap tm = o.GetTrack(t);
//FOREACHM_CONST( int, TapNote, tm, iter )
for( ; begin != end; ++begin )
{
int iRow = begin->first;
TapNote tn = begin->second;
root.resize( root.size()+1 );
Json::Value &root2 = root[ root.size()-1 ];
root2 = Json::Value(Json::arrayValue);
root2.resize(3);
root2[(unsigned)0] = NoteRowToBeat(iRow);
root2[1] = t;
Serialize( tn, root2[2] );
}
}
}