annotate MessageOrganiser.h @ 27:27cdf475aa4b

more fiddling
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 29 Oct 2014 15:38:38 +0000
parents b339acf124df
children 75202498bee9
rev   line source
rt300@0 1 //
rt300@0 2 // MessageOrganiser.h
rt300@0 3 // tweakathlon
rt300@0 4 //
rt300@0 5 // Created by Robert Tubb on 10/12/2013.
rt300@0 6 //
rt300@0 7 // This object handles the mapping from GUI to params
rt300@0 8 //
rt300@0 9 // and sends their messages to PD and eventLogger
rt300@0 10 #pragma once
rt300@0 11 #include "eventLogger.h"
rt300@0 12 #include <map.h>
rt300@0 13 #include <vector>
rt300@0 14 #include <string>
rt300@0 15 #include "boost/bind.hpp"
rt300@0 16 #include "boost/function.hpp"
rt300@0 17
rt300@0 18 #include <UIElement.h>
rt300@0 19 #include <Buttron.h>
rt300@0 20 #include <ButtronSlider.h>
rt300@0 21 #include <ButtronXY.h>
rt300@0 22 #include "TestController.h"
rt300@0 23 #include "timeController.h"
rt300@0 24 #include "PDSynthWrapper.h"
rt300@0 25 #include "ofxTimer.h"
rt300@0 26 #include "sliderPanel.h"
rt300@0 27 //#include "testApp.h"
rt300@0 28 #include "targetSymbol.h"
rt300@0 29 #include "3Dbox.h"
rt300@24 30 #include "6Dbox.h"
rt300@0 31 #include "TextPanel.h"
rt300@0 32 #include "CountdownText.h"
rt300@0 33 #include "buttonPanel.h"
rt300@6 34 #include "ExplorePresetManager.h"
rt300@16 35 #include "IconPanel.h"
rt300@6 36
rt300@6 37 // should be called TIMED TEST MESSAGE ORGANISER ?
rt300@0 38
rt300@0 39 // event logger needs to know
rt300@0 40 // which controls were showing in what mode
rt300@0 41 // which controls were mapped to what param
rt300@0 42 // what was the target sound params
rt300@0 43 // all the updates of control movements, submit, quit etc
rt300@0 44
rt300@0 45 // this is the bit that handles mapping from UI elements to synth i.e testApp DOESNT DO THAT
rt300@0 46
rt300@0 47 // has links to panel sliders can show hide them
rt300@0 48
rt300@0 49 // controls flow of stuff
rt300@0 50
rt300@0 51 //---------------------------------------------------------------------
rt300@0 52 //---------------------------------------------------------------------
rt300@0 53 extern TimeController timeController;
rt300@0 54
rt300@0 55 extern EventLogger eventLogger;
rt300@0 56
rt300@6 57 extern ExplorePresetManager expPresetManager;
rt300@4 58
rt300@11 59 //typedef boost::function<void(void)> AppModeChangeFunction;
rt300@0 60
rt300@0 61 class MessageOrganiser {
rt300@8 62
rt300@8 63 public:
rt300@18 64 void init(PDSynthWrapper& cs, PDSynthWrapper& ts); // could template for ui element type??
rt300@18 65 void mapButtonToAction(UIElement* control, int mappingID);
rt300@27 66 void setupDefaultMapping(controlPanelType whichInterfaceAreWeUsing);
rt300@18 67 void setControlPanel(SliderPanel* p);
rt300@18 68 void setBottomPanel(ButtonPanel * ntb);
rt300@18 69 void setIconPanel(IconPanel * ip);
rt300@18 70 void setInstructionPanel(TextPanel * ip);
rt300@16 71 //-----------------------------------------------------------------------------
rt300@18 72 void hideMyPanels();
rt300@18 73 void showMyPanels();
rt300@8 74 protected:
rt300@8 75
rt300@8 76 PDSynthWrapper candidateSynth;
rt300@0 77 PDSynthWrapper targetSynth;
rt300@9 78 ButtonPanel* bottomPanel; // shows during test : play buttons and submit
rt300@27 79 SliderPanel* controlPanel;
rt300@16 80
rt300@16 81 IconPanel* presetIconPanel;
rt300@16 82 TextPanel* instructionPanel;
rt300@16 83
rt300@9 84 map<int,UIElement*> currentMapping; // could get more sophisticated if not 1-1 ?
rt300@8 85
rt300@27 86 vector<int> getMappingIDsFromSynths();
rt300@18 87 void triggerCandidateSound();
rt300@18 88 void paramChangeCallback(int mappingID, int value);
rt300@18 89 void sendSynthValuesAgain();
rt300@18 90 void setAllSlidersToValues(vector<int> values);
rt300@22 91 void setCandidateAndSlidersToRandom();
rt300@0 92 // we want to set UI object
rt300@18 93 void setUIToParam(int index, int value);
rt300@18 94 void mapControlToParam(UIElement* control, int mappingID);
rt300@16 95 //-----------------------------------------------------------------------------
rt300@16 96
rt300@18 97 void mapSlidersToParams(vector<UIElement*> elems, vector<int> mids);
rt300@18 98 void mapXYToParams(ButtronXY* control, int mappingIDX, int mappingIDY);
rt300@16 99
rt300@18 100 void mapControlToParam(UIElement* control, string paramName);
rt300@18 101 virtual void buttonPressCallback(int mappingID, int value);
rt300@0 102
rt300@18 103 void setSlidersToTarget();
rt300@18 104 void setSlidersToDefault();
rt300@21 105 void showTargetAsHints();
rt300@9 106 bool onlyChangeCandidateOnTrigger;
rt300@23 107 bool okToGetMidi;
rt300@0 108
rt300@0 109 };
rt300@0 110