55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
#ifndef TIMING_DATA_H
|
|
#define TIMING_DATA_H
|
|
|
|
struct BPMSegment
|
|
{
|
|
BPMSegment() { m_fStartBeat = m_fBPM = -1; };
|
|
BPMSegment( float s, float b ) { m_fStartBeat = s; m_fBPM = b; };
|
|
float m_fStartBeat;
|
|
float m_fBPM;
|
|
};
|
|
|
|
struct StopSegment
|
|
{
|
|
StopSegment() { m_fStartBeat = m_fStopSeconds = -1; };
|
|
StopSegment( float s, float f ) { m_fStartBeat = s; m_fStopSeconds = f; };
|
|
float m_fStartBeat;
|
|
float m_fStopSeconds;
|
|
};
|
|
|
|
class TimingData
|
|
{
|
|
public:
|
|
TimingData();
|
|
|
|
void GetActualBPM( float &fMinBPMOut, float &fMaxBPMOut ) const;
|
|
float GetBPMAtBeat( float fBeat ) const;
|
|
void SetBPMAtBeat( float fBeat, float fBPM );
|
|
void AddBPMSegment( const BPMSegment &seg );
|
|
void AddStopSegment( const StopSegment &seg );
|
|
BPMSegment& GetBPMSegmentAtBeat( float fBeat );
|
|
|
|
void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut ) const;
|
|
float GetBeatFromElapsedTime( float fElapsedTime ) const // shortcut for places that care only about the beat
|
|
{
|
|
float fBeat, fThrowAway;
|
|
bool bThrowAway;
|
|
GetBeatAndBPSFromElapsedTime( fElapsedTime, fBeat, fThrowAway, bThrowAway );
|
|
return fBeat;
|
|
}
|
|
float GetElapsedTimeFromBeat( float fBeat ) const;
|
|
|
|
CString m_sFile; // informational only
|
|
vector<BPMSegment> m_BPMSegments; // this must be sorted before gameplay
|
|
vector<StopSegment> m_StopSegments; // this must be sorted before gameplay
|
|
float m_fBeat0OffsetInSeconds;
|
|
};
|
|
|
|
#endif
|
|
|
|
/*
|
|
* Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved.
|
|
* Chris Danford
|
|
* Glenn Maynard
|
|
*/
|