From aca6161b1c8ee632e388731084b6158a1483e71a Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 30 Sep 2022 23:24:23 +0100 Subject: head wreck --- passadesgui/src/ofApp.cpp | 139 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 129 insertions(+), 10 deletions(-) (limited to 'passadesgui/src/ofApp.cpp') diff --git a/passadesgui/src/ofApp.cpp b/passadesgui/src/ofApp.cpp index 36e0785..e8b8a91 100644 --- a/passadesgui/src/ofApp.cpp +++ b/passadesgui/src/ofApp.cpp @@ -91,7 +91,7 @@ void ofApp::setup(){ drawgui.add(video_speed.setup("playback speed", 1.0, 0.0, 3.0)); drawgui.add(shapes_randomise.setup("randomise shapes", true)); drawgui.add(shapes_amount.setup("shapes amount", 0.2, 0.0, 0.8)); - drawgui.add(shapes_duration.setup("shape duration", 5, 0, 25)); + drawgui.add(shapes_duration.setup("shape duration", 5, 0, 250)); drawgui.add(use_mask.setup("use mask", true)); drawgui.add(invert_mask.setup("invert mask", false)); drawgui.add(use_segmenter.setup("use segmenter", false)); @@ -115,7 +115,7 @@ void ofApp::setup(){ audiogui.add(plotter.bars.set("bars",true)); audiogui.add(plotter.mirror.set("mirror",false)); audiogui.add(plotter.width.set("point width", 2, 1, 256)); - audiogui.add(plotter.num_points.set("num points", 50, 1, 64)); + audiogui.add(plotter.num_points.set("num points", 50, 1, 512)); audiogui.add(plotter.history_size.set("num plots", 5, 1, 64)); audiogui.add(plotter.translate.set("translate",ofVec2f(0,0),ofVec2f(-50,-50),ofVec2f(50,50))); audiogui.add(plotter.rotate.set("rotate",0.0f,-10.0f,10.0f)); @@ -128,7 +128,7 @@ void ofApp::setup(){ //============================ MIDI midiIn.listInPorts(); - midiIn.openPort(0); + midiIn.openPort(1); midiIn.addListener(this); //======================================= //positioning interface @@ -755,6 +755,54 @@ void ofApp::drawOutput(ofEventArgs & args){ break; } case SVG_outlines:{ + if (!use_onset||onset_framegetSegments(segmenter_number,segmenter_length,phase); + for (auto segment=segments.begin();segment!=segments.end();segment++){ + //polyOutput.push_back(colourPolyline(*segment,ofColor(laser_R,laser_G,laser_B))); + polyOutput.push_back(*segment); + } + } + else { + //polyOutput.push_back(colourPolyline(shape->getPoly(),ofColor(laser_R,laser_G,laser_B))); + polyOutput.push_back(shape->getPoly()); + } + } + } + if (contour_useColour){ + vector newPolys; + for (auto p: polyOutput){ + newPolys.push_back(colourPolyline((ofPolyline)p,ofColor(laser_R,laser_G,laser_B))) ; + } + polyOutput=newPolys; + } + } + break; + } + /*{ if (shapes_randomise){ if (framecounter==0){ select_random_shapes(); @@ -764,11 +812,15 @@ void ofApp::drawOutput(ofEventArgs & args){ if (use_segmenter){ auto segments=segmenters[s].getSegments(segmenter_number,segmenter_length,phase); for (auto segment=segments.begin();segment!=segments.end();segment++){ - polyOutput.push_back(colourPolyline(*segment,ofColor(laser_R,laser_G,laser_B))); + polyOutput.push_back(contour_useColour? + colourPolyline(*segment): + colourPolyline(*segment,ofColor(laser_R,laser_G,laser_B))); } } else { - polyOutput.push_back(colourPolyline(segmenters[s].getPoly(),ofColor(laser_R,laser_G,laser_B))); + polyOutput.push_back(contour_useColour? + colourPolyline(segmenters[s].getPoly()): + colourPolyline(segmenters[s].getPoly(),ofColor(laser_R,laser_G,laser_B))); } } framecounter--; @@ -778,17 +830,21 @@ void ofApp::drawOutput(ofEventArgs & args){ if (use_segmenter){ auto segments=shape->getSegments(segmenter_number,segmenter_length,phase); for (auto segment=segments.begin();segment!=segments.end();segment++){ - polyOutput.push_back(colourPolyline(*segment,ofColor(laser_R,laser_G,laser_B))); + polyOutput.push_back(contour_useColour? + colourPolyline(*segment): + colourPolyline(*segment,ofColor(laser_R,laser_G,laser_B))); } } else { - polyOutput.push_back(colourPolyline(shape->getPoly(),ofColor(laser_R,laser_G,laser_B))); + polyOutput.push_back(contour_useColour? + colourPolyline(shape->getPoly()): + colourPolyline(shape->getPoly(),ofColor(laser_R,laser_G,laser_B))); } } } break; - } + }*/ case Audio:{ ofMatrix4x4 x=ofMatrix4x4(1.0f,0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f,0.0f, @@ -1068,7 +1124,49 @@ void ofApp::windowResized(int w, int h){ } -void ofApp::select_random_shapes(){ +float last_frame_time=0.0f; + +void ofApp::select_random_shapes(float duration,bool generate=true){ + float timedelta=ofGetElapsedTimef()-last_frame_time; + last_frame_time=ofGetElapsedTimef(); + //track how long each shape has been selected + for (int i=0;i0.0f){ + shape_selection_durations[i]=shape_selection_durations[i]-timedelta; + } + } + + shape_selection.clear(); + + for (int i=0;i0.0f){ + shape_selection.insert(i); + } + } + std::stringstream strom; + for (auto& s:shape_selection){ + strom << s <<":"<