1
//=========================================================
4
// $Id: tempo.h,v 1.2 2004/01/11 18:55:34 wschweer Exp $
6
// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
7
//=========================================================
15
#define MAX_TICK (0x7fffffff/100)
20
//---------------------------------------------------------
22
//---------------------------------------------------------
26
unsigned tick; // new tempo at tick
27
unsigned frame; // precomputed time for tick in sec
30
void write(int, Xml&, int) const;
33
TEvent(unsigned t, unsigned tk) {
40
//---------------------------------------------------------
42
//---------------------------------------------------------
44
typedef std::map<unsigned, TEvent*, std::less<unsigned> > TEMPOLIST;
45
typedef TEMPOLIST::iterator iTEvent;
46
typedef TEMPOLIST::const_iterator ciTEvent;
47
typedef TEMPOLIST::reverse_iterator riTEvent;
48
typedef TEMPOLIST::const_reverse_iterator criTEvent;
50
class TempoList : public TEMPOLIST {
51
int _tempoSN; // serial no to track tempo changes
53
int _tempo; // tempo if not using tempo list
54
int _globalTempo; // %percent 50-200%
57
void add(unsigned tick, int tempo);
58
void change(unsigned tick, int newTempo);
60
void del(unsigned tick);
67
void write(int, Xml&) const;
70
int tempo(unsigned tick) const;
71
unsigned tick2frame(unsigned tick, unsigned frame, int* sn) const;
72
unsigned tick2frame(unsigned tick, int* sn = 0) const;
73
unsigned frame2tick(unsigned frame, int* sn = 0) const;
74
unsigned frame2tick(unsigned frame, unsigned tick, int* sn) const;
75
int tempoSN() const { return _tempoSN; }
76
void setTempo(unsigned tick, int newTempo);
77
void addTempo(unsigned t, int tempo);
78
void delTempo(unsigned tick);
79
void changeTempo(unsigned tick, int newTempo);
80
bool setMasterFlag(unsigned tick, bool val);
81
int globalTempo() const { return _globalTempo; }
82
void setGlobalTempo(int val);
85
extern TempoList tempomap;