From ed74b09164c13c645fb8e0bcccc9fda17e455e75 Mon Sep 17 00:00:00 2001 From: incandenza Date: Fri, 23 Jul 2021 12:31:58 +0200 Subject: [PATCH] working structure --- addons.make | 1 + config.make | 2 +- src/mnglitches/line.cpp | 4 ++-- src/mnglitches/line.h | 2 +- src/ofApp.cpp | 14 +++++++++++++- src/ofApp.h | 3 +++ 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/addons.make b/addons.make index e69de29..ce97b8c 100644 --- a/addons.make +++ b/addons.make @@ -0,0 +1 @@ +ofxFft diff --git a/config.make b/config.make index 7e2ad02..7752945 100644 --- a/config.make +++ b/config.make @@ -76,7 +76,7 @@ # add a runtime path to search for those shared libraries, since they aren't # incorporated directly into the final executable application binary. ################################################################################ -# PROJECT_LDFLAGS=-Wl,-rpath=./libs +PROJECT_LDFLAGS=-Wl,-rpath=./libs /opt/openFrameworks/addons/ofxFft/libs/fftw/lib/libfftw3f.a ################################################################################ # PROJECT DEFINES diff --git a/src/mnglitches/line.cpp b/src/mnglitches/line.cpp index c5b82b4..a713c7d 100644 --- a/src/mnglitches/line.cpp +++ b/src/mnglitches/line.cpp @@ -8,7 +8,7 @@ Line::Line() setX(0); setY(0); } -Line::Line(float &x, float &y) +Line::Line(const float &x, const float &y) { setX(x); setY(y); @@ -22,7 +22,7 @@ void Line::setup(){ }; void Line::draw(){ - + ofDrawLine(glm::vec2(ofRandom(getX(),ofGetWidth()),ofRandom(getY(),ofGetHeight())),glm::vec2(ofRandom(getX(),ofGetWidth()),ofRandom(getY(),ofGetHeight()))); }; void Line::update(const Randomness *rthings){ diff --git a/src/mnglitches/line.h b/src/mnglitches/line.h index c5c8d66..14a317e 100644 --- a/src/mnglitches/line.h +++ b/src/mnglitches/line.h @@ -9,7 +9,7 @@ class Line : public Glitch public: //contructor Line(); - Line(float &x, float &y); + Line(const float &x, const float &y); //destructor ~Line(); diff --git a/src/ofApp.cpp b/src/ofApp.cpp index e002407..4f45d30 100644 --- a/src/ofApp.cpp +++ b/src/ofApp.cpp @@ -56,6 +56,13 @@ void ofApp::setup(){ settings.numInputChannels = 2; settings.bufferSize = bufferSize; soundStream.setup(settings); + + + ///preparing visula glitch + Line l=Line(10.0f,10.0f); + l.setX(12.0f); + + glitches.push_back(new Line(300.0f,300.0f)); // audioAnalyzer.setup(48000, bufferSize, 2); } @@ -86,7 +93,12 @@ void ofApp::draw(){ if(coinToss <= 1){ ofSetLineWidth( map(coinToss,0,3,1,5)); - ofDrawLine(glm::vec2(ofRandom(0,ofGetWidth()),ofRandom(0,ofGetHeight())),glm::vec2(ofRandom(0,ofGetWidth()),ofRandom(0,ofGetHeight()))); + //ofDrawLine(glm::vec2(ofRandom(0,ofGetWidth()),ofRandom(0,ofGetHeight())),glm::vec2(ofRandom(0,ofGetWidth()),ofRandom(0,ofGetHeight()))); + + for(auto & g : glitches) + { + g->draw(); + } } diff --git a/src/ofApp.h b/src/ofApp.h index 4388d4f..c6ae0a1 100644 --- a/src/ofApp.h +++ b/src/ofApp.h @@ -2,6 +2,8 @@ #include "ofMain.h" #include "ofxFft.h" +#include "mnglitches/glitch.h" +#include "mnglitches/line.h" //#include "ofxVoronoi2D.h" //#include "ofxAudioAnalyzer.h" @@ -54,6 +56,7 @@ private: // ofxAudioAnalyzer audioAnalyzer; //glitch float coinToss; + vector glitches;