annotate SequenceController.h @ 27:27cdf475aa4b

more fiddling
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 29 Oct 2014 15:38:38 +0000
parents 055e0c43afe5
children 953db6518738
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@8 14
rt300@22 15 #define MIN_TARGETS_IN_SEQUENCE 1
rt300@14 16 #define MAX_TARGETS_IN_SEQUENCE 5
rt300@22 17 #define MIN_TEMPO 60
rt300@22 18 #define MAX_TEMPO 120
rt300@23 19 #define NUM_TEMPO_STEPS 16
rt300@14 20 #define NUM_PRESETS 8
rt300@27 21 #define NO_GUIDES_LEVEL false
rt300@27 22 class AnimStep{
rt300@10 23
rt300@27 24
rt300@27 25 public:
rt300@27 26
rt300@27 27 AnimStep();
rt300@27 28 typedef enum {PREVIEW_NEUTRAL_COUNT,
rt300@27 29 MATCHING_NEUTRAL_COUNT,
rt300@27 30 PREVIEW_MOVE,
rt300@27 31 PREVIEW_HIT,
rt300@27 32 MATCHING_MOVE,
rt300@27 33 MATCHING_HIT}
rt300@27 34 stepType;
rt300@27 35
rt300@27 36 stepType type;
rt300@27 37
rt300@27 38 float getTimeBetweenTicks(){
rt300@27 39 return 1000. * (60.0/tempo);
rt300@27 40 }
rt300@27 41 int presetIndex;
rt300@27 42 int whichInSequence;
rt300@27 43 bool isLastOfAll;
rt300@27 44
rt300@27 45 int tempo;
rt300@27 46 int seqNumber;
rt300@27 47 int runNumber;
rt300@27 48 bool isLastOfSeq;
rt300@27 49 bool isLastOfRun;
rt300@27 50
rt300@27 51 bool showsGuides; // depends on 'level'
rt300@27 52
rt300@27 53 vector<int> thisSequence; // so that we can show the whole sequence at the top?
rt300@27 54 };
rt300@22 55
rt300@14 56 class Step{
rt300@13 57 public:
rt300@22 58 typedef enum {COUNT_IN, PREVIEW_PREPARER, PREVIEW_DISPLAYER, MATCHING_PREPARER, MATCHING_INTERACTION, MATCHING_RESULT} stepTypes;
rt300@21 59
rt300@21 60 Step();
rt300@21 61
rt300@14 62 // gui display
rt300@14 63 bool showsTargetIcon;
rt300@14 64 bool showsControlSettings;
rt300@14 65 bool showsControlGuides;
rt300@14 66 bool showsMatchResults;
rt300@14 67 // gui input
rt300@14 68 bool allowsCandidateControl;
rt300@14 69 // sound
rt300@14 70 bool playsTarget;
rt300@14 71 bool playsCandidate;
rt300@14 72 // control flow
rt300@14 73 stepTypes type;
rt300@14 74 bool isPreview;
rt300@14 75
rt300@14 76 int seqNumber;
rt300@14 77 int runNumber;
rt300@14 78 bool isLastOfSeq;
rt300@14 79 bool isLastOfRun;
rt300@22 80 bool showsCountDown;
rt300@22 81 bool hidesSliders;
rt300@14 82 int tempo;
rt300@14 83 // preset info
rt300@14 84 int presetIndex;
rt300@14 85 int numInSequence;
rt300@14 86 bool isLastOfAll;
rt300@21 87
rt300@22 88 void setAsBlankCounter();
rt300@22 89 void setAsPreviewPreparer();
rt300@21 90 void setAsPreviewPlayer();
rt300@21 91 void setAsMatchingPreparer();
rt300@22 92 void setAsMatchingInteraction();
rt300@22 93 void setAsMatchingFeedback();
rt300@13 94
rt300@14 95 float getTimeBetweenTicks(){
rt300@14 96 return 1000. * (60.0/tempo);
rt300@14 97 }
rt300@13 98 };
rt300@13 99
rt300@10 100 class SequenceController{
rt300@10 101 public:
rt300@21 102 SequenceController();
rt300@27 103 AnimStep getNextStep();
rt300@21 104 void setToStart();
rt300@21 105 void stepForward();
rt300@21 106 float getStartTickTime();
rt300@14 107 private:
rt300@21 108 void generateSteps();
rt300@21 109 void generateCountIn(int countInLength);
rt300@21 110 void generateARun(int run, int numInSequence);
rt300@27 111 vector<int> randomSequence(int numInSequence);
rt300@14 112
rt300@21 113 int getRandomButNot(int max, vector<int> notThese);
rt300@21 114 protected:
rt300@27 115 vector<AnimStep> steps;
rt300@27 116 vector<AnimStep>::iterator currentStep;
rt300@13 117 float tempoInc;
rt300@8 118 };
rt300@8 119
rt300@14 120 #endif /* defined(__riftathon__SequenceGenerator__) */