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@43
|
70 void setSkipButton(Buttron* b);
|
rt300@18
|
71 void setInstructionPanel(TextPanel * ip);
|
rt300@32
|
72 void setSeqNumPanel(TextPanel * snp);
|
rt300@32
|
73 void setScoreNumPanel(TextPanel * snp);
|
rt300@38
|
74 void setDistanceSlider(ButtronSlider * s);
|
rt300@43
|
75 void setMiddlePanel(TextPanel* tp);
|
rt300@16
|
76 //-----------------------------------------------------------------------------
|
rt300@18
|
77 void hideMyPanels();
|
rt300@18
|
78 void showMyPanels();
|
rt300@32
|
79 void midiFromLeap(int ctl_num, int ctl_val);
|
rt300@37
|
80 void setPanelType(controlPanelType p);
|
rt300@38
|
81 void update();
|
rt300@48
|
82 virtual void reset(){};
|
rt300@8
|
83 protected:
|
rt300@8
|
84
|
rt300@8
|
85 PDSynthWrapper candidateSynth;
|
rt300@0
|
86 PDSynthWrapper targetSynth;
|
rt300@9
|
87 ButtonPanel* bottomPanel; // shows during test : play buttons and submit
|
rt300@27
|
88 SliderPanel* controlPanel;
|
rt300@16
|
89
|
rt300@16
|
90 IconPanel* presetIconPanel;
|
rt300@16
|
91 TextPanel* instructionPanel;
|
rt300@32
|
92 TextPanel * seqNumPanel;
|
rt300@32
|
93 TextPanel * scoreNumPanel;
|
rt300@43
|
94 TextPanel* middlePanel;
|
rt300@9
|
95 map<int,UIElement*> currentMapping; // could get more sophisticated if not 1-1 ?
|
rt300@8
|
96
|
rt300@27
|
97 vector<int> getMappingIDsFromSynths();
|
rt300@18
|
98 void triggerCandidateSound();
|
rt300@18
|
99 void paramChangeCallback(int mappingID, int value);
|
rt300@18
|
100 void sendSynthValuesAgain();
|
rt300@18
|
101 void setAllSlidersToValues(vector<int> values);
|
rt300@22
|
102 void setCandidateAndSlidersToRandom();
|
rt300@38
|
103 void setSlidersToCandidate();
|
rt300@0
|
104 // we want to set UI object
|
rt300@18
|
105 void setUIToParam(int index, int value);
|
rt300@18
|
106 void mapControlToParam(UIElement* control, int mappingID);
|
rt300@32
|
107
|
rt300@32
|
108 void showSeqNum(int num);
|
rt300@32
|
109 void showScoreNum(int num);
|
rt300@32
|
110
|
rt300@16
|
111 //-----------------------------------------------------------------------------
|
rt300@16
|
112
|
rt300@18
|
113 void mapSlidersToParams(vector<UIElement*> elems, vector<int> mids);
|
rt300@18
|
114 void mapXYToParams(ButtronXY* control, int mappingIDX, int mappingIDY);
|
rt300@16
|
115
|
rt300@18
|
116 void mapControlToParam(UIElement* control, string paramName);
|
rt300@18
|
117 virtual void buttonPressCallback(int mappingID, int value);
|
rt300@0
|
118
|
rt300@18
|
119 void setSlidersToTarget();
|
rt300@18
|
120 void setSlidersToDefault();
|
rt300@21
|
121 void showTargetAsHints();
|
rt300@9
|
122 bool onlyChangeCandidateOnTrigger;
|
rt300@23
|
123 bool okToGetMidi;
|
rt300@37
|
124 controlPanelType panelType;
|
rt300@38
|
125 ButtronSlider * distanceSlider;
|
rt300@43
|
126 Buttron* skipButton;
|
rt300@43
|
127
|
rt300@0
|
128 };
|
rt300@0
|
129
|