annotate SequenceController.h @ 52:89944ab3e129 tip

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