From 69e9ed62bbc899117550d7b9c888e71dd9ede0e2 Mon Sep 17 00:00:00 2001 From: Comment Date: Wed, 29 May 2013 09:52:49 +0100 Subject: nearly done --- notes.txt | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/testApp.cpp | 18 ++++++++++++++++-- src/testApp.h | 9 ++++++++- src/viewport.cpp | 37 +++++++++++++++++++++++-------------- src/viewport.h | 17 ++++++++++++----- 5 files changed, 115 insertions(+), 22 deletions(-) create mode 100755 notes.txt diff --git a/notes.txt b/notes.txt new file mode 100755 index 0000000..b825b8b --- /dev/null +++ b/notes.txt @@ -0,0 +1,56 @@ +basically - find a way of drawing based on something that will pick out the violins sounds clearly + +at times - draw repeated on each screen (in a variety of colours?) or draw across the lot + +have a way of altering the brushes etc + +have a fair amount of control - decay etc on a feedback engine - lifted from dunks maybe + +switch from 4/8 canvases to 1 + +have a way of doing stuff thats pretty simple/ stark - 4 vertical sound lines + +generate rhythm somehow that jumps between the screens - maybe the 'division trick' with randomised connections + +a little control panel + +how to draw? + +1, 4 or 8 screens mirroring the same (ish) thing - define coords in code + +slow changes - peridiodicity +ie scaling, colour changes - each window has a random number which interprets time/ colour change + +control - overall brightness + +start with dunks app as a template + +------------------------------------- +draw a number of viewports +pass the same parameters to each +they each interpret in a slightly different way + +the windows can vary in aspects - certain parameters are constrained to the dimensions (ie position of waveform drawing) and certain parameters aren't (shape of strokes). certain parameters can randomise + +where is the finale etc +a paletted noise function is a no-brainer - just draw random levels in the new colour - noise function has freq (+scale)? + +fadeout + + +make the palettes + +try to make freq affect phase to avoid glitching + +volume affect draw value + +phase offset for drawing +fade value +phase offset affect scroll angle + +onset randomise phase +retain palettes + +no fill option + +http://design-seeds.com/index.php/search \ No newline at end of file diff --git a/src/testApp.cpp b/src/testApp.cpp index 967d2d1..e9b8403 100755 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -88,7 +88,6 @@ void testApp::createports(int num){ //-------------------------------------------------------------- void testApp::setup(){ - windowsize=32; previewscale=5; showFPS=false; @@ -113,6 +112,9 @@ void testApp::setup(){ brightSlider=0; gui.add(bS.setup("brightness",brightSlider,0,255,255)); + fadeSlider=0; + gui.add(fS.setup("fade",fadeSlider,0,255,255)); + gui.add(create_1.setup("1")); create_1.addListener(this,&testApp::create1port); gui.add(create_2.setup("2")); @@ -127,8 +129,11 @@ void testApp::setup(){ gui.add(sF.setup("freq",slidFreq,0,1.0,255)); gui.add(wave.setup("wave", false)); + gui.add(fillwave.setup("wave fill", false)); slidThickness=1.0f; gui.add(sT.setup("thickness",slidThickness,0,10.0,255)); + slidWave=1.0f; + gui.add(sT.setup("amplitude",slidWave,0,4.0,255)); /* gui.setup("","panel.xml",0,0); @@ -167,7 +172,7 @@ void testApp::setup(){ soundStream.listDevices(); //if you want to set a different device id - //soundStream.setDeviceID(0); //bear in mind the device id corresponds to all audio devices, including input-only and output-only devices. + //soundStream.setDeviceID(4); //bear in mind the device id corresponds to all audio devices, including input-only and output-only devices. @@ -218,6 +223,9 @@ void testApp::update(){ control.freq=slidFreq; control.wave=wave; control.thickness=slidThickness; + control.fillwave=fillwave; + control.waveheight=slidWave; + control.fade=(uint8_t)fadeSlider; } //-------------------------------------------------------------- @@ -256,6 +264,12 @@ void testApp::keyPressed(int key){ if(key == OF_KEY_DOWN){ control.yshift++; } + if(key == OF_KEY_LEFT){ + control.xshift--; + } + if(key == OF_KEY_RIGHT){ + control.xshift++; + } } diff --git a/src/testApp.h b/src/testApp.h index 3148eb2..780bdc2 100755 --- a/src/testApp.h +++ b/src/testApp.h @@ -63,16 +63,23 @@ class testApp : public ofxFensterListener { ofxIntSlider bS; ofxParameter brightSlider; + ofxIntSlider fS; + ofxParameter fadeSlider; + ofxToggle fill; ofxFloatSlider sF; ofxParameter slidFreq; ofxToggle wave; + ofxToggle fillwave; ofxFloatSlider sT; ofxParameter slidThickness; + ofxFloatSlider sW; + ofxParameter slidWave; + void create1port(bool & pressed); void create2port(bool & pressed); @@ -82,7 +89,7 @@ class testApp : public ofxFensterListener { vector viewports; vpcontrol control; - int windowsize,previewscale; + int previewscale; // diff --git a/src/viewport.cpp b/src/viewport.cpp index c660ede..5a246e0 100755 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -13,11 +13,13 @@ viewport::viewport(int _w,int _h,int _ox,int _oy,int _num) { void viewport::setup(int _w,int _h,int _ox,int _oy,int _num) { w=_w; h=_h; + bw=w*oversample; + bh=h*oversample; ox=_ox; oy=_oy; num=_num; - rb1.allocate(w,h,GL_RGB); - rb2.allocate(w,h,GL_RGB); + rb1.allocate(bw,bh,GL_RGB); + rb2.allocate(bw,bh,GL_RGB); seed=ofRandom(1.0f); } @@ -27,17 +29,24 @@ void viewport::drawport(vpcontrol &control){ //can be done with texture offset? - int startx=((w-(w*control.fscale))/2)+control.xshift; - while (startx>0) startx-=(w*control.fscale); - int starty=((h-(h*control.fscale))/2)+control.yshift; - while (starty>0) starty-=(h*control.fscale); + int startx=((bw-(bw*control.fscale))/2)+control.xshift; + while (startx>0) startx-=(bw*control.fscale); + int starty=((bh-(bh*control.fscale))/2)+control.yshift; + while (starty>0) starty-=(bh*control.fscale); - for (int i=startx;i0){ + ofEnableAlphaBlending(); + ofSetColor(0,0,0,control.fade); + ofRect(0,0,bw,bh); + ofDisableAlphaBlending(); + } + //do whatever with feedback //set draw colour from palette @@ -51,7 +60,7 @@ void viewport::drawport(vpcontrol &control){ } if (control.fill){ - ofRect(0,0,w,h); + ofRect(0,0,bw,bh); } ofSetLineWidth(3); //control.thickness); @@ -59,15 +68,15 @@ void viewport::drawport(vpcontrol &control){ if(control.wave){ if (h>w){ ofBeginShape(); - for (int i = 0; i < h; i++){ - ofVertex((w/2) -(control.right[i+(num*h)]*w),i); + for (int i = 0; i < bh; i++){ + ofVertex((bw/2) -(control.right[i+(num*bh)]*bw),i); } ofEndShape(false); } else { ofBeginShape(); - for (int i = 0; i < w; i++){ - ofVertex(i, (h/2) -(control.right[i+(num*w)]*h) ); + for (int i = 0; i < bw; i++){ + ofVertex(i, (bh/2) -(control.right[i+(num*bw)]*bh) ); } ofEndShape(false); } diff --git a/src/viewport.h b/src/viewport.h index b786fe9..1e3e8a8 100755 --- a/src/viewport.h +++ b/src/viewport.h @@ -4,8 +4,11 @@ #include "ofMain.h" #include "ofxXmlSettings.h" -static int bufferSize = 1024; -static int bufferscale = 4; +static int bufferSize = 2048; +static int oversample = 8; +static int windowsize = 32; + +//make sure that windowsize*oversample*8 <= buffersize class palette { public: @@ -71,7 +74,10 @@ class vpcontrol { yshift=0; fscale=1.0f; wave=false; + fillwave=false; thickness=1.0f; + waveheight=1.0f; + fade=0; left.assign(bufferSize, 0.0); right.assign(bufferSize, 0.0); @@ -99,8 +105,9 @@ class vpcontrol { float freq; int xshift,yshift; float fscale,scale; - bool wave; - float thickness; + bool wave,fillwave; + float thickness,waveheight; + uint8_t fade; vector left; vector right; @@ -126,7 +133,7 @@ class viewport palette Palette; protected: private: - int x,y,w,h,ox,oy,num; + int x,y,w,h,bw,bh,ox,oy,num; float seed; }; -- cgit v1.2.3