comparison MessageOrganiser.h @ 16:2da0350a4aa2

expMessageOrganiser and express/explore view setup.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 21 Oct 2014 18:06:44 +0100
parents f83635861187
children 2a7320a8cbed
comparison
equal deleted inserted replaced
15:e439bf85b665 16:2da0350a4aa2
29 #include "3Dbox.h" 29 #include "3Dbox.h"
30 #include "TextPanel.h" 30 #include "TextPanel.h"
31 #include "CountdownText.h" 31 #include "CountdownText.h"
32 #include "buttonPanel.h" 32 #include "buttonPanel.h"
33 #include "ExplorePresetManager.h" 33 #include "ExplorePresetManager.h"
34 34 #include "IconPanel.h"
35 35
36 // should be called TIMED TEST MESSAGE ORGANISER ? 36 // should be called TIMED TEST MESSAGE ORGANISER ?
37 37
38 // event logger needs to know 38 // event logger needs to know
39 // which controls were showing in what mode 39 // which controls were showing in what mode
78 78
79 }; 79 };
80 void setBottomPanel(ButtonPanel * ntb){ 80 void setBottomPanel(ButtonPanel * ntb){
81 bottomPanel = ntb; 81 bottomPanel = ntb;
82 }; 82 };
83
84
85 void setIconPanel(IconPanel * ip){
86 presetIconPanel = ip;
87 }
88 void setInstructionPanel(TextPanel * ip){
89 instructionPanel = ip;
90 instructionPanel->show();
91 }
92
93
94 //-----------------------------------------------------------------------------
95 void hideMyPanels(){
96 presetIconPanel->hide();
97 instructionPanel->hide();
98 bottomPanel->hide();
99 panel->hide();
100 }
101 void showMyPanels(){
102 presetIconPanel->show();
103 instructionPanel->show();
104 bottomPanel->show();
105 panel->show();
106 }
83 protected: 107 protected:
84 108
85 PDSynthWrapper candidateSynth; 109 PDSynthWrapper candidateSynth;
86 PDSynthWrapper targetSynth; 110 PDSynthWrapper targetSynth;
87 ButtonPanel* bottomPanel; // shows during test : play buttons and submit 111 ButtonPanel* bottomPanel; // shows during test : play buttons and submit
88 SliderPanel* panel; 112 SliderPanel* panel;
113
114 IconPanel* presetIconPanel;
115 TextPanel* instructionPanel;
116
89 map<int,UIElement*> currentMapping; // could get more sophisticated if not 1-1 ? 117 map<int,UIElement*> currentMapping; // could get more sophisticated if not 1-1 ?
90 118
91 119
92 void triggerCandidateSound(){ 120 void triggerCandidateSound(){
93 // log event 121 // log event
154 currentMapping.insert(std::pair<int,UIElement*>(mappingID,control)); 182 currentMapping.insert(std::pair<int,UIElement*>(mappingID,control));
155 cout << " Mapped control to ID: " << mappingID << "Name: " << candidateSynth.getNameForMappingID(mappingID) << endl; 183 cout << " Mapped control to ID: " << mappingID << "Name: " << candidateSynth.getNameForMappingID(mappingID) << endl;
156 control->setLabel(candidateSynth.getNameForMappingID(mappingID)); 184 control->setLabel(candidateSynth.getNameForMappingID(mappingID));
157 }; 185 };
158 186
187 //-----------------------------------------------------------------------------
188
189 void mapSlidersToParams(vector<UIElement*> elems, vector<int> mids){
190
191 vector<UIElement*>::iterator elit;
192 vector<int> typeListLog;
193 int i = 0;
194 for(elit=elems.begin(); elit<elems.end();elit++){
195 if ( (*elit)->getType() == SLIDER){
196 if(i >= mids.size()){
197
198 cout << "ERROR ERROR: too many controls for mapping IDs: " << mids.size() << endl;
199 }
200
201 ButtronSlider* theSlider = (ButtronSlider*)(*elit);
202 mapControlToParam((*elit), mids[i]);
203 theSlider->setValueAndScale(candidateSynth.getParamValueForID(mids[i]));
204 cout << "Hint Value " << targetSynth.getParamValueFromName(candidateSynth.getNameForMappingID(mids[i])) << endl;
205 theSlider->setHintValue(targetSynth.getParamValueFromName(candidateSynth.getNameForMappingID(mids[i])));
206 i++;
207 typeListLog.push_back(int(SLIDER));
208
209 }else{
210 cout << "ERROR ERROR: ui type not handled my mapping function !" << endl;
211 }
212 }
213
214 eventLogger.logEvent(CONTROL_LIST,typeListLog);
215 };
216
159 void mapXYToParams(ButtronXY* control, int mappingIDX, int mappingIDY){ 217 void mapXYToParams(ButtronXY* control, int mappingIDX, int mappingIDY){
160 UICallbackFunction callback; 218 UICallbackFunction callback;
161 219
162 callback = boost::bind(&MessageOrganiser::paramChangeCallback, this, _1,_2); 220 callback = boost::bind(&MessageOrganiser::paramChangeCallback, this, _1,_2);
163 221