diff options
| author | Tim Redfern <tim@getdrop.com> | 2018-06-22 18:16:10 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@getdrop.com> | 2018-06-22 18:16:10 +0100 |
| commit | 3baf7e68c29a5a37f9317aeb0f4e75252a9e4530 (patch) | |
| tree | 6180610b74f464c7721cc062c410cbc86b98f03f /gui/src | |
| parent | 54a6478fcdeaadc12c753adf73b171979808fd9e (diff) | |
chaos selecter progress
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/AudioPlotter.h | 17 | ||||
| -rw-r--r-- | gui/src/main.cpp | 2 | ||||
| -rw-r--r-- | gui/src/ofApp.cpp | 17 | ||||
| -rw-r--r-- | gui/src/ofApp.h | 26 |
4 files changed, 42 insertions, 20 deletions
diff --git a/gui/src/AudioPlotter.h b/gui/src/AudioPlotter.h index 57f25ad..40e3fc9 100644 --- a/gui/src/AudioPlotter.h +++ b/gui/src/AudioPlotter.h @@ -19,6 +19,7 @@ class Chaos{ public: vector <AChaosplugin> plugins; vector <vector <REAL>> params; + int whichplugin; Chaos(){ plugins.push_back(AChaosplugin(new AChaosBaker(),"Baker")); plugins.push_back(AChaosplugin(new AChaosClifford(),"Clifford")); @@ -26,6 +27,19 @@ class Chaos{ plugins.push_back(AChaosplugin(new AChaosDuffing(),"Duffing")); plugins.push_back(AChaosplugin(new AChaosGinger(),"Ginger")); plugins.push_back(AChaosplugin(new AChaosHenon(),"Henon")); + whichplugin=0; + } + void next(){ + whichplugin=(whichplugin+1)%plugins.size(); + } + void previous(){ + whichplugin=whichplugin-1; + if (whichplugin<0){ + whichplugin=plugins.size()-1; + } + } + std::string &get_name(){ + return plugins[whichplugin].name; } }; @@ -105,8 +119,11 @@ public: ofParameter<float> chaos_k; ofParameter<float> chaos_p; + Chaos chaosloader; + private: vector < vector<colourPolyline>> data; AChaosIkeda attractor; + };
\ No newline at end of file diff --git a/gui/src/main.cpp b/gui/src/main.cpp index 5b68f90..0d2fa2d 100644 --- a/gui/src/main.cpp +++ b/gui/src/main.cpp @@ -44,8 +44,6 @@ int main(int argc, char *argv[]){ ofAddListener(mainWindow->events().mousePressed,mainApp.get(),&ofApp::outputMousePressed); ofAddListener(mainWindow->events().mouseReleased,mainApp.get(),&ofApp::outputMouseReleased); - //ofAddListener(guiWindow->events().mouseMoved,mainApp.get(),&ofApp::lMouseMoved); - ofRunApp(guiWindow, mainApp); ofRunMainLoop(); } diff --git a/gui/src/ofApp.cpp b/gui/src/ofApp.cpp index 642ad6c..a2196c5 100644 --- a/gui/src/ofApp.cpp +++ b/gui/src/ofApp.cpp @@ -73,7 +73,7 @@ void ofApp::setup(){ onset_frame=0; chaosgui.setup("chaos","",460,820); - chaosgui.add(plugin_label.setup(plugin_name)); + chaosgui.add(plugin_label.setup(plotter.chaosloader.get_name())); chaosgui.add(plotter.usechaos.set("use",false)); chaosgui.add(plotter.chaosamount.set("amount", 0.0f, -0.1f, 0.1f)); chaosgui.add(plotter.chaosscale.set("scale", 100.0f, 1.0f, 1000.0f)); @@ -981,20 +981,7 @@ void ofApp::keyReleased(ofKeyEventArgs &args){ //-------------------------------------------------------------- void ofApp::mouseMoved(int x, int y ){ } -void ofApp::lMouseMoved(ofMouseEventArgs & args ){ - if (args.x>chaosgui.getPosition().x){ //&& - //x-chaosgui.getPosition().x<chaosgui.getWidth()&& - //(y>chaosgui.getPosition().y)&& - //((y-chaosgui.getPosition().y)<chaosgui.getHeight())){ - chaosgui.setFillColor(ofColor(128,64,0)); - ofLog()<<args.x<<","<<args.y<<" :"<<chaosgui.getPosition().x<<","<<chaosgui.getPosition().y<<" :"<<chaosgui.getWidth()<<","<<chaosgui.getHeight()<<" IN"; - } - else { - chaosgui.setFillColor(ofColor(0,0,0)); - ofLog()<<args.x<<","<<args.y<<" :"<<chaosgui.getPosition().x<<","<<chaosgui.getPosition().y<<" :"<<chaosgui.getWidth()<<","<<chaosgui.getHeight()<<" OUT"; - } -} - + //-------------------------------------------------------------- void ofApp::outputMouseDragged(ofMouseEventArgs & args){ if (select_warpframe>-1){ diff --git a/gui/src/ofApp.h b/gui/src/ofApp.h index 41418b3..29c6929 100644 --- a/gui/src/ofApp.h +++ b/gui/src/ofApp.h @@ -39,6 +39,9 @@ enum Source{ class mouseSelectPanel : public ofxPanel { public: + mouseSelectPanel(){ + ofRegisterKeyEvents(this, defaultEventsPriority); + } bool isSelected; bool mouseMoved(ofMouseEventArgs & args){ if (args.x>getPosition().x&& @@ -47,7 +50,7 @@ class mouseSelectPanel : public ofxPanel { args.y-getPosition().y<getHeight()){ if (!isSelected){ isSelected=true; - setBorderColor(ofColor(128,64,0)); + setBorderColor(ofColor(255,128,0)); //ofLog()<<"IN> "<<args.x<<","<<args.y; } } @@ -59,6 +62,25 @@ class mouseSelectPanel : public ofxPanel { } } } + bool keyPressed(ofKeyEventArgs & args){ + if (isSelected){ + //ofLog()<<"KEY> "<<args.key; + switch(args.key){ + case 3812:{ + //previous + break; + } + case 3814:{ + //next + } + } + } + } + bool keyReleased(ofKeyEventArgs & args){ + //required in order to call ofRegisterKeyEvents + } + + }; @@ -81,8 +103,6 @@ class ofApp: public ofBaseApp, public ofxMidiListener { void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); - void lMouseMoved(ofMouseEventArgs & args); //mouseMoved listener - void newMidiMessage(ofxMidiMessage& eventArgs); void updateOutput(ofEventArgs & args); |
