本文整理汇总了C++中NoteData::GetTapLastEmptyTrack方法的典型用法代码示例。如果您正苦于以下问题:C++ NoteData::GetTapLastEmptyTrack方法的具体用法?C++ NoteData::GetTapLastEmptyTrack怎么用?C++ NoteData::GetTapLastEmptyTrack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NoteData
的用法示例。
在下文中一共展示了NoteData::GetTapLastEmptyTrack方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadFromBMSFile
static bool LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNameToData, Steps &out,
const MeasureToTimeSig_t &sigAdjustments, const map<RString,int> &idToKeySoundIndex )
{
LOG->Trace( "Steps::LoadFromBMSFile( '%s' )", sPath.c_str() );
out.m_StepsType = StepsType_Invalid;
// BMS player code. Fill in below and use to determine StepsType.
int iPlayer = -1;
RString sData;
if( GetTagFromMap( mapNameToData, "#player", sData ) )
iPlayer = atoi(sData);
if( GetTagFromMap( mapNameToData, "#playlevel", sData ) )
out.SetMeter( atoi(sData) );
NoteData ndNotes;
ndNotes.SetNumTracks( NUM_BMS_TRACKS );
/* Read time signatures. Note that these can differ across files in the same
* song. */
MeasureToTimeSig_t mapMeasureToTimeSig;
ReadTimeSigs( mapNameToData, mapMeasureToTimeSig );
int iHoldStarts[NUM_BMS_TRACKS];
int iHoldPrevs[NUM_BMS_TRACKS];
for( int i = 0; i < NUM_BMS_TRACKS; ++i )
{
iHoldStarts[i] = -1;
iHoldPrevs[i] = -1;
}
NameToData_t::const_iterator it;
for( it = mapNameToData.lower_bound("#00000"); it != mapNameToData.end(); ++it )
{
const RString &sName = it->first;
if( sName.size() != 6 || sName[0] != '#' || !IsAnInt( sName.substr(1, 5) ) )
continue;
// this is step or offset data. Looks like "#00705"
int iMeasureNo = atoi( sName.substr(1,3).c_str() );
int iRawTrackNum = atoi( sName.substr(4,2).c_str() );
int iRowNo = GetMeasureStartRow( mapMeasureToTimeSig, iMeasureNo, sigAdjustments );
float fBeatsPerMeasure = GetBeatsPerMeasure( mapMeasureToTimeSig, iMeasureNo, sigAdjustments );
const RString &sNoteData = it->second;
vector<TapNote> vTapNotes;
for( size_t i=0; i+1<sNoteData.size(); i+=2 )
{
RString sNoteId = sNoteData.substr( i, 2 );
if( sNoteId != "00" )
{
vTapNotes.push_back( TAP_ORIGINAL_TAP );
map<RString,int>::const_iterator it = idToKeySoundIndex.find( sNoteId );
if( it != idToKeySoundIndex.end() )
vTapNotes.back().iKeysoundIndex = it->second;
}
else
{
vTapNotes.push_back( TAP_EMPTY );
}
}
const unsigned iNumNotesInThisMeasure = vTapNotes.size();
for( unsigned j=0; j<iNumNotesInThisMeasure; j++ )
{
float fPercentThroughMeasure = (float)j/(float)iNumNotesInThisMeasure;
int row = iRowNo + lrintf( fPercentThroughMeasure * fBeatsPerMeasure * ROWS_PER_BEAT );
// some BMS files seem to have funky alignment, causing us to write gigantic cache files.
// Try to correct for this by quantizing.
row = Quantize( row, ROWS_PER_MEASURE/64 );
BmsTrack bmsTrack;
bool bIsHold;
if( ConvertRawTrackToTapNote(iRawTrackNum, bmsTrack, bIsHold) )
{
TapNote &tn = vTapNotes[j];
if( tn.type != TapNote::empty )
{
if( bmsTrack == BMS_AUTO_KEYSOUND_1 )
{
// shift the auto keysound as far right as possible
int iLastEmptyTrack = -1;
if( ndNotes.GetTapLastEmptyTrack(row, iLastEmptyTrack) &&
iLastEmptyTrack >= BMS_AUTO_KEYSOUND_1 )
{
tn.type = TapNote::autoKeysound;
bmsTrack = (BmsTrack)iLastEmptyTrack;
}
else
{
// no room for this note. Drop it.
continue;
}
}
else if( bIsHold )
{
if( iHoldStarts[bmsTrack] == -1 )
//.........这里部分代码省略.........