annotate SequenceController.h @ 22:8124f46eda65

pretty much working. ugly though.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Thu, 23 Oct 2014 18:15:46 +0100
parents 5cf2b80909fc
children 055e0c43afe5
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@22 19 #define NUM_TEMPO_STEPS 8
rt300@14 20 #define NUM_PRESETS 8
rt300@10 21
rt300@22 22
rt300@14 23 class Step{
rt300@13 24 public:
rt300@22 25 typedef enum {COUNT_IN, PREVIEW_PREPARER, PREVIEW_DISPLAYER, MATCHING_PREPARER, MATCHING_INTERACTION, MATCHING_RESULT} stepTypes;
rt300@21 26
rt300@21 27 Step();
rt300@21 28
rt300@14 29 // gui display
rt300@14 30 bool showsTargetIcon;
rt300@14 31 bool showsControlSettings;
rt300@14 32 bool showsControlGuides;
rt300@14 33 bool showsMatchResults;
rt300@14 34 // gui input
rt300@14 35 bool allowsCandidateControl;
rt300@14 36 // sound
rt300@14 37 bool playsTarget;
rt300@14 38 bool playsCandidate;
rt300@14 39 // control flow
rt300@14 40 stepTypes type;
rt300@14 41 bool isPreview;
rt300@14 42
rt300@14 43 int seqNumber;
rt300@14 44 int runNumber;
rt300@14 45 bool isLastOfSeq;
rt300@14 46 bool isLastOfRun;
rt300@22 47 bool showsCountDown;
rt300@22 48 bool hidesSliders;
rt300@14 49 int tempo;
rt300@14 50 // preset info
rt300@14 51 int presetIndex;
rt300@14 52 int numInSequence;
rt300@14 53 bool isLastOfAll;
rt300@21 54
rt300@22 55 void setAsBlankCounter();
rt300@22 56 void setAsPreviewPreparer();
rt300@21 57 void setAsPreviewPlayer();
rt300@21 58 void setAsMatchingPreparer();
rt300@22 59 void setAsMatchingInteraction();
rt300@22 60 void setAsMatchingFeedback();
rt300@13 61
rt300@14 62 float getTimeBetweenTicks(){
rt300@14 63 return 1000. * (60.0/tempo);
rt300@14 64 }
rt300@13 65 };
rt300@13 66
rt300@10 67 class SequenceController{
rt300@10 68 public:
rt300@21 69 SequenceController();
rt300@21 70 Step getNextStep();
rt300@21 71 void setToStart();
rt300@21 72 void stepForward();
rt300@21 73 float getStartTickTime();
rt300@14 74 private:
rt300@21 75 void generateSteps();
rt300@21 76 void generateCountIn(int countInLength);
rt300@21 77 void generateARun(int run, int numInSequence);
rt300@14 78
rt300@14 79
rt300@21 80 int getRandomButNot(int max, vector<int> notThese);
rt300@21 81 protected:
rt300@14 82 vector<Step> steps;
rt300@14 83 vector<Step>::iterator currentStep;
rt300@13 84 float tempoInc;
rt300@8 85 };
rt300@8 86
rt300@14 87 #endif /* defined(__riftathon__SequenceGenerator__) */