Mercurial > hg > tweakathon2ios
view SequenceController.h @ 30:78b51f924ec1
twiddles
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Tue, 04 Nov 2014 14:37:35 +0000 |
parents | e7af34b1af83 |
children | a677c027e3a0 |
line wrap: on
line source
// // SequenceGenerator.h // riftathon // // Created by Robert Tubb on 21/10/2014. // // #ifndef __riftathon__SequenceGenerator__ #define __riftathon__SequenceGenerator__ #include <iostream> #include "ofMain.h" #define MIN_TARGETS_IN_SEQUENCE 1 #define MAX_TARGETS_IN_SEQUENCE 5 #define MIN_TEMPO 60 #define MAX_TEMPO 300 #define NUM_TEMPO_STEPS 12 #define NUM_PRESETS 8 #define SPACER_BARS true #define NO_GUIDES_LEVEL true class AnimStep{ public: AnimStep(); typedef enum {PREVIEW_NEUTRAL_COUNT, MATCHING_NEUTRAL_COUNT, PREVIEW_MOVE, PREVIEW_HIT, MATCHING_MOVE, MATCHING_HIT} stepType; stepType type; float getTimeBetweenTicks(){ return 1000* (60.0/tempo); } int presetIndex; int whichInSequence; bool isLastOfAll; int tempo; int seqNumber; int runNumber; bool isLastOfSeq; bool isLastOfRun; bool showsGuides; // depends on 'level' vector<int> thisSequence; // so that we can show the whole sequence at the top? }; class Step{ public: typedef enum {COUNT_IN, PREVIEW_PREPARER, PREVIEW_DISPLAYER, MATCHING_PREPARER, MATCHING_INTERACTION, MATCHING_RESULT} stepTypes; Step(); // gui display bool showsTargetIcon; bool showsControlSettings; bool showsControlGuides; bool showsMatchResults; // gui input bool allowsCandidateControl; // sound bool playsTarget; bool playsCandidate; // control flow stepTypes type; bool isPreview; int seqNumber; int runNumber; bool isLastOfSeq; bool isLastOfRun; bool showsCountDown; bool hidesSliders; int tempo; // preset info int presetIndex; int numInSequence; bool isLastOfAll; void setAsBlankCounter(); void setAsPreviewPreparer(); void setAsPreviewPlayer(); void setAsMatchingPreparer(); void setAsMatchingInteraction(); void setAsMatchingFeedback(); float getTimeBetweenTicks(){ return 1000. * (60.0/tempo); } }; class SequenceController{ public: SequenceController(); AnimStep getNextStep(); void setToStart(); void stepForward(); float getStartTickTime(); private: void generateSteps(); void generateCountIn(int countInLength); void generateARun(int run, int numInSequence); vector<int> randomSequence(int numInSequence); int getRandomButNot(int max, vector<int> notThese); protected: vector<AnimStep> steps; vector<AnimStep>::iterator currentStep; float tempoInc; }; #endif /* defined(__riftathon__SequenceGenerator__) */