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
|
/*
* Copyright © 2012 Matt Pharoah (mr.exuberant@gmail.com)
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ACTIONS_H_
#define ACTIONS_H_
enum Action {
A_NOOP,
A_PLAY,
A_REWIND,
A_FAST_FORWARD,
A_SLOW_TOGGLE,
A_SLOW_PLAY,
A_BACK1,
A_BACK5,
A_BACK10
};
extern const short NUM_ACTIONS = 9;
Action ACTION_NUM(int num) {
switch (num) {
case 0: return A_NOOP;
case 1: return A_PLAY;
case 2: return A_REWIND;
case 3: return A_FAST_FORWARD;
case 4: return A_SLOW_TOGGLE;
case 5: return A_SLOW_PLAY;
case 6: return A_BACK1;
case 7: return A_BACK5;
case 8: return A_BACK10;
default: return A_NOOP;
}
}
const char *ACTION_STRING(Action a) {
switch (a) {
case A_NOOP: return "(nothing)";
case A_PLAY: return "PLAY";
case A_REWIND: return "REWIND";
case A_FAST_FORWARD: return "FAST FORWARD";
case A_SLOW_TOGGLE: return "SLOW (TOGGLE)";
case A_SLOW_PLAY: return "SLOW (HOLD)";
case A_BACK1: return "BACK 1 SECS";
case A_BACK5: return "BACK 5 SECS";
case A_BACK10: return "BACK 10 SECS";
default: return "(error)";
}
}
#endif /* ACTIONS_H_ */
|