[timing] Notes* mostly covered.
This commit is contained in:
@@ -667,7 +667,7 @@ static bool LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNameTo
|
||||
float fFreezeSecs = fBeats / fBPS;
|
||||
|
||||
StopSegment * newSeg = new StopSegment( fBeat, fFreezeSecs );
|
||||
out.m_Timing.AddSegment( SEGMENT_STOP_DELAY, newSeg );
|
||||
out.m_Timing.AddSegment( SEGMENT_STOP, newSeg );
|
||||
LOG->Trace( "Inserting new Freeze at beat %f, secs %f", fBeat, newSeg->GetPause() );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -651,7 +651,7 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, set<RString> &Bla
|
||||
int iFreezeRow = BeatToNoteRow( StringToFloat(arrayFreezeValues[0]) / 4.0f );
|
||||
float fFreezeSeconds = StringToFloat( arrayFreezeValues[1] ) / 1000.0f;
|
||||
|
||||
out.m_SongTiming.AddSegment( SEGMENT_STOP_DELAY, new StopSegment(iFreezeRow, fFreezeSeconds) );
|
||||
out.m_SongTiming.AddSegment( SEGMENT_STOP, new StopSegment(iFreezeRow, fFreezeSeconds) );
|
||||
// LOG->Trace( "Adding a freeze segment: beat: %f, seconds = %f", fFreezeBeat, fFreezeSeconds );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ static void Deserialize(TimingSegment &seg_, const Json::Value &root)
|
||||
static_cast<BPMSegment *>(seg)->SetBPM(fBPM);
|
||||
break;
|
||||
}
|
||||
case SEGMENT_STOP_DELAY:
|
||||
case SEGMENT_STOP:
|
||||
{
|
||||
float fStop = root["Seconds"].asDouble();
|
||||
static_cast<StopSegment *>(seg)->SetPause(fStop);
|
||||
@@ -42,7 +42,7 @@ static void Deserialize(TimingSegment &seg_, const Json::Value &root)
|
||||
static void Deserialize(TimingData &td, const Json::Value &root)
|
||||
{
|
||||
JsonUtil::DeserializeVectorPointers( td.allTimingSegments[SEGMENT_BPM], Deserialize, root["BpmSegments"] );
|
||||
JsonUtil::DeserializeVectorPointers( td.allTimingSegments[SEGMENT_STOP_DELAY], Deserialize, root["StopSegments"] );
|
||||
JsonUtil::DeserializeVectorPointers( td.allTimingSegments[SEGMENT_STOP], Deserialize, root["StopSegments"] );
|
||||
}
|
||||
|
||||
static void Deserialize(LyricSegment &o, const Json::Value &root)
|
||||
|
||||
@@ -723,7 +723,7 @@ static void ReadGlobalTags( const RString &sPath, const NameToData_t &mapNameToD
|
||||
float fFreezeSecs = fBeats / fBPS;
|
||||
|
||||
StopSegment * newSeg = new StopSegment( fBeat, fFreezeSecs );
|
||||
out.m_SongTiming.AddSegment( SEGMENT_STOP_DELAY, newSeg );
|
||||
out.m_SongTiming.AddSegment( SEGMENT_STOP, newSeg );
|
||||
LOG->Trace( "Inserting new Freeze at beat %f, secs %f", fBeat, newSeg->GetPause() );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -315,7 +315,7 @@ void SMLoader::ProcessStops( TimingData &out, const RString line, const int rows
|
||||
}
|
||||
else if( fFreezeSeconds > 0.0f )
|
||||
{
|
||||
out.AddSegment(SEGMENT_STOP_DELAY,
|
||||
out.AddSegment(SEGMENT_STOP,
|
||||
new StopSegment(fFreezeBeat, fFreezeSeconds));
|
||||
}
|
||||
|
||||
@@ -353,14 +353,13 @@ void SMLoader::ProcessDelays( TimingData &out, const RString line, const int row
|
||||
const float fFreezeBeat = RowToBeat( arrayDelayValues[0], rowsPerBeat );
|
||||
const float fFreezeSeconds = StringToFloat( arrayDelayValues[1] );
|
||||
|
||||
StopSegment * new_seg = new StopSegment(fFreezeBeat,
|
||||
fFreezeSeconds,
|
||||
true);
|
||||
DelaySegment * new_seg = new DelaySegment(fFreezeBeat,
|
||||
fFreezeSeconds);
|
||||
|
||||
// LOG->Trace( "Adding a delay segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fStopSeconds );
|
||||
|
||||
if(fFreezeSeconds > 0.0f)
|
||||
out.AddSegment( SEGMENT_STOP_DELAY, new_seg );
|
||||
out.AddSegment( SEGMENT_DELAY, new_seg );
|
||||
else
|
||||
LOG->UserLog(
|
||||
"Song file",
|
||||
|
||||
@@ -381,7 +381,8 @@ bool NotesWriterDWI::Write( RString sPath, const Song &out )
|
||||
break;
|
||||
}
|
||||
|
||||
const vector<TimingSegment *> &stops = out.m_SongTiming.allTimingSegments[SEGMENT_STOP_DELAY];
|
||||
// TODO: Also check for delays, add them as stops minus one row?
|
||||
const vector<TimingSegment *> &stops = out.m_SongTiming.allTimingSegments[SEGMENT_STOP];
|
||||
if( !stops.empty() )
|
||||
{
|
||||
f.Write( "#FREEZE:" );
|
||||
|
||||
@@ -25,7 +25,7 @@ static void Serialize(const TimingSegment &seg, Json::Value &root)
|
||||
static void Serialize(const TimingData &td, Json::Value &root)
|
||||
{
|
||||
JsonUtil::SerializeVectorPointers( td.allTimingSegments[SEGMENT_BPM], Serialize, root["BpmSegments"] );
|
||||
JsonUtil::SerializeVectorPointers( td.allTimingSegments[SEGMENT_STOP_DELAY], Serialize, root["StopSegments"] );
|
||||
JsonUtil::SerializeVectorPointers( td.allTimingSegments[SEGMENT_STOP], Serialize, root["StopSegments"] );
|
||||
}
|
||||
|
||||
static void Serialize(const LyricSegment &o, Json::Value &root)
|
||||
|
||||
@@ -96,18 +96,20 @@ static void WriteGlobalTags( RageFile &f, Song &out )
|
||||
int iRow = ws->GetRow();
|
||||
float fBPS = 60 / out.m_SongTiming.GetBPMAtRow(iRow);
|
||||
float fSkip = fBPS * ws->GetLength();
|
||||
out.m_SongTiming.AddSegment(SEGMENT_STOP_DELAY,
|
||||
new StopSegment(iRow, -fSkip, false) );
|
||||
out.m_SongTiming.AddSegment(SEGMENT_STOP,
|
||||
new StopSegment(iRow, -fSkip) );
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: make Delays into Stops that start one row before.
|
||||
|
||||
f.Write( "#STOPS:" );
|
||||
vector<TimingSegment *> &stops = timing.allTimingSegments[SEGMENT_STOP_DELAY];
|
||||
vector<TimingSegment *> &stops = timing.allTimingSegments[SEGMENT_STOP];
|
||||
for( unsigned i=0; i<stops.size(); i++ )
|
||||
{
|
||||
const StopSegment *fs = static_cast<StopSegment *>(stops[i]);
|
||||
float fBeat = fs->GetBeat();
|
||||
if (fs->GetDelay()) fBeat--;
|
||||
// if (fs->GetDelay()) fBeat--;
|
||||
|
||||
f.PutLine( ssprintf( "%.3f=%.3f", fBeat, fs->GetPause() ) );
|
||||
if( i != stops.size()-1 )
|
||||
|
||||
@@ -77,21 +77,20 @@ static void GetTimingTags( vector<RString> &lines, TimingData timing, bool bIsSo
|
||||
w.Finish();
|
||||
|
||||
w.Init( "STOPS" );
|
||||
vector<TimingSegment *> &stops = timing.allTimingSegments[SEGMENT_STOP_DELAY];
|
||||
vector<TimingSegment *> &stops = timing.allTimingSegments[SEGMENT_STOP];
|
||||
for (i = 0; i < stops.size(); i++)
|
||||
{
|
||||
StopSegment *ss = static_cast<StopSegment *>(stops[i]);
|
||||
if( !ss->GetDelay() )
|
||||
w.Write( ss->GetRow(), ss->GetPause() );
|
||||
w.Write( ss->GetRow(), ss->GetPause() );
|
||||
}
|
||||
w.Finish();
|
||||
|
||||
w.Init( "DELAYS" );
|
||||
for (i = 0; i < stops.size(); i++)
|
||||
vector<TimingSegment *> &delays = timing.allTimingSegments[SEGMENT_DELAY];
|
||||
for (i = 0; i < delays.size(); i++)
|
||||
{
|
||||
StopSegment *ss = static_cast<StopSegment *>(stops[i]);
|
||||
if( ss->GetDelay() )
|
||||
w.Write( ss->GetRow(), ss->GetPause() );
|
||||
DelaySegment *ss = static_cast<DelaySegment *>(delays[i]);
|
||||
w.Write( ss->GetRow(), ss->GetPause() );
|
||||
}
|
||||
w.Finish();
|
||||
|
||||
@@ -183,9 +182,9 @@ static void WriteTimingTags( RageFile &f, const TimingData &timing, bool bIsSong
|
||||
f.PutLine(ssprintf("#BPMS:%s;",
|
||||
join(",\r\n", timing.ToVectorString(SEGMENT_BPM)).c_str()));
|
||||
f.PutLine(ssprintf("#STOPS:%s;",
|
||||
join(",\r\n", timing.ToVectorString(SEGMENT_STOP_DELAY, false)).c_str()));
|
||||
join(",\r\n", timing.ToVectorString(SEGMENT_STOP)).c_str()));
|
||||
f.PutLine(ssprintf("#DELAYS:%s;",
|
||||
join(",\r\n", timing.ToVectorString(SEGMENT_STOP_DELAY, true)).c_str()));
|
||||
join(",\r\n", timing.ToVectorString(SEGMENT_DELAY)).c_str()));
|
||||
f.PutLine(ssprintf("#WARPS:%s;",
|
||||
join(",\r\n", timing.ToVectorString(SEGMENT_WARP)).c_str()));
|
||||
f.PutLine(ssprintf("#TIMESIGNATURES:%s;",
|
||||
|
||||
+3
-10
@@ -1364,20 +1364,13 @@ void TimingData::NoteRowToMeasureAndBeat( int iNoteRow, int &iMeasureIndexOut, i
|
||||
return;
|
||||
}
|
||||
|
||||
vector<RString> TimingData::ToVectorString(TimingSegmentType tst,
|
||||
bool isDelay, int dec) const
|
||||
vector<RString> TimingData::ToVectorString(TimingSegmentType tst, int dec) const
|
||||
{
|
||||
const vector<TimingSegment *> segs = this->allTimingSegments[tst];
|
||||
vector<RString> ret;
|
||||
|
||||
for (unsigned i = 0; i < segs.size(); i++)
|
||||
{
|
||||
if (tst == SEGMENT_STOP_DELAY)
|
||||
{
|
||||
StopSegment *seg = static_cast<StopSegment *>(segs[i]);
|
||||
if (seg->GetDelay() != isDelay)
|
||||
continue;
|
||||
}
|
||||
ret.push_back(segs[i]->ToString(dec));
|
||||
}
|
||||
return ret;
|
||||
@@ -1433,12 +1426,12 @@ public:
|
||||
}
|
||||
static int GetStops( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_STOP_DELAY, false), L);
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_STOP), L);
|
||||
return 1;
|
||||
}
|
||||
static int GetDelays( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_STOP_DELAY, true), L);
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_DELAY), L);
|
||||
return 1;
|
||||
}
|
||||
static int GetBPMs( T* p, lua_State *L )
|
||||
|
||||
+1
-1
@@ -830,7 +830,7 @@ public:
|
||||
*/
|
||||
float m_fBeat0OffsetInSeconds;
|
||||
|
||||
vector<RString> ToVectorString(TimingSegmentType tst, bool isDelay = false, int dec = 6) const;
|
||||
vector<RString> ToVectorString(TimingSegmentType tst, int dec = 6) const;
|
||||
};
|
||||
|
||||
#undef COMPARE
|
||||
|
||||
Reference in New Issue
Block a user