-
Notifications
You must be signed in to change notification settings - Fork 1
/
AutoInfo.h
100 lines (86 loc) · 2.16 KB
/
AutoInfo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Copyleft 2004 Chris Korda
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or any later version.
/*
chris korda
revision history:
rev date comments
00 12dec03 initial version
01 26sep04 HasSelection test was reversed
automation information package; atomic data only
*/
#ifndef CAUTOINFO_INCLUDED
#define CAUTOINFO_INCLUDED
class CAutoInfo {
public:
enum TRANSPORT {
STOP,
PAUSE,
PLAY,
UNSET,
TRANSPORT_STATES
};
enum WAVEFORM {
TRIANGLE,
RAMP_UP,
RAMP_DOWN,
SQUARE,
RANDOM,
WAVEFORMS
};
double m_Pos; // current position, from 0 to 1
float m_StartPos; // initial position, from 0 to 1, or -1 if no selection
float m_EndPos; // final position, from 0 to 1, or -1 if no selection
int m_Time; // automation time in milliseconds
BYTE m_TimeUnit; // 0 == seconds, 1 == minutes
BYTE m_Reverse; // 0 == forward, 1 == reverse
BYTE m_Transport; // 0 == stop, 1 == pause, 2 == play, 3 == unset
BYTE m_Loop; // non-zero to loop automation
BYTE m_Waveform; // see waveform enum above
CAutoInfo();
float GetStart() const;
float GetEnd() const;
float GetLength() const;
bool AtStart() const;
bool AtEnd() const;
bool HasSelection() const;
bool WithinSelection() const;
bool IsPlaying() const;
void Serialize(CArchive& ar, int Version);
void SetCourse();
void ClearSel();
};
inline float CAutoInfo::GetStart() const
{
return(m_StartPos >= 0 ? m_StartPos : 0);
}
inline float CAutoInfo::GetEnd() const
{
return(m_EndPos >= 0 ? m_EndPos : 1);
}
inline float CAutoInfo::GetLength() const
{
return(GetEnd() - GetStart());
}
inline bool CAutoInfo::AtStart() const
{
return(m_Pos <= GetStart());
}
inline bool CAutoInfo::AtEnd() const
{
return(m_Pos >= GetEnd());
}
inline bool CAutoInfo::HasSelection() const
{
return(!(m_EndPos == -1 && m_StartPos == -1));
}
inline bool CAutoInfo::WithinSelection() const
{
return(m_Pos >= m_StartPos && m_Pos <= m_EndPos);
}
inline bool CAutoInfo::IsPlaying() const
{
return(m_Transport == PLAY);
}
#endif