#pragma once #include "ofMain.h" //#include "ofxNDI.h" #include "ofxGui.h" #include "ofxXmlSettings.h" #include "ofxOpenCv.h" #include "ofxSVG.h" #include "ofxClipper.h" #include "ofxMidi.h" #include "ofxHelios.h" #include "lineTransformer.h" #include "lineSegmenter.h" #include "ofxGist.h" //This is included only as a way of getting buffer out of loaded sound. //There are many other ways you can do that. //This player includes a version of kissFFT. You can remove the one included in Gist. //https://github.com/borg/ofxOpenALSoundPlayer #include "ofxOpenALSoundPlayer.h" //Slightly modified to add a dynamic getVariable method to be able to plot based on //gist feature list //https://github.com/local-projects/ofxHistoryPlot #include "ofxHistoryPlot.h" #include "Audioplotter.h" enum Source{ TEST, // NDI, Player, SVG_outlines, SVG_segmenters, Audio, Source_end }; class chaosPanel : public ofxPanel { public: chaosPanel(){ ofRegisterKeyEvents(this, defaultEventsPriority); } bool isSelected; ofParameter active; ofParameter amount; ofParameter scale; //?per plugin?? bool mouseMoved(ofMouseEventArgs & args){ if (args.x>getPosition().x&& args.x-getPosition().xgetPosition().y&& args.y-getPosition().y "< "< "< transformer <> chaos <> drawing */ int shown=0; void update_sliders(){ clear(); add(plugin_label.setup(chaosloader.name)); add(active.set("use",false)); add(amount.set("amount", 0.0f, -0.1f, 0.1f)); for (auto p:chaosloader.get().params){ add(p); } } private: Chaos chaosloader; ofxLabel plugin_label; ofParameter plugin_name; }; class ofApp: public ofBaseApp, public ofxMidiListener { public: void setup(); void update(); void draw(); void exit(); void keyPressed(ofKeyEventArgs &keyargs); void keyReleased(ofKeyEventArgs & args); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void mouseEntered(int x, int y); void mouseExited(int x, int y); void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void newMidiMessage(ofxMidiMessage& eventArgs); void updateOutput(ofEventArgs & args); void drawOutput(ofEventArgs & args); void outputKeyPressed(ofKeyEventArgs & args); void outputKeyReleased(ofKeyEventArgs & args); void outputMouseDragged(ofMouseEventArgs & args); void outputMousePressed(ofMouseEventArgs & args); void outputMouseReleased(ofMouseEventArgs & args); void outputWindowResized(ofResizeEventArgs &resizeargs); void select_random_shapes(); void default_settings(); void save_settings(); bool commandPressed; glm::vec2 warpframe[4]; int select_warpframe; bool bDrawFrame; ofxHelios laser; int source; //======================================== //audio ofxGist gist; void onNoteOn(GistEvent &e); void onNoteOff(GistEvent &e); ofSoundStream soundStream; ofxOpenALSoundPlayer player; void processAudio(float * input, int bufferSize, int nChannels); void audioIn(float * input, int bufferSize, int nChannels); void loadSong(string str); int bufferSize; int sampleRate; vectorfftSmoothed; vector left; vector right; vector centre; Audioplotter plotter; //======== audio gui ofxPanel audiogui; ofParameter useMic; ofParameter useFft; ofParameter scalePlot; ofParameter decayPlot; void useMicChanged(); //======= audio response gui ofxPanel responsegui; ofParameter onset_threshold; ofParameter use_onset; ofParameter onset_duration; int onset_frame; int onset_number; //======== chaos gui chaosPanel chaosgui; // best architecture for the chaos plugin? // how to use it on an arbitrary set of data // should it be a part of the audio plotter? //======================================== //thresholding ofxCvColorImage colorImg; ofxCvGrayscaleImage grayImage; ofxCvContourFinder contourFinder; //======================================== //ofxNDI /* ofxNDIreceiver ndiReceiver; ofImage ndiImage; char senderName[256]; int nSenders; unsigned int senderWidth; unsigned int senderHeight; bool bNDIreceiver; // For received frame fps calculations double startTime, lastTime, frameTime, frameRate, fps; */ //====== drawing gui ofxPanel drawgui; ofxIntSlider contour_threshold; ofxFloatSlider contour_simplify; ofxToggle contour_useColour; ofxIntSlider laser_R; ofxIntSlider laser_G; ofxIntSlider laser_B; //====== video ofxFloatSlider video_speed; //svg gui ofxToggle shapes_randomise; ofxFloatSlider shapes_amount; ofxIntSlider shapes_duration; ofxToggle use_mask; ofxToggle invert_mask; //segmenter ofxToggle use_segmenter; ofxFloatSlider segmenter_speed; ofxFloatSlider segmenter_length; ofxIntSlider segmenter_number; //transforms ofxToggle use_rotate; ofxFloatSlider xf_rotate; ofxToggle use_scale; ofxFloatSlider xf_scale_speed; ofxFloatSlider xf_scale_min; ofxFloatSlider xf_scale_max; //======= laser gui ofxPanel lasergui; ofParameter laser_power; ofParameter laser_intensity; ofParameter laser_points; ofParameter laser_subdivide; ofParameter laser_blank_num; ofParameter laser_max_angle; //======================================= //MIDI ofxMidiIn midiIn; ofxMidiMessage midiMessage; //======================================= //video player ofVideoPlayer movie; //======================================= //SVG player ofxSVG svg; vector segmenters; set shape_selection; int framecounter; float phase,prev_time; //to calculate phase float rotate_amt; float scale_phase,scale_amt; //======================================= //Mask clipping ofPolyline safety_frame; vector mask; ofx::Clipper clipper; //======================================= //positioning interface bool bShowPositionInterface; bool bOutputSelected; ofPoint outputSelectionPoint; ofPoint outputPosition; ofPoint outputOffset; float outputScale; float outputOffsetScale; //======================================= //saving settings ofxXmlSettings XML; };