# HG changeset patch # User Robert Tubb # Date 1414425124 0 # Node ID 055e0c43afe5a1ffd7bf83f5efd87ea8d1137b97 # Parent 8124f46eda659fc84a5fbec9561f588b2521f378 Leap MIDI works for 6 sliders, in exp and train modes. diff -r 8124f46eda65 -r 055e0c43afe5 ExpMessageOrganiser.h --- a/ExpMessageOrganiser.h Thu Oct 23 18:15:46 2014 +0100 +++ b/ExpMessageOrganiser.h Mon Oct 27 15:52:04 2014 +0000 @@ -26,9 +26,11 @@ void showCurrentSlot(); void loadPreset(string pname); void buttonPressCallback(int mappingID, int value); + void midiFromLeap(int ctl_num, int ctl_val); private: void loadDefaultSound(); int numParamsToUse; + }; diff -r 8124f46eda65 -r 055e0c43afe5 ExpMessageOrganiser.mm --- a/ExpMessageOrganiser.mm Thu Oct 23 18:15:46 2014 +0100 +++ b/ExpMessageOrganiser.mm Mon Oct 27 15:52:04 2014 +0000 @@ -21,6 +21,7 @@ showCurrentSlot(); instructionPanel->setLabel("Find a sound\n that expresses:"); instructionPanel->show(); + okToGetMidi = true; } @@ -111,4 +112,25 @@ return; } -} \ No newline at end of file +} + +void ExpMessageOrganiser::midiFromLeap(int ctl_num, int ctl_val){ + + + if (!okToGetMidi){ + return; + } + vector mids = candidateSynth.getAllMappingIDs(); + if (ctl_num >= mids.size() || ctl_num < 0) return; + + candidateSynth.paramChangeCallback(mids[ctl_num], ctl_val); + + setUIToParam(ctl_num, ctl_val); + + vector evtData; + evtData.push_back(mids[ctl_num]); // or just index? + evtData.push_back(ctl_val); + + eventLogger.logEvent(CANDIDATE_PARAM_ADJUSTED, evtData); + +} diff -r 8124f46eda65 -r 055e0c43afe5 MessageOrganiser.h --- a/MessageOrganiser.h Thu Oct 23 18:15:46 2014 +0100 +++ b/MessageOrganiser.h Mon Oct 27 15:52:04 2014 +0000 @@ -103,6 +103,7 @@ void setSlidersToDefault(); void showTargetAsHints(); bool onlyChangeCandidateOnTrigger; + bool okToGetMidi; }; diff -r 8124f46eda65 -r 055e0c43afe5 PDSynthWrapper.h --- a/PDSynthWrapper.h Thu Oct 23 18:15:46 2014 +0100 +++ b/PDSynthWrapper.h Mon Oct 27 15:52:04 2014 +0000 @@ -141,7 +141,16 @@ } return result; } - + vector getAllMappingIDs(){ + vector result; + + for(int i = 0 ; i < timbreParams.size(); i++){ + int mapid = timbreParams[i].getID(); + result.push_back(mapid); + + } + return result; + } const int getParamValueFromName(string name) const{ diff -r 8124f46eda65 -r 055e0c43afe5 SequenceController.h --- a/SequenceController.h Thu Oct 23 18:15:46 2014 +0100 +++ b/SequenceController.h Mon Oct 27 15:52:04 2014 +0000 @@ -16,7 +16,7 @@ #define MAX_TARGETS_IN_SEQUENCE 5 #define MIN_TEMPO 60 #define MAX_TEMPO 120 -#define NUM_TEMPO_STEPS 8 +#define NUM_TEMPO_STEPS 16 #define NUM_PRESETS 8 diff -r 8124f46eda65 -r 055e0c43afe5 SequenceController.mm --- a/SequenceController.mm Thu Oct 23 18:15:46 2014 +0100 +++ b/SequenceController.mm Mon Oct 27 15:52:04 2014 +0000 @@ -101,7 +101,7 @@ type = MATCHING_INTERACTION; showsTargetIcon = true; showsControlSettings = false; - showsControlGuides = false; + showsControlGuides = true; showsMatchResults = false; hidesSliders = false; isPreview = false; diff -r 8124f46eda65 -r 055e0c43afe5 TrainingMessageOrganiser.h --- a/TrainingMessageOrganiser.h Thu Oct 23 18:15:46 2014 +0100 +++ b/TrainingMessageOrganiser.h Mon Oct 27 15:52:04 2014 +0000 @@ -29,7 +29,7 @@ void onNextTick(int tickNumber); void showMyPanels(); - + void midiFromLeap(int ctl_num, int ctl_val); //----------------------------------------------------------------------- protected: void showUserHowTheyDid(); diff -r 8124f46eda65 -r 055e0c43afe5 TrainingMessageOrganiser.mm --- a/TrainingMessageOrganiser.mm Thu Oct 23 18:15:46 2014 +0100 +++ b/TrainingMessageOrganiser.mm Mon Oct 27 15:52:04 2014 +0000 @@ -117,6 +117,7 @@ // do finished run stuff, show summary candidateSynth.stopMetronome(); cout << "FINISHED BLOCK" << endl; + panel->hide(); middlePanel->setColor(ofColor::white); middlePanel->setText("FINISHED BLOCK"); return; @@ -125,6 +126,7 @@ // do finished run stuff, show summary candidateSynth.stopMetronome(); cout << "FINISHED RUN" << endl; + panel->hide(); middlePanel->setColor(ofColor::white); middlePanel->setText("FINISHED RUN"); middlePanel->show(); @@ -174,8 +176,10 @@ if(newStep.allowsCandidateControl){ setCandidateAndSlidersToRandom(); panel->setActive(true); + okToGetMidi = true; }else{ panel->setActive(false); + okToGetMidi = false; } if(newStep.showsControlSettings){ @@ -239,7 +243,27 @@ } //----------------------------------------------------------------------------- - +void TrainingMessageOrganiser::midiFromLeap(int ctl_num, int ctl_val){ + + if (!okToGetMidi){ + return; + } + vector mids = candidateSynth.getAllMappingIDs(); + if (ctl_num >= mids.size() || ctl_num < 0) return; + + paramChangeCallback(mids[ctl_num], ctl_val ); + + //candidateSynth.paramChangeCallback(mids[ctl_num], ctl_val); + + setUIToParam(ctl_num, ctl_val); + + vector evtData; + evtData.push_back(mids[ctl_num]); // or just index? + evtData.push_back(ctl_val); + + eventLogger.logEvent(CANDIDATE_PARAM_ADJUSTED, evtData); + +} //----------------------------------------------------------------------------- void TrainingMessageOrganiser::buttonPressCallback(int mappingID, int value){ diff -r 8124f46eda65 -r 055e0c43afe5 UI code/3DboxGL.h --- a/UI code/3DboxGL.h Thu Oct 23 18:15:46 2014 +0100 +++ b/UI code/3DboxGL.h Mon Oct 27 15:52:04 2014 +0000 @@ -102,13 +102,17 @@ ofLine(ix,iy,iz,left,iy,iz); //blob - ofDrawIcoSphere(ix,iy,iz,12); - // line to front (a bit wierd?) + drawIndicatorBlob(ix,iy,iz,c); + // line to front (a bit wierde?) ofLine(ix,iy,iz,ix,iy,front); } + virtual void drawIndicatorBlob( float x, float y, float z, ofColor c){ + ofSetColor(c); + ofDrawIcoSphere(x,y,z,12); + } ofColor calculateHintColor(){ diff -r 8124f46eda65 -r 055e0c43afe5 UI code/6Dbox.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UI code/6Dbox.h Mon Oct 27 15:52:04 2014 +0000 @@ -0,0 +1,28 @@ +// +// 6Dbox.h +// riftathon +// +// Created by Robert Tubb on 27/10/2014. +// +// + +#ifndef __riftathon___Dbox__ +#define __riftathon___Dbox__ +#include "3DboxGL.h" +#include + +class Leap6DBox : public Leap3DBoxGL { + +public: + Leap6DBox(float ax, + float ay, + float awidth, + float aheight, + float azx, + float azy, + const UIProps& props); + +}; + + +#endif /* defined(__riftathon___Dbox__) */ diff -r 8124f46eda65 -r 055e0c43afe5 UI code/6Dbox.mm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UI code/6Dbox.mm Mon Oct 27 15:52:04 2014 +0000 @@ -0,0 +1,22 @@ +// +// 6Dbox.mm +// riftathon +// +// Created by Robert Tubb on 27/10/2014. +// +// + +#include "6Dbox.h" +Leap6DBox::Leap6DBox(float ax, + float ay, + float awidth, + float aheight, + float azx, + float azy, + const UIProps& props) : +Leap3DBoxGL(ax,ay,awidth, aheight, azx, azy, props) +{ + + // set up hand mesh + +} \ No newline at end of file diff -r 8124f46eda65 -r 055e0c43afe5 testApp.mm --- a/testApp.mm Thu Oct 23 18:15:46 2014 +0100 +++ b/testApp.mm Mon Oct 27 15:52:04 2014 +0000 @@ -447,6 +447,8 @@ expMessageOrganiser.showMyPanels(); // TODO how is testApp going to kknow whichInterfaceShowing ??? + currentStage = EXPRESS; + } //-------------------------------------------------------------- void testApp::startTheSearchTests(){ @@ -457,14 +459,14 @@ trainingMessageOrganiser.hideMyPanels(); searchMessageOrganiser.countdownToNewTest(); // TODO how is testApp going to kknow whichInterfaceShowing ??? - + currentStage = SEARCH; } void testApp::startTheTrainingTests(){ eventLogger.logEvent(START_THE_TRAINING_TESTS); trainingMessageOrganiser.setupDefaultMapping(); trainingMessageOrganiser.showMyPanels(); - + currentStage = TRAINING; } //-------------------------------------------------------------- //-------------------------------------------------------------- @@ -725,7 +727,10 @@ //cout << " ctrl : " << ctl_num << " : " << ctl_val << endl; if (currentStage == SEARCH) searchMessageOrganiser.midiFromLeap(ctl_num, ctl_val); - + if (currentStage == EXPRESS) + expMessageOrganiser.midiFromLeap(ctl_num, ctl_val); + if (currentStage == TRAINING) + trainingMessageOrganiser.midiFromLeap(ctl_num, ctl_val); }