1
//=========================================================
4
// $Id: tempo.h,v 1.2 2001/11/20 15:19:32 muse Exp $
6
// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
7
//=========================================================
15
#define MAX_TICK (0x7fffffff/100)
20
//---------------------------------------------------------
22
//---------------------------------------------------------
26
int tick; // new tempo at tick
27
double time; // precomputed time for tick in sec
30
void write(int, Xml&, int) const;
33
TEvent(int t, int tk) {
40
//---------------------------------------------------------
42
//---------------------------------------------------------
44
typedef std::map<int, TEvent*, std::less<int> >::iterator iTEvent;
45
typedef std::map<int, TEvent*, std::less<int> >::const_iterator ciTEvent;
46
typedef std::map<int, TEvent*, std::less<int> >::reverse_iterator riTEvent;
47
typedef std::map<int, TEvent*, std::less<int> >::const_reverse_iterator criTEvent;
49
class TempoList : public std::map<int, TEvent*, std::less<int> > {
50
int _tempoSN; // serial no to track tempo changes
52
int _tempo; // tempo if not using tempo list
55
void add(int tick, int tempo);
56
void change(int tick, int newTempo);
65
void write(int, Xml&) const;
68
int tempo(int tick) const;
69
double tick2time(int tick, int* sn = 0) const;
70
double tick2timeLC(int tick, int* sn) const;
71
double tick2time(int tick, double time, int* sn) const;
72
int time2tick(double time, int* sn = 0) const;
73
int time2tick(double time, int tick, int* sn) const;
74
int tempoSN() const { return _tempoSN; }
75
void setTempo(int tick, int newTempo);
76
void addTempo(int t, int tempo);
77
void delTempo(int tick);
78
void changeTempo(int tick, int newTempo);
79
bool setMasterFlag(int tick, bool val);
81
int tick2samples(int tick);
82
int samples2tick(int samples);
85
extern TempoList tempomap;