rt300@8
|
1 //
|
rt300@14
|
2 // SequenceGenerator.h
|
rt300@8
|
3 // riftathon
|
rt300@8
|
4 //
|
rt300@14
|
5 // Created by Robert Tubb on 21/10/2014.
|
rt300@8
|
6 //
|
rt300@8
|
7 //
|
rt300@8
|
8
|
rt300@14
|
9 #ifndef __riftathon__SequenceGenerator__
|
rt300@14
|
10 #define __riftathon__SequenceGenerator__
|
rt300@8
|
11
|
rt300@8
|
12 #include <iostream>
|
rt300@14
|
13 #include "ofMain.h"
|
rt300@31
|
14 #include "presetManager.h"
|
rt300@31
|
15 #include "TrainingScoreManager.h"
|
rt300@36
|
16
|
rt300@33
|
17 #define MIN_TARGETS_IN_SEQUENCE 1
|
rt300@36
|
18 #define NUM_REPETITIONS_AT_LEVEL 2
|
rt300@34
|
19 #define MAX_TARGETS_IN_SEQUENCE 7
|
rt300@36
|
20 #define MIN_TEMPO 70
|
rt300@36
|
21 #define MAX_TEMPO 480
|
rt300@36
|
22 #define TEMPO_RANDOM_AMOUNT
|
rt300@36
|
23 #define MAX_TIME 2800
|
rt300@36
|
24 #define MIN_TIME 200
|
rt300@36
|
25 #define NUM_TEMPO_STEPS 17
|
rt300@36
|
26
|
rt300@14
|
27 #define NUM_PRESETS 8
|
rt300@31
|
28 #define SPACER_BARS false
|
rt300@31
|
29 #define NO_GUIDES_LEVEL false
|
rt300@36
|
30
|
rt300@27
|
31 class AnimStep{
|
rt300@10
|
32
|
rt300@27
|
33
|
rt300@27
|
34 public:
|
rt300@27
|
35
|
rt300@27
|
36 AnimStep();
|
rt300@27
|
37 typedef enum {PREVIEW_NEUTRAL_COUNT,
|
rt300@27
|
38 MATCHING_NEUTRAL_COUNT,
|
rt300@27
|
39 PREVIEW_MOVE,
|
rt300@35
|
40 PREVIEW_LAST,
|
rt300@31
|
41 GUIDED_MOVE,
|
rt300@31
|
42 GUIDED_HIT,
|
rt300@27
|
43 MATCHING_MOVE,
|
rt300@35
|
44 MATCHING_LAST}
|
rt300@27
|
45 stepType;
|
rt300@27
|
46
|
rt300@27
|
47 stepType type;
|
rt300@36
|
48 int getTimeAllowed(){
|
rt300@36
|
49 return timeAllowedMs;
|
rt300@36
|
50 }
|
rt300@27
|
51 float getTimeBetweenTicks(){
|
rt300@36
|
52 //return 1000* (60.0/tempo);
|
rt300@36
|
53 return timeAllowedMs/4.0;
|
rt300@36
|
54 }
|
rt300@36
|
55
|
rt300@36
|
56 void setTempoFromTime(){
|
rt300@36
|
57 tempo = 60.0 / (4* timeAllowedMs*1000.0);
|
rt300@36
|
58 }
|
rt300@36
|
59 void setTimeFromTempo(){
|
rt300@36
|
60 timeAllowedMs = 4*1000* (60.0/tempo);
|
rt300@27
|
61 }
|
rt300@27
|
62 int presetIndex;
|
rt300@31
|
63 Preset * currentTargetPreset;
|
rt300@31
|
64 Preset * nextTargetPreset;
|
rt300@27
|
65 int whichInSequence;
|
rt300@27
|
66 bool isLastOfAll;
|
rt300@27
|
67
|
rt300@27
|
68 int tempo;
|
rt300@36
|
69 int tempoLevel;
|
rt300@36
|
70 int timeAllowedMs;
|
rt300@27
|
71 int seqNumber;
|
rt300@27
|
72 int runNumber;
|
rt300@35
|
73 int difficulty;
|
rt300@27
|
74 bool isLastOfSeq;
|
rt300@27
|
75 bool isLastOfRun;
|
rt300@27
|
76
|
rt300@27
|
77 bool showsGuides; // depends on 'level'
|
rt300@31
|
78 bool showsIcons;
|
rt300@31
|
79 bool showsResultsAtEnd;
|
rt300@27
|
80
|
rt300@27
|
81 vector<int> thisSequence; // so that we can show the whole sequence at the top?
|
rt300@31
|
82
|
rt300@31
|
83 TrainingTestResult result; // only applies to steps that were scored.
|
rt300@31
|
84
|
rt300@31
|
85
|
rt300@31
|
86 void saveResult(TrainingTestResult result);
|
rt300@27
|
87 };
|
rt300@22
|
88
|
rt300@31
|
89 // NOT USED
|
rt300@14
|
90 class Step{
|
rt300@13
|
91 public:
|
rt300@22
|
92 typedef enum {COUNT_IN, PREVIEW_PREPARER, PREVIEW_DISPLAYER, MATCHING_PREPARER, MATCHING_INTERACTION, MATCHING_RESULT} stepTypes;
|
rt300@21
|
93
|
rt300@21
|
94 Step();
|
rt300@21
|
95
|
rt300@14
|
96 // gui display
|
rt300@14
|
97 bool showsTargetIcon;
|
rt300@14
|
98 bool showsControlSettings;
|
rt300@14
|
99 bool showsControlGuides;
|
rt300@14
|
100 bool showsMatchResults;
|
rt300@14
|
101 // gui input
|
rt300@14
|
102 bool allowsCandidateControl;
|
rt300@14
|
103 // sound
|
rt300@14
|
104 bool playsTarget;
|
rt300@14
|
105 bool playsCandidate;
|
rt300@14
|
106 // control flow
|
rt300@14
|
107 stepTypes type;
|
rt300@14
|
108 bool isPreview;
|
rt300@14
|
109
|
rt300@14
|
110 int seqNumber;
|
rt300@14
|
111 int runNumber;
|
rt300@14
|
112 bool isLastOfSeq;
|
rt300@14
|
113 bool isLastOfRun;
|
rt300@22
|
114 bool showsCountDown;
|
rt300@22
|
115 bool hidesSliders;
|
rt300@14
|
116 int tempo;
|
rt300@14
|
117 // preset info
|
rt300@14
|
118 int presetIndex;
|
rt300@14
|
119 int numInSequence;
|
rt300@14
|
120 bool isLastOfAll;
|
rt300@21
|
121
|
rt300@22
|
122 void setAsBlankCounter();
|
rt300@22
|
123 void setAsPreviewPreparer();
|
rt300@21
|
124 void setAsPreviewPlayer();
|
rt300@21
|
125 void setAsMatchingPreparer();
|
rt300@22
|
126 void setAsMatchingInteraction();
|
rt300@22
|
127 void setAsMatchingFeedback();
|
rt300@31
|
128
|
rt300@13
|
129 };
|
rt300@13
|
130
|
rt300@10
|
131 class SequenceController{
|
rt300@10
|
132 public:
|
rt300@21
|
133 SequenceController();
|
rt300@32
|
134 void init(bool asoundOnlyMode);
|
rt300@27
|
135 AnimStep getNextStep();
|
rt300@21
|
136 void setToStart();
|
rt300@21
|
137 void stepForward();
|
rt300@21
|
138 float getStartTickTime();
|
rt300@31
|
139 void saveResultForCurrentStep(TrainingTestResult result);
|
rt300@31
|
140 TrainingTestResult getResultForPreviousStep();
|
rt300@32
|
141 int getTotNumRuns(){return totNumRuns;};
|
rt300@14
|
142 private:
|
rt300@21
|
143 void generateSteps();
|
rt300@21
|
144 void generateCountIn(int countInLength);
|
rt300@21
|
145 void generateARun(int run, int numInSequence);
|
rt300@34
|
146 void generateAnEasyRun(int run, int numInSequence = 1);
|
rt300@32
|
147 void generateASoundOnlyRun(int run, int numInSequence);
|
rt300@27
|
148 vector<int> randomSequence(int numInSequence);
|
rt300@32
|
149 vector<int> nonRandomSequence(int numInSequence);
|
rt300@21
|
150 int getRandomButNot(int max, vector<int> notThese);
|
rt300@21
|
151 protected:
|
rt300@27
|
152 vector<AnimStep> steps;
|
rt300@27
|
153 vector<AnimStep>::iterator currentStep;
|
rt300@13
|
154 float tempoInc;
|
rt300@36
|
155 int timeInc;
|
rt300@32
|
156 bool soundOnlyMode;
|
rt300@32
|
157 int totNumRuns;
|
rt300@8
|
158 };
|
rt300@8
|
159
|
rt300@14
|
160 #endif /* defined(__riftathon__SequenceGenerator__) */
|