annotate MessageOrganiser.h @ 22:8124f46eda65

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