-
Notifications
You must be signed in to change notification settings - Fork 0
/
StepSequencer.ino
46 lines (36 loc) · 1.21 KB
/
StepSequencer.ino
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
#include <Automaton.h>
#include <Atm_button.h>
class StepSequencer : public Machine {
public:
StepSequencer( void ) : Machine() { class_label = "STEPSEQ"; };
bool button_states[ NUM_STEPS ];
enum { PLAY_FWD, PLAY_REV, PLAY_RANDOM, STOP } STATES;
enum { STEP_CHANGE, ELSE } EVENTS;
enum { } ACTIONS;
enum { MSG_STEP_CHANGE } MESSAGES;
StepSequencer & begin(){
const static state_t state_table[] PROGMEM = {
/* ON_ENTER ON_LOOP ON_EXIT STEP_CHANGE ELSE */
/* PLAY_FWD */ -1, -1, -1, -1, -1,
/* PLAY_REV */ -1, -1, -1, -1, -1,
/* PLAY_RANDOM */ -1, -1, -1, -1, -1,
/* STOP */ -1, -1, -1, -1, -1,
};
Machine::begin( state_table, ELSE );
// init button states to off
for(int i=0; i<NUM_STEPS; i++){
button_states[i] = false;
}
return *this;
}
int event( int id ){
switch( id ){
case STEP_CHANGE:
return msgRead( MSG_STEP_CHANGE );
}
return 0;
}
int action( int id ){
return 0;
}
}