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