#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 "ofxOsc.h" #include "ofxHelios.h" #include "lineTransformer.h" #include "lineSegmenter.h" #include "ofxPONK.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" /* doing the show projection mapping * drawing draw shapes into the space and save them in sets use them to draw lines, expand and contract outline use them to mask geometric and random drawn styles have some kind of audioreactivity an interface flexible enough to enable making a show on the fly plugin architecture for vector generators and effects polylines in polylines out masking audio */ enum Source{ TEST, // NDI, Player, SVG_outlines, SVG_segmenters, Audio, OSC, Source_end }; #define PORT 7070 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(float duration,bool generate); void default_settings(); void save_settings(); bool commandPressed; glm::vec2 warpframe[4]; int select_warpframe; bool bDrawFrame; ofxHelios laser; ofxPONKSenderPanel madlaser; 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; ofxToggle contour_adaptive; ofxIntSlider contour_threshold; ofxFloatSlider contour_adaptive_window; 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; ofxFloatSlider shapes_duration; ofxToggle use_mask; ofxToggle invert_mask; //segmenter ofxToggle use_segmenter; ofxToggle colour_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; vector shape_selection_durations; 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; //======================================= //osc for MAME ofxOscReceiver receiver; vector oscpoly; };