Mercurial > hg > tweakathon2ios
view ExpMessageOrganiser.mm @ 18:36cdb73691da
PIMPL speed compile?
eventlogger now just saves as it goes
more refactoring
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Wed, 22 Oct 2014 15:00:14 +0100 |
parents | 2a7320a8cbed |
children | bd23c1b922be |
line wrap: on
line source
// // expMessageOrganiser.cpp // riftathon // // Created by Robert Tubb on 21/10/2014. // // #include "ExpMessageOrganiser.h" void ExpMessageOrganiser::init( PDSynthWrapper& cs, PDSynthWrapper& ts){ numParamsToUse = TOTAL_NUM_PARAMS; MessageOrganiser::init(cs,ts); } void ExpMessageOrganiser::setup(){ // do stuff like load first slot setupDefaultMapping(); expPresetManager.goToFirstEmptySlot(); showCurrentSlot(); } void ExpMessageOrganiser::setupDefaultMapping(){ vector<int> mappingIDsForChangeableParams = getMappingIDsFromSynths(); controlPanelType cpt = REVISITABLE; vector<controllerType> elemList; for(int i = 0; i < numParamsToUse; i++){ elemList.push_back(SLIDER); } vector<UIElement*> UIElemHandles = panel->generateControls(elemList, cpt); mapSlidersToParams(UIElemHandles, mappingIDsForChangeableParams); bottomPanel->show(); } vector<int> ExpMessageOrganiser::getMappingIDsFromSynths(){ vector<int> index; for(int i = 0; i < numParamsToUse; i++){ index.push_back(i); } vector<int> mids = candidateSynth.getMappingIDForIndices(index); return mids; } void ExpMessageOrganiser::showCurrentSlot(){ currentPresetSlot = expPresetManager.getCurrentPresetSlot(); presetIconPanel->setTextAndImage(currentPresetSlot->name, currentPresetSlot->getImage()); } void ExpMessageOrganiser::loadPreset(string pname){ vector<int> values = expPresetManager.getPresetValuesForName(pname); if (values.size()){ candidateSynth.setAllParams(values); setAllSlidersToValues(values); }else{ cout << "ERROR, no preset found" << endl; } } //----------------------------------------------------------------------------- void ExpMessageOrganiser::buttonPressCallback(int mappingID, int value){ if (mappingID == TRIGGER_CANDIDATE_ID){ triggerCandidateSound(); return; } if(mappingID == SAVE_PRESET_HIT){ expPresetManager.writeValuesToSlot(candidateSynth.getAllParamValues()); showCurrentSlot(); return; } }