Mercurial > hg > tweakathon2ios
view SequenceController.h @ 12:af71bf84660f
icon stuff. not working/tested.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Mon, 20 Oct 2014 14:12:23 +0100 |
parents | e25d2b1b185e |
children | ab3e0e980c82 |
line wrap: on
line source
// // SequenceController.h // riftathon // // Created by Robert Tubb on 17/10/2014. // // #ifndef __riftathon__SequenceController__ #define __riftathon__SequenceController__ #include <iostream> #include "presetManager.h" #define MAX_TARGETS_IN_SEQUENCE 8 #define MIN_TEMPO 80 #define MAX_TEMPO 200 #define NUM_TEMPO_STEPS 8 #define NUM_PRESETS 16 class Sequence{ int tempo; vector<Preset *> presetSequence; }; class SequenceController{ public: SequenceController(){ makeSequences(); }; SequenceController(const vector<Preset>& presets) : thePresets(presets) { makeSequences(); }; Sequence getNextSequence(); int getNextPresetIndex(){ // if end of sequence return something else so we can do something // if end of tempo ramp return something else uint randomInt = rand() % 8; return randomInt; }; protected: void makeSequences(){ for(int numInSequence = 1; numInSequence < MAX_TARGETS_IN_SEQUENCE; numInSequence++){ for(int tempoLevel = 0; tempoLevel < NUM_TEMPO_STEPS; tempoLevel++){ vector<int> indexSequence; // repeat the same tests for xtra practice? for(int n=0; n < numInSequence; n++){ int next = getRandomButNot(NUM_PRESETS,indexSequence); indexSequence.push_back(next); cout << next << ","; } cout << endl; } cout << "---" << endl; } }; int getRandomButNot(int max, vector<int> notThese){ bool there = true; uint randomInt = rand() % max; if (notThese.size()){ while(there){ randomInt = rand() % max; vector<int>::iterator result = std::find(notThese.begin(), notThese.end(), randomInt); there = (result != notThese.end()); } } return randomInt; }; private: const vector<Preset> thePresets; vector<Sequence> theSequences; }; #endif /* defined(__riftathon__SequenceController__) */