annotate SequenceController.h @ 21:5cf2b80909fc

Hints and sliders show ok for training sequences.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 22 Oct 2014 18:12:12 +0100
parents f83635861187
children 8124f46eda65
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@14 15 #define MIN_TARGETS_IN_SEQUENCE 3
rt300@14 16 #define MAX_TARGETS_IN_SEQUENCE 5
rt300@21 17 #define MIN_TEMPO 120
rt300@21 18 #define MAX_TEMPO 250
rt300@14 19 #define NUM_TEMPO_STEPS 16
rt300@14 20 #define NUM_PRESETS 8
rt300@10 21
rt300@14 22 class Step{
rt300@13 23 public:
rt300@14 24 typedef enum {COUNT_IN, PREVIEW_DISPLAY, PREVIEW_PLAY, MATCHING_INTERACTION, MATCHING_RESULT} stepTypes;
rt300@21 25
rt300@21 26 Step();
rt300@21 27
rt300@14 28 // gui display
rt300@14 29 bool showsTargetIcon;
rt300@14 30 bool showsControlSettings;
rt300@14 31 bool showsControlGuides;
rt300@14 32 bool showsMatchResults;
rt300@14 33 // gui input
rt300@14 34 bool allowsCandidateControl;
rt300@14 35 // sound
rt300@14 36 bool playsTarget;
rt300@14 37 bool playsCandidate;
rt300@14 38 // control flow
rt300@14 39 stepTypes type;
rt300@14 40 bool isPreview;
rt300@14 41
rt300@14 42 int seqNumber;
rt300@14 43 int runNumber;
rt300@14 44 bool isLastOfSeq;
rt300@14 45 bool isLastOfRun;
rt300@14 46 bool playsMetroClick;
rt300@14 47 int tempo;
rt300@14 48 // preset info
rt300@14 49 int presetIndex;
rt300@14 50 int numInSequence;
rt300@14 51 bool isLastOfAll;
rt300@21 52
rt300@21 53 void setAsPreviewShower();
rt300@21 54 void setAsPreviewPlayer();
rt300@21 55 void setAsMatchingPreparer();
rt300@21 56 void setAsMatchingReckoner();
rt300@13 57
rt300@14 58 float getTimeBetweenTicks(){
rt300@14 59 return 1000. * (60.0/tempo);
rt300@14 60 }
rt300@13 61 };
rt300@13 62
rt300@10 63 class SequenceController{
rt300@10 64 public:
rt300@21 65 SequenceController();
rt300@21 66 Step getNextStep();
rt300@21 67 void setToStart();
rt300@21 68 void stepForward();
rt300@21 69 float getStartTickTime();
rt300@14 70 private:
rt300@21 71 void generateSteps();
rt300@21 72 void generateCountIn(int countInLength);
rt300@21 73 void generateARun(int run, int numInSequence);
rt300@14 74
rt300@14 75
rt300@21 76 int getRandomButNot(int max, vector<int> notThese);
rt300@21 77 protected:
rt300@14 78 vector<Step> steps;
rt300@14 79 vector<Step>::iterator currentStep;
rt300@13 80 float tempoInc;
rt300@8 81 };
rt300@8 82
rt300@14 83 #endif /* defined(__riftathon__SequenceGenerator__) */