Mercurial > hg > tweakathon2ios
view TrainingMessageOrganiser.h @ 9:d5e928887f51
More refactoring.
Mode for Synth value changes only sent to PD on triggering sound.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Fri, 17 Oct 2014 17:50:41 +0100 |
parents | d59de9fd3496 |
children | e25d2b1b185e |
line wrap: on
line source
// // TrainingMessageOrganiser.h // riftathon // // Created by Robert Tubb on 17/10/2014. // // #ifndef __riftathon__TrainingMessageOrganiser__ #define __riftathon__TrainingMessageOrganiser__ #include <iostream> #include "trainingTestController.h" #include "MessageOrganiser.h" class TrainingMessageOrganiser : public MessageOrganiser { public: void init( PDSynthWrapper& cs, PDSynthWrapper& ts){ trainingTestController = new TrainingTestController; MessageOrganiser::init(cs,ts); } void setupDefaultMapping(){ vector<int> mappingIDsForChangeableParams = getMappingIDsFromSynths(); controlPanelType cpt = REVISITABLE; vector<controllerType> elemList; for(int i = 0; i < 8; i++){ elemList.push_back(SLIDER); } vector<UIElement*> UIElemHandles = panel->generateControls(elemList, cpt); mapSlidersToParams(UIElemHandles, mappingIDsForChangeableParams); bottomPanel->show(); } vector<int> getMappingIDsFromSynths(){ vector<int> index; for(int i = 0; i < 8; i++){ index.push_back(i); } vector<int> mids = candidateSynth.getMappingIDForIndices(index); return mids; } void setupNewTest(){ }; protected: void mapSlidersToParams(vector<UIElement*> elems, vector<int> mids){ vector<UIElement*>::iterator elit; vector<int> typeListLog; int i = 0; for(elit=elems.begin(); elit<elems.end();elit++){ if ( (*elit)->getType() == SLIDER){ if(i >= mids.size()){ cout << "ERROR ERROR: too many controls for mapping IDs: " << mids.size() << endl; } ButtronSlider* theSlider = (ButtronSlider*)(*elit); mapControlToParam((*elit), mids[i]); theSlider->setValueAndScale(candidateSynth.getParamValueForID(mids[i])); cout << "Hint Value " << targetSynth.getParamValueFromName(candidateSynth.getNameForMappingID(mids[i])) << endl; theSlider->setHintValue(targetSynth.getParamValueFromName(candidateSynth.getNameForMappingID(mids[i]))); i++; typeListLog.push_back(int(SLIDER)); }else{ cout << "ERROR ERROR: ui type not handled my mapping function !" << endl; } } eventLogger.logEvent(CONTROL_LIST,typeListLog); }; void buttonPressCallback(int mappingID, int value){ if(mappingID == VOLUME_CHANGE_ID){ targetSynth.sendVolume(value); candidateSynth.sendVolume(value); } if (mappingID == TRIGGER_CANDIDATE_ID){ triggerCandidateSound(); return; } } TrainingTestController* trainingTestController; }; #endif /* defined(__riftathon__TrainingMessageOrganiser__) */