From caa1426e767efdba526c1d2df0b61aafbd6fcca7 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 28 Feb 2014 10:28:30 +0000 Subject: progressing glitchy transform --- glitcher/src/audioGlitcher.h | 39 +++++++++++++++++++++++++-------------- glitcher/src/ofApp.cpp | 4 ++-- glitcher/src/ofApp.h | 2 +- 3 files changed, 28 insertions(+), 17 deletions(-) (limited to 'glitcher') diff --git a/glitcher/src/audioGlitcher.h b/glitcher/src/audioGlitcher.h index 8f48288..caa4028 100644 --- a/glitcher/src/audioGlitcher.h +++ b/glitcher/src/audioGlitcher.h @@ -22,10 +22,10 @@ class audioGlitcher { samples=s; origin_x=origin_y=0.5f; trans_x=trans_y=0.0f; - scale=1.0f; + scale=0.9f; rotation=0.0f; interp_x=16; - interp_y=12; + interp_y=9; } void set_interp(int ix,int iy){ interp_x=ix; @@ -57,8 +57,8 @@ class audioGlitcher { cv::Mat srcX(interp_x,interp_y,CV_32FC1); cv::Mat srcY(interp_x,interp_y,CV_32FC1); - float xFactor=renderFBO.getWidth()/srcX.cols; - float yFactor=renderFBO.getHeight()/srcX.rows; + float xFactor=(renderFBO.getWidth()-1)/(srcX.cols-1); + float yFactor=(renderFBO.getHeight()-1)/(srcX.rows-1); for (int i=0;i(j,i)=i*xFactor; @@ -66,9 +66,19 @@ class audioGlitcher { } } + //render =512x384 + //interp = 16x12 + //xFactor=34.133333 yFactor=34.90909 + + // srcX.at (11,15)=480 + // srcY.at (11,15)=352 + + // ==it is an effect caused by the pixels being computed at the centres + // but finally being interpolated to the edges + //transform the low res matrix - float tX=trans_x-.05; //fraction of image - float tY=trans_y-.04; //fraction of image + float tX=trans_x; //-.05; //fraction of image + float tY=trans_y; //-.04; //fraction of image float oX=origin_x; //fraction of image float oY=origin_y; //fraction of image float s=scale; @@ -141,15 +151,9 @@ class audioGlitcher { //ofRect(0,0,ofGetWidth(),ofGetHeight()); //ofDisableAlphaBlending(); - if (false){ - ofNoFill(); - ofPushMatrix(); - ofTranslate(renderFBO.getWidth()/2,renderFBO.getHeight()/2); - ofRect(-20,-20,40,40); - ofPopMatrix(); - } + bool useAudio=false; - if (true) { + if (useAudio) { ofPushMatrix(); ofTranslate(0,renderFBO.getHeight()/2); @@ -172,6 +176,13 @@ class audioGlitcher { ofPopMatrix(); } + else { + ofNoFill(); + ofPushMatrix(); + ofTranslate(renderFBO.getWidth()/2,renderFBO.getHeight()/2); + ofRect(-20,-20,40,40); + ofPopMatrix(); + } renderFBO.end(); //renderFBO.flagImageChanged(); diff --git a/glitcher/src/ofApp.cpp b/glitcher/src/ofApp.cpp index ec97933..a8937b7 100644 --- a/glitcher/src/ofApp.cpp +++ b/glitcher/src/ofApp.cpp @@ -9,9 +9,9 @@ void ofApp::setup() { int bufferSize= ofGetWidth(); //should be based on the size of glitch buffer - soundStream.listDevices(); + //soundStream.listDevices(); //nb all you have to do to make audio work is to turn off pulseaudio in configuration - soundStream.setup(this, 0, 1, 44100, bufferSize, 1); + //soundStream.setup(this, 0, 1, 44100, bufferSize, 1); samples.resize(bufferSize); glitch.setup(ofGetWidth(),ofGetHeight(),&samples); diff --git a/glitcher/src/ofApp.h b/glitcher/src/ofApp.h index beaceaf..4767d0f 100644 --- a/glitcher/src/ofApp.h +++ b/glitcher/src/ofApp.h @@ -23,7 +23,7 @@ public: audioGlitcher glitch; - ofSoundStream soundStream; + //ofSoundStream soundStream; vector samples; int frame; -- cgit v1.2.3