本文整理汇总了C++中TimingData::AddSegment方法的典型用法代码示例。如果您正苦于以下问题:C++ TimingData::AddSegment方法的具体用法?C++ TimingData::AddSegment怎么用?C++ TimingData::AddSegment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimingData
的用法示例。
在下文中一共展示了TimingData::AddSegment方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessStops
void SSCLoader::ProcessStops( TimingData &out, const RString sParam )
{
vector<RString> arrayStopExpressions;
split( sParam, ",", arrayStopExpressions );
for( unsigned b=0; b<arrayStopExpressions.size(); b++ )
{
vector<RString> arrayStopValues;
split( arrayStopExpressions[b], "=", arrayStopValues );
if( arrayStopValues.size() != 2 )
{
LOG->UserLog("Song file",
this->GetSongTitle(),
"has an invalid #STOPS value \"%s\" (must have exactly one '='), ignored.",
arrayStopExpressions[b].c_str() );
continue;
}
const float fBeat = StringToFloat( arrayStopValues[0] );
const float fNewStop = StringToFloat( arrayStopValues[1] );
if( fBeat >= 0 && fNewStop > 0 )
out.AddSegment( StopSegment(BeatToNoteRow(fBeat), fNewStop) );
else
{
LOG->UserLog("Song file",
this->GetSongTitle(),
"has an invalid Stop at beat %f, length %f.",
fBeat, fNewStop );
}
}
}
示例2: ProcessScrolls
void SSCLoader::ProcessScrolls( TimingData &out, const RString sParam )
{
vector<RString> vs1;
split( sParam, ",", vs1 );
FOREACH_CONST( RString, vs1, s1 )
{
vector<RString> vs2;
split( *s1, "=", vs2 );
if( vs2.size() < 2 )
{
LOG->UserLog("Song file",
this->GetSongTitle(),
"has an scroll change with %i values.",
static_cast<int>(vs2.size()) );
continue;
}
const float fBeat = StringToFloat( vs2[0] );
const float fRatio = StringToFloat( vs2[1] );
if( fBeat < 0 )
{
LOG->UserLog("Song file",
this->GetSongTitle(),
"has an scroll change with beat %f.",
fBeat );
continue;
}
out.AddSegment( ScrollSegment(BeatToNoteRow(fBeat), fRatio) );
}
示例3: ProcessLabels
void SSCLoader::ProcessLabels( TimingData &out, const RString sParam )
{
vector<RString> arrayLabelExpressions;
split( sParam, ",", arrayLabelExpressions );
for( unsigned b=0; b<arrayLabelExpressions.size(); b++ )
{
vector<RString> arrayLabelValues;
split( arrayLabelExpressions[b], "=", arrayLabelValues );
if( arrayLabelValues.size() != 2 )
{
LOG->UserLog("Song file",
this->GetSongTitle(),
"has an invalid #LABELS value \"%s\" (must have exactly one '='), ignored.",
arrayLabelExpressions[b].c_str() );
continue;
}
const float fBeat = StringToFloat( arrayLabelValues[0] );
RString sLabel = arrayLabelValues[1];
TrimRight(sLabel);
if( fBeat >= 0.0f )
out.AddSegment( LabelSegment(BeatToNoteRow(fBeat), sLabel) );
else
{
LOG->UserLog("Song file",
this->GetSongTitle(),
"has an invalid Label at beat %f called %s.",
fBeat, sLabel.c_str() );
}
}
}
示例4: HandleBunki
static void HandleBunki( TimingData &timing, const float fEarlyBPM,
const float fCurBPM, const float fGap,
const float fPos )
{
const float BeatsPerSecond = fEarlyBPM / 60.0f;
const float beat = (fPos + fGap) * BeatsPerSecond;
LOG->Trace( "BPM %f, BPS %f, BPMPos %f, beat %f",
fEarlyBPM, BeatsPerSecond, fPos, beat );
timing.AddSegment( BPMSegment(BeatToNoteRow(beat), fCurBPM) );
}
示例5: ProcessTickcounts
static void ProcessTickcounts( const std::string & value, int & ticks, TimingData & timing )
{
/* TICKCOUNT will be used below if there are DM compliant BPM changes
* and stops. It will be called again in LoadFromKSFFile for the
* actual steps. */
ticks = StringToInt( value );
ticks = Rage::clamp( ticks, 0, ROWS_PER_BEAT );
if( ticks == 0 )
ticks = TickcountSegment::DEFAULT_TICK_COUNT;
timing.AddSegment( TickcountSegment(0, ticks) );
}
示例6: ProcessWarps
void SSCLoader::ProcessWarps( TimingData &out, const RString sParam, const float fVersion )
{
vector<RString> arrayWarpExpressions;
split( sParam, ",", arrayWarpExpressions );
for( unsigned b=0; b<arrayWarpExpressions.size(); b++ )
{
vector<RString> arrayWarpValues;
split( arrayWarpExpressions[b], "=", arrayWarpValues );
if( arrayWarpValues.size() != 2 )
{
LOG->UserLog("Song file",
this->GetSongTitle(),
"has an invalid #WARPS value \"%s\" (must have exactly one '='), ignored.",
arrayWarpExpressions[b].c_str() );
continue;
}
const float fBeat = StringToFloat( arrayWarpValues[0] );
const float fNewBeat = StringToFloat( arrayWarpValues[1] );
// Early versions were absolute in beats. They should be relative.
if( ( fVersion < VERSION_SPLIT_TIMING && fNewBeat > fBeat ) )
{
out.AddSegment( WarpSegment(BeatToNoteRow(fBeat), fNewBeat - fBeat) );
}
else if( fNewBeat > 0 )
out.AddSegment( WarpSegment(BeatToNoteRow(fBeat), fNewBeat) );
else
{
LOG->UserLog("Song file",
this->GetSongTitle(),
"has an invalid Warp at beat %f, BPM %f.",
fBeat, fNewBeat );
}
}
}
示例7: ProcessCombos
void SSCLoader::ProcessCombos( TimingData &out, const RString line, const int rowsPerBeat )
{
vector<RString> arrayComboExpressions;
split( line, ",", arrayComboExpressions );
for( unsigned f=0; f<arrayComboExpressions.size(); f++ )
{
vector<RString> arrayComboValues;
split( arrayComboExpressions[f], "=", arrayComboValues );
unsigned size = arrayComboValues.size();
if( size < 2 )
{
LOG->UserLog("Song file",
this->GetSongTitle(),
"has an invalid #COMBOS value \"%s\" (must have at least one '='), ignored.",
arrayComboExpressions[f].c_str() );
continue;
}
const float fComboBeat = StringToFloat( arrayComboValues[0] );
const int iCombos = StringToInt( arrayComboValues[1] );
const int iMisses = (size == 2 ? iCombos : StringToInt(arrayComboValues[2]));
out.AddSegment( ComboSegment( BeatToNoteRow(fComboBeat), iCombos, iMisses ) );
}
}
示例8: LoadFromKSFFile
static bool LoadFromKSFFile( const std::string &sPath, Steps &out, Song &song, bool bKIUCompliant )
{
using std::max;
LOG->Trace( "Steps::LoadFromKSFFile( '%s' )", sPath.c_str() );
MsdFile msd;
if( !msd.ReadFile( sPath, false ) ) // don't unescape
{
LOG->UserLog( "Song file", sPath, "couldn't be opened: %s", msd.GetError().c_str() );
return false;
}
// this is the value we read for TICKCOUNT
int iTickCount = -1;
// used to adapt weird tickcounts
//float fScrollRatio = 1.0f; -- uncomment when ready to use.
vector<std::string> vNoteRows;
// According to Aldo_MX, there is a default BPM and it's 60. -aj
bool bDoublesChart = false;
TimingData stepsTiming;
float SMGap1 = 0, SMGap2 = 0, BPM1 = -1, BPMPos2 = -1, BPM2 = -1, BPMPos3 = -1, BPM3 = -1;
for( unsigned i=0; i<msd.GetNumValues(); i++ )
{
const MsdFile::value_t &sParams = msd.GetValue( i );
std::string sValueName = Rage::make_upper(sParams[0]);
/* handle the data...well, not this data: not related to steps.
* Skips INTRO, MUSICINTRO, TITLEFILE, DISCFILE, SONGFILE. */
if (sValueName=="TITLE" || Rage::ends_with(sValueName, "INTRO")
|| Rage::ends_with(sValueName, "FILE") )
{
}
else if( sValueName=="BPM" )
{
BPM1 = StringToFloat(sParams[1]);
stepsTiming.AddSegment( BPMSegment(0, BPM1) );
}
else if( sValueName=="BPM2" )
{
if (bKIUCompliant)
{
BPM2 = StringToFloat( sParams[1] );
}
else
{
// LOG an error.
}
}
else if( sValueName=="BPM3" )
{
if (bKIUCompliant)
{
BPM3 = StringToFloat( sParams[1] );
}
else
{
// LOG an error.
}
}
else if( sValueName=="BUNKI" )
{
if (bKIUCompliant)
{
BPMPos2 = StringToFloat( sParams[1] ) / 100.0f;
}
else
{
// LOG an error.
}
}
else if( sValueName=="BUNKI2" )
{
if (bKIUCompliant)
{
BPMPos3 = StringToFloat( sParams[1] ) / 100.0f;
}
else
{
// LOG an error.
}
}
else if( sValueName=="STARTTIME" )
{
SMGap1 = -StringToFloat( sParams[1] )/100;
stepsTiming.set_offset(SMGap1);
}
// This is currently required for more accurate KIU BPM changes.
else if( sValueName=="STARTTIME2" )
{
if (bKIUCompliant)
{
SMGap2 = -StringToFloat( sParams[1] )/100;
}
else
{
// LOG an error.
//.........这里部分代码省略.........