blob: feea799add44bf51a1ec8e8d0397f1bbe954d5ba (
plain) (
blame)
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
|
#include "precomp.h"
#include "sequence.h"
#define CBCLASS ItemSequencerI
START_DISPATCH;
CB(GETDEPENDENCYPTR, getDependencyPtr);
CB(GETNEXTPLAYITEM, getNextPlayItem);
CB(GETCURRENTPLAYBACKNUMBER, getCurrentPlaybackNumber);
CB(GETNUMITEMS, getNumItems);
CB(REWIND, rewind);
CB(FORWARD, forward);
CB(ONNOTIFY, onNotify);
END_DISPATCH;
#undef CBCLASS
int ItemSequencerI::onNotify(int msg, int param1, int param2) {
switch (msg) {
case SEQNOTIFY_ONREGISTER: return onRegister();
case SEQNOTIFY_ONDEREGISTER: return onDeregister();
case SEQNOTIFY_ONNEXTFILE: return onNextFile();
case SEQNOTIFY_ONTITLECHANGE: return onTitleChange();
case SEQNOTIFY_ONSTARTED: return onStarted();
case SEQNOTIFY_ONSTOPPED: return onStopped();
case SEQNOTIFY_ONPAUSED: return onPaused();
case SEQNOTIFY_ONUNPAUSED: return onUnpaused();
}
return 0;
}
const char *ListSequencer::getNextPlayItem() {
int pos;
const char *ret;
pos = getCurrent();
if (pos < 0) return NULL;
ret = enumItem(pos);
setCurrent(pos);
return ret;
}
int ListSequencer::rewind() {
int pos;
pos = getCurrent();
if (pos < 0) return 0;
pos--;
if (pos < 0) {
if (loop()) {
pos = getNumEntries()-1;
} else {
pos++;
}
}
setCurrent(pos);
return 1;
}
int ListSequencer::forward() {
int pos;
pos = getCurrent();
if (pos < 0) return 0;
pos++;
if (pos >= getNumEntries()) {
if (loop()) {
pos = 0;
} else {
return 0;
}
}
setCurrent(pos);
return 1;
}
int ListSequencer::getNumItems() {
return getNumEntries();
}
|