Browse Source

working structure

incandenza 2 years ago
parent
commit
ed74b09164
6 changed files with 21 additions and 5 deletions
  1. 1 0
      addons.make
  2. 1 1
      config.make
  3. 2 2
      src/mnglitches/line.cpp
  4. 1 1
      src/mnglitches/line.h
  5. 13 1
      src/ofApp.cpp
  6. 3 0
      src/ofApp.h

+ 1 - 0
addons.make

@@ -0,0 +1 @@
+ofxFft

+ 1 - 1
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

+ 2 - 2
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){

+ 1 - 1
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();

+ 13 - 1
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();
+                 }
          }
 
 

+ 3 - 0
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 <Glitch*> glitches;