当前位置: 首页>>代码示例>>C++>>正文


C++ NoteData类代码示例

本文整理汇总了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] );
    }
}
开发者ID:goofwear,项目名称:stepmania,代码行数:34,代码来源:Steps.cpp

示例2: CreateBlank

void Steps::CreateBlank( StepsType ntTo )
{
    m_StepsType = ntTo;
    NoteData noteData;
    noteData.SetNumTracks( GAMEMAN->GetStepsTypeInfo(ntTo).iNumTracks );
    this->SetNoteData( noteData );
}
开发者ID:goofwear,项目名称:stepmania,代码行数:7,代码来源:Steps.cpp

示例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();
}
开发者ID:Fighter19,项目名称:PSPMania,代码行数:28,代码来源:NoteData.cpp

示例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);
}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:58,代码来源:Steps.cpp

示例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 );
}
开发者ID:goofwear,项目名称:stepmania,代码行数:13,代码来源:Steps.cpp

示例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 );
	}
}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:14,代码来源:Steps.cpp

示例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;
}
开发者ID:pixelbound,项目名称:equilibre,代码行数:48,代码来源:MidiOut.cpp

示例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();
    */
}
开发者ID:augustg,项目名称:stepmania-3.9,代码行数:48,代码来源:NotesLoaderKSF.cpp

示例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;
}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:22,代码来源:NoteDataWithScoring.cpp

示例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;
	}
}
开发者ID:Jousway,项目名称:stepmania,代码行数:20,代码来源:ScoreKeeperNormal.cpp

示例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;
}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:12,代码来源:Steps.cpp

示例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.
}
开发者ID:goofwear,项目名称:stepmania,代码行数:13,代码来源:Steps.cpp

示例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;
	}
}
开发者ID:goofwear,项目名称:stepmania,代码行数:39,代码来源:NotesLoaderPMS.cpp

示例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 );
}
开发者ID:Ancaro,项目名称:stepmania,代码行数:13,代码来源:Style.cpp

示例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] );
		}
	}
}
开发者ID:AratnitY,项目名称:stepmania,代码行数:23,代码来源:NotesWriterJson.cpp


注:本文中的NoteData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。