00001
00002
00003
#ifndef TIMING_DATA_H
00004
#define TIMING_DATA_H
00005
00006
#include "NoteTypes.h"
00007
00008 struct BPMSegment
00009 {
00010 BPMSegment() {
m_iStartIndex = -1;
m_fBPS = -1; }
00011 BPMSegment(
int s,
float b ) {
m_iStartIndex = s;
m_fBPS = b/60.0f; }
00012 int m_iStartIndex;
00013 float m_fBPS;
00014
00015
void SetBPM(
float f );
00016
float GetBPM() const;
00017 };
00018
00019 struct
StopSegment
00020 {
00021 StopSegment() { m_fStopSeconds = -1; m_iStartRow = -1; }
00022 StopSegment(
int s,
float f ) { m_iStartRow = s; m_fStopSeconds =
f; }
00023 int m_iStartRow;
00024 float m_fStopSeconds;
00025 };
00026
00027 class TimingData
00028 {
00029
public:
00030
TimingData();
00031
00032
void GetActualBPM(
float &fMinBPMOut,
float &fMaxBPMOut )
const;
00033
float GetBPMAtBeat(
float fBeat )
const;
00034
void SetBPMAtBeat(
float fBeat,
float fBPM );
00035
void SetStopAtBeat(
float fBeat,
float fSeconds );
00036
void MultiplyBPMInBeatRange(
int iStartIndex,
int iEndIndex,
float fFactor );
00037
void AddBPMSegment(
const BPMSegment &seg );
00038
void AddStopSegment(
const StopSegment &seg );
00039
BPMSegment& GetBPMSegmentAtBeat(
float fBeat );
00040
00041
void GetBeatAndBPSFromElapsedTime(
float fElapsedTime,
float &fBeatOut,
float &fBPSOut,
bool &bFreezeOut )
const;
00042 float GetBeatFromElapsedTime(
float fElapsedTime )
const
00043 {
00044
float fBeat, fThrowAway;
00045
bool bThrowAway;
00046 GetBeatAndBPSFromElapsedTime( fElapsedTime, fBeat, fThrowAway, bThrowAway );
00047
return fBeat;
00048 }
00049
float GetElapsedTimeFromBeat(
float fBeat )
const;
00050
bool HasBpmChangesOrStops() const;
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
void ScaleRegion(
float fScale = 1,
int iStartRow = 0,
int iEndRow = MAX_NOTE_ROW );
00063
void ShiftRows(
int iStartRow,
int iRowsToShift );
00064
00065 CString m_sFile;
00066 vector<
BPMSegment> m_BPMSegments;
00067 vector<
StopSegment> m_StopSegments;
00068 float m_fBeat0OffsetInSeconds;
00069 };
00070
00071 #endif
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096