annotate MessageOrganiser.h @ 32:75202498bee9

perform mode (no guides at all)
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 25 Nov 2014 17:03:33 +0000
parents 27cdf475aa4b
children 52dbd5b4cfa9
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@32 71 void setSeqNumPanel(TextPanel * snp);
rt300@32 72 void setScoreNumPanel(TextPanel * snp);
rt300@16 73 //-----------------------------------------------------------------------------
rt300@18 74 void hideMyPanels();
rt300@18 75 void showMyPanels();
rt300@32 76 void midiFromLeap(int ctl_num, int ctl_val);
rt300@8 77 protected:
rt300@8 78
rt300@8 79 PDSynthWrapper candidateSynth;
rt300@0 80 PDSynthWrapper targetSynth;
rt300@9 81 ButtonPanel* bottomPanel; // shows during test : play buttons and submit
rt300@27 82 SliderPanel* controlPanel;
rt300@16 83
rt300@16 84 IconPanel* presetIconPanel;
rt300@16 85 TextPanel* instructionPanel;
rt300@32 86 TextPanel * seqNumPanel;
rt300@32 87 TextPanel * scoreNumPanel;
rt300@9 88 map<int,UIElement*> currentMapping; // could get more sophisticated if not 1-1 ?
rt300@8 89
rt300@27 90 vector<int> getMappingIDsFromSynths();
rt300@18 91 void triggerCandidateSound();
rt300@18 92 void paramChangeCallback(int mappingID, int value);
rt300@18 93 void sendSynthValuesAgain();
rt300@18 94 void setAllSlidersToValues(vector<int> values);
rt300@22 95 void setCandidateAndSlidersToRandom();
rt300@0 96 // we want to set UI object
rt300@18 97 void setUIToParam(int index, int value);
rt300@18 98 void mapControlToParam(UIElement* control, int mappingID);
rt300@32 99
rt300@32 100 void showSeqNum(int num);
rt300@32 101 void showScoreNum(int num);
rt300@32 102
rt300@16 103 //-----------------------------------------------------------------------------
rt300@16 104
rt300@18 105 void mapSlidersToParams(vector<UIElement*> elems, vector<int> mids);
rt300@18 106 void mapXYToParams(ButtronXY* control, int mappingIDX, int mappingIDY);
rt300@16 107
rt300@18 108 void mapControlToParam(UIElement* control, string paramName);
rt300@18 109 virtual void buttonPressCallback(int mappingID, int value);
rt300@0 110
rt300@18 111 void setSlidersToTarget();
rt300@18 112 void setSlidersToDefault();
rt300@21 113 void showTargetAsHints();
rt300@9 114 bool onlyChangeCandidateOnTrigger;
rt300@23 115 bool okToGetMidi;
rt300@0 116
rt300@0 117 };
rt300@0 118