├── WAAAVE_POOL_4_5 ├── addons.make ├── bin │ ├── WAAAVE_POOL_4_5 │ └── data │ │ └── shadersES2 │ │ ├── shaderSharpen.vert │ │ ├── shader_mixer.vert │ │ ├── shaderSharpen.frag │ │ └── shader_mixer.frag ├── obj │ └── linuxarmv6l │ │ └── Release │ │ └── src │ │ ├── main.o │ │ └── ofApp.o ├── Makefile ├── src │ ├── main.cpp │ ├── ofApp.h │ └── ofApp.cpp └── config.make ├── WAAVE_POOOL_MAIN ├── addons.make ├── bin │ ├── AUTO_WAAAVE_4 │ ├── WAAAVE_POOL_4 │ ├── WAAVE_POOOL_MAIN │ └── data │ │ └── shadersES2 │ │ ├── shader_blur.frag │ │ ├── shader_blur.vert │ │ ├── shader_mixer.vert │ │ └── shader_mixer.frag ├── obj │ └── linuxarmv6l │ │ └── Release │ │ └── src │ │ ├── main.o │ │ └── ofApp.o ├── Makefile ├── src │ ├── main.cpp │ ├── ofApp.h │ └── ofApp.cpp └── config.make ├── Waaaves113.nktrl_set ├── wp_nanokontrol_guide.jpg ├── waaave_pool_setup.nktrl2_data ├── desktop_files_for_waaavepool_distro ├── useful command line etc ├── disable_splash ├── picapture_sd_instructions └── change_resolution └── README.md /WAAAVE_POOL_4_5/addons.make: -------------------------------------------------------------------------------- 1 | ofxMidi 2 | 3 | 4 | -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/addons.make: -------------------------------------------------------------------------------- 1 | ofxMidi 2 | ofxOMXCamera 3 | 4 | -------------------------------------------------------------------------------- /Waaaves113.nktrl_set: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ex-zee-ex/waaaave_pool/HEAD/Waaaves113.nktrl_set -------------------------------------------------------------------------------- /wp_nanokontrol_guide.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ex-zee-ex/waaaave_pool/HEAD/wp_nanokontrol_guide.jpg -------------------------------------------------------------------------------- /waaave_pool_setup.nktrl2_data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ex-zee-ex/waaaave_pool/HEAD/waaave_pool_setup.nktrl2_data -------------------------------------------------------------------------------- /WAAAVE_POOL_4_5/bin/WAAAVE_POOL_4_5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ex-zee-ex/waaaave_pool/HEAD/WAAAVE_POOL_4_5/bin/WAAAVE_POOL_4_5 -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/bin/AUTO_WAAAVE_4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ex-zee-ex/waaaave_pool/HEAD/WAAVE_POOOL_MAIN/bin/AUTO_WAAAVE_4 -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/bin/WAAAVE_POOL_4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ex-zee-ex/waaaave_pool/HEAD/WAAVE_POOOL_MAIN/bin/WAAAVE_POOL_4 -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/bin/WAAVE_POOOL_MAIN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ex-zee-ex/waaaave_pool/HEAD/WAAVE_POOOL_MAIN/bin/WAAVE_POOOL_MAIN -------------------------------------------------------------------------------- /desktop_files_for_waaavepool_distro/useful command line etc: -------------------------------------------------------------------------------- 1 | useful command line 2 | gksudo pcmanfm :: for superuser mouse manipulation of directories 3 | -------------------------------------------------------------------------------- /WAAAVE_POOL_4_5/obj/linuxarmv6l/Release/src/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ex-zee-ex/waaaave_pool/HEAD/WAAAVE_POOL_4_5/obj/linuxarmv6l/Release/src/main.o -------------------------------------------------------------------------------- /WAAAVE_POOL_4_5/obj/linuxarmv6l/Release/src/ofApp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ex-zee-ex/waaaave_pool/HEAD/WAAAVE_POOL_4_5/obj/linuxarmv6l/Release/src/ofApp.o -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/obj/linuxarmv6l/Release/src/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ex-zee-ex/waaaave_pool/HEAD/WAAVE_POOOL_MAIN/obj/linuxarmv6l/Release/src/main.o -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/obj/linuxarmv6l/Release/src/ofApp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ex-zee-ex/waaaave_pool/HEAD/WAAVE_POOOL_MAIN/obj/linuxarmv6l/Release/src/ofApp.o -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/bin/data/shadersES2/shader_blur.frag: -------------------------------------------------------------------------------- 1 | precision highp float; 2 | 3 | 4 | uniform sampler2D tex0; 5 | 6 | varying vec2 texCoordVarying; 7 | 8 | void main() 9 | { 10 | vec4 color_blur=vec4(0.0); 11 | 12 | color_blur=texture2D(tex0,texCoordVarying); 13 | 14 | gl_FragColor = color_blur; 15 | } 16 | -------------------------------------------------------------------------------- /WAAAVE_POOL_4_5/bin/data/shadersES2/shaderSharpen.vert: -------------------------------------------------------------------------------- 1 | 2 | // these are for the programmable pipeline system 3 | uniform mat4 modelViewProjectionMatrix; 4 | 5 | attribute vec4 position; 6 | attribute vec2 texcoord; 7 | 8 | varying vec2 texCoordVarying; 9 | 10 | void main() 11 | { 12 | texCoordVarying = texcoord; 13 | gl_Position = modelViewProjectionMatrix * position; 14 | } -------------------------------------------------------------------------------- /WAAAVE_POOL_4_5/bin/data/shadersES2/shader_mixer.vert: -------------------------------------------------------------------------------- 1 | 2 | // these are for the programmable pipeline system 3 | uniform mat4 modelViewProjectionMatrix; 4 | 5 | attribute vec4 position; 6 | attribute vec2 texcoord; 7 | 8 | varying vec2 texCoordVarying; 9 | 10 | void main() 11 | { 12 | texCoordVarying = texcoord; 13 | gl_Position = modelViewProjectionMatrix * position; 14 | } -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/bin/data/shadersES2/shader_blur.vert: -------------------------------------------------------------------------------- 1 | 2 | // these are for the programmable pipeline system 3 | uniform mat4 modelViewProjectionMatrix; 4 | 5 | attribute vec4 position; 6 | attribute vec2 texcoord; 7 | 8 | varying vec2 texCoordVarying; 9 | 10 | void main() 11 | { 12 | texCoordVarying = texcoord; 13 | gl_Position = modelViewProjectionMatrix * position; 14 | } -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/bin/data/shadersES2/shader_mixer.vert: -------------------------------------------------------------------------------- 1 | 2 | // these are for the programmable pipeline system 3 | uniform mat4 modelViewProjectionMatrix; 4 | 5 | attribute vec4 position; 6 | attribute vec2 texcoord; 7 | 8 | varying vec2 texCoordVarying; 9 | 10 | void main() 11 | { 12 | texCoordVarying = texcoord; 13 | gl_Position = modelViewProjectionMatrix * position; 14 | } -------------------------------------------------------------------------------- /WAAAVE_POOL_4_5/Makefile: -------------------------------------------------------------------------------- 1 | # Attempt to load a config.make file. 2 | # If none is found, project defaults in config.project.make will be used. 3 | ifneq ($(wildcard config.make),) 4 | include config.make 5 | endif 6 | 7 | # make sure the the OF_ROOT location is defined 8 | ifndef OF_ROOT 9 | OF_ROOT=$(realpath ../../..) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/Makefile: -------------------------------------------------------------------------------- 1 | # Attempt to load a config.make file. 2 | # If none is found, project defaults in config.project.make will be used. 3 | ifneq ($(wildcard config.make),) 4 | include config.make 5 | endif 6 | 7 | # make sure the the OF_ROOT location is defined 8 | ifndef OF_ROOT 9 | OF_ROOT=$(realpath ../../..) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /desktop_files_for_waaavepool_distro/disable_splash: -------------------------------------------------------------------------------- 1 | how to disable splash screen. 2 | 1.open a terminal and esc out of the auto running waaave pool. 3 | 2.enter 'gksudo pcmanfm' to open up a file manager window with 4 | priveleges. 5 | 3. navigate to /usr/share/plymouth/themes/pix 6 | 4. rename 'splash.png' to something else like 'splash0.png' 7 | 5. rename 'black.png' to 'splash.png' 8 | 6. ok now restart and double check that it worked! 9 | I find the splash screen to be useful for troubleshooting and for 10 | diagnostics but understand that its not preferable for if one 11 | needs to restart their system during a live show! 12 | -------------------------------------------------------------------------------- /WAAAVE_POOL_4_5/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Dan Wilcox 3 | * 4 | * BSD Simplified License. 5 | * For information on usage and redistribution, and for a DISCLAIMER OF ALL 6 | * WARRANTIES, see the file, "LICENSE.txt," in this distribution. 7 | * 8 | * See https://github.com/danomatika/ofxMidi for documentation 9 | * 10 | */ 11 | #include "ofMain.h" 12 | #include "ofApp.h" 13 | 14 | int main(){ 15 | //ofGLWindowSettings settings; 16 | //settings.setGLVersion(3,2); 17 | 18 | 19 | ofGLESWindowSettings settings; 20 | settings.glesVersion=2; 21 | 22 | //here is where you change output resolutions 23 | 24 | //CEA mode 2 25 | settings.setSize(720,480); 26 | 27 | //CEA mode 4 28 | //settings.setSize(1280,720); 29 | 30 | //CEA mode 16 31 | //settings.setSize(1920,1080); 32 | 33 | 34 | ofCreateWindow(settings); 35 | 36 | // this kicks off the running of my app 37 | // can be OF_WINDOW or OF_FULLSCREEN 38 | // pass in width and height too: 39 | ofRunApp(new ofApp()); 40 | } 41 | -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Dan Wilcox 3 | * 4 | * BSD Simplified License. 5 | * For information on usage and redistribution, and for a DISCLAIMER OF ALL 6 | * WARRANTIES, see the file, "LICENSE.txt," in this distribution. 7 | * 8 | * See https://github.com/danomatika/ofxMidi for documentation 9 | * 10 | */ 11 | #include "ofMain.h" 12 | #include "ofApp.h" 13 | 14 | int main(){ 15 | //ofGLWindowSettings settings; 16 | //settings.setGLVersion(3,2); 17 | 18 | 19 | ofGLESWindowSettings settings; 20 | settings.glesVersion=2; 21 | 22 | //here is where you change output resolutions 23 | 24 | //CEA mode 2 25 | settings.setSize(720,480); 26 | 27 | //CEA mode 4 28 | //settings.setSize(1280,720); 29 | 30 | //CEA mode 16 31 | //settings.setSize(1920,1080); 32 | 33 | 34 | ofCreateWindow(settings); 35 | 36 | // this kicks off the running of my app 37 | // can be OF_WINDOW or OF_FULLSCREEN 38 | // pass in width and height too: 39 | ofRunApp(new ofApp()); 40 | } 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # waaaave_pool 2 | 3 | ![Image description](https://github.com/ex-zee-ex/pictures/blob/master/waaavepool_splashscreen_final.png) 4 | 5 | a port of video_waaaves to raspberry pi 6 | the larger desktop versions can be found here: 7 | full sized 8 | https://github.com/ex-zee-ex/VIDEO_WAAAVES_1_75, 9 | 10 | for full image installs check out 11 | https://andreijaycreativecoding.com/VSERPI-hardware-and-images 12 | for manual and midi info 13 | https://andreijaycreativecoding.com/Waaave_Pool-manual 14 | 15 | If yr not familiar with running oF on rpis and or makefiles then I'd recommend looking at https://openframeworks.cc/setup/raspberrypi/ and trying some stuff out before jumping directly into this 16 | 17 | 18 | to 3d print a 1.5u panel for rack mounting yr waaaave pool/sm/phosphorm (designed by nathan thompson) 19 | https://www.thingiverse.com/thing:4391023?fbclid=IwAR246w78AGM9WanoIb56zfWSBCQiwyNJMsAF5kNhfARwdnjmUvZeB-ONPbY 20 | 21 | 22 | join the video_waaaves fb group to keep up to date on this and other softwares and hardwares that i make! 23 | https://www.facebook.com/groups/440566853501750 24 | -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/src/ofApp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Dan Wilcox 3 | * 4 | * BSD Simplified License. 5 | * For information on usage and redistribution, and for a DISCLAIMER OF ALL 6 | * WARRANTIES, see the file, "LICENSE.txt," in this distribution. 7 | * 8 | * See https://github.com/danomatika/ofxMidi for documentation 9 | * 10 | */ 11 | #pragma once 12 | 13 | #include "ofMain.h" 14 | #include "ofxMidi.h" 15 | #include "ofxOMXVideoGrabber.h" 16 | 17 | 18 | class ofApp : public ofBaseApp, public ofxMidiListener { 19 | 20 | public: 21 | 22 | void setup(); 23 | void update(); 24 | void draw(); 25 | void exit(); 26 | 27 | void keyPressed(int key); 28 | void keyReleased(int key); 29 | 30 | void mouseMoved(int x, int y ); 31 | void mouseDragged(int x, int y, int button); 32 | void mousePressed(int x, int y, int button); 33 | void mouseReleased(); 34 | 35 | void omx_settings(); 36 | 37 | void omx_updates(); 38 | 39 | void midibiz(); 40 | 41 | void newMidiMessage(ofxMidiMessage& eventArgs); 42 | 43 | ofxMidiIn midiIn; 44 | std::vector midiMessages; 45 | std::size_t maxMessages = 10; //< max number of messages to keep track of 46 | 47 | 48 | 49 | 50 | ofShader shader_mixer; 51 | 52 | 53 | 54 | ofFbo framebuffer0; 55 | ofFbo dry_framebuffer; 56 | 57 | 58 | ofVideoGrabber cam1; 59 | 60 | ofxOMXCameraSettings settings; 61 | ofxOMXVideoGrabber videoGrabber; 62 | 63 | 64 | 65 | }; 66 | -------------------------------------------------------------------------------- /WAAAVE_POOL_4_5/src/ofApp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Dan Wilcox 3 | * 4 | * BSD Simplified License. 5 | * For information on usage and redistribution, and for a DISCLAIMER OF ALL 6 | * WARRANTIES, see the file, "LICENSE.txt," in this distribution. 7 | * 8 | * See https://github.com/danomatika/ofxMidi for documentation 9 | * 10 | */ 11 | #pragma once 12 | 13 | #include "ofMain.h" 14 | #include "ofxMidi.h" 15 | //#include "ofxOMXVideoGrabber.h" 16 | 17 | 18 | class ofApp : public ofBaseApp, public ofxMidiListener { 19 | 20 | public: 21 | 22 | void setup(); 23 | void update(); 24 | void draw(); 25 | void exit(); 26 | 27 | void keyPressed(int key); 28 | void keyReleased(int key); 29 | 30 | void cameraSetup(int w, int h); 31 | void cameraUpdate(); 32 | 33 | //personal procedures 34 | void allocateFbo(int w, int h);//declare and allocate 35 | void clearFbo();//clear all fbo 36 | 37 | void p_lockClear(); 38 | void p_lockUpdate(); 39 | /* 40 | void omx_settings(); 41 | void omx_updates(); 42 | ofxOMXCameraSettings settings; 43 | ofxOMXVideoGrabber videoGrabber; 44 | */ 45 | void midiSetup(); 46 | void midibiz(); 47 | 48 | void newMidiMessage(ofxMidiMessage& eventArgs); 49 | 50 | ofxMidiIn midiIn; 51 | std::vector midiMessages; 52 | std::size_t maxMessages = 10; //< max number of messages to keep track of 53 | 54 | 55 | 56 | 57 | ofShader shader_mixer; 58 | ofShader shaderSharpen; 59 | 60 | 61 | ofFbo framebuffer0; 62 | ofFbo dry_framebuffer; 63 | ofFbo sharpenFramebuffer; 64 | 65 | 66 | ofVideoGrabber cam1; 67 | 68 | 69 | 70 | 71 | 72 | }; 73 | -------------------------------------------------------------------------------- /desktop_files_for_waaavepool_distro/picapture_sd_instructions: -------------------------------------------------------------------------------- 1 | how to change from usb (default setting of this and all the 2 | waaave pool distro firmwares) to picapture sd inputs 3 | 4 | 1.click on the folder icon at the top left of the 5 | screen and navigate to 6 | pi/openFrameworks/apps/myApps/WAAAVE_POOL_MAIN/src/ofApp.cpp 7 | double click on it, it will open up in this text editor. 8 | scroll down a tiny bit and you will see the lines 9 | 10 | //0 is picaputre, 1 is usbinput 11 | bool inputswitch=0; 12 | 13 | change the number 0 to the number 1 so it looks like 14 | 15 | //0 is picaputre, 1 is usbinput 16 | bool inputswitch=1; 17 | 18 | hit ctrl-s on your keyboard and then in the folder navigator hit the up arrow twice and then 19 | right click on WAAAVE_POOL_MAIN and select 'open in terminal' 20 | once it is opened in terminal enter 'make' and hit enter 21 | a bunch of text should scroll for about 1 minute and then you will see 22 | 23 | 24 | make[2]: Leaving directory '/home/pi/openFrameworks/apps/myApps/WAAVE_POOOL_MAIN' 25 | make[1]: Leaving directory '/home/pi/openFrameworks/apps/myApps/WAAVE_POOOL_MAIN' 26 | pi@raspberrypi:~/openFrameworks/apps/myApps/WAAVE_POOOL_MAIN $ 27 | 28 | type 'reboot', hit enter and the waaave pool should start up again with the picapture sd 29 | enabled by default. note that you will need to have a video source coming in to 30 | the capture card in order for the waaave pool to start up correctly. you will 31 | know that a source is detected if there is a tiny blue led lit 32 | up adjacent to the s-video port. 33 | 34 | to switch back to usb input simple repeat the above steps and plug 35 | edit the line to say 36 | 37 | //0 is picaputre, 1 is usbinput 38 | bool inputswitch=0; 39 | 40 | once again. 41 | 42 | 43 | *note* the script i'm using to auto run the waaave_pool code 44 | on start up has a side effect where like it'll auto run when 45 | like terminals and other kinds of files are opend. all you need 46 | to do is hit escape whenever this happens and continue on with 47 | the instructions. modifying this script is kind of for 48 | medium advanced folks, if interested do a search on '.bashrc 49 | auto run raspbian' and you'll see what i did. 50 | -------------------------------------------------------------------------------- /WAAAVE_POOL_4_5/bin/data/shadersES2/shaderSharpen.frag: -------------------------------------------------------------------------------- 1 | precision highp float; 2 | 3 | uniform sampler2D tex0; 4 | 5 | uniform float sharpenAmount; 6 | uniform float vSharpenAmount; 7 | varying vec2 texCoordVarying; 8 | 9 | //------------------------- 10 | vec3 rgb2hsb(in vec3 c) 11 | { 12 | vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 13 | vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); 14 | vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); 15 | 16 | float d = q.x - min(q.w, q.y); 17 | float e = 1.0e-10; 18 | return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); 19 | } 20 | //--------------------------- 21 | vec3 hsb2rgb(in vec3 c) 22 | { 23 | vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); 24 | vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); 25 | return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); 26 | } 27 | //------------------------- 28 | void main() 29 | { 30 | vec4 outColor=vec4(1.0,0.0,1.0,1.0); 31 | //first we try to just sharpen brightness 32 | 33 | 34 | float colorSharpenBright=0.0; 35 | float X=2.0*.0015625; 36 | float Y=2.0*.0020833; 37 | 38 | //colorSharpenBright=rbg2hsb(texture2D(tex0, texCoordVarying+vec2(X,0.0))).z; 39 | 40 | colorSharpenBright = //rgb2hsb(texture2D(tex0, texCoordVarying+vec2(X,0.0)).rgb).z + 41 | //rgb2hsb(texture2D(tex0, texCoordVarying+vec2(-X,0.0)).rgb).z + 42 | rgb2hsb(texture2D(tex0, texCoordVarying+vec2(X,Y)).rgb).z + 43 | rgb2hsb(texture2D(tex0, texCoordVarying+vec2(-X,Y)).rgb).z + 44 | rgb2hsb(texture2D(tex0, texCoordVarying+vec2(-X,-Y)).rgb).z + 45 | rgb2hsb(texture2D(tex0, texCoordVarying+vec2(X,-Y)).rgb).z; 46 | //rgb2hsb(texture2D(tex0, texCoordVarying+vec2(0.0,-Y)).rgb).z + 47 | //rgb2hsb(texture2D(tex0, texCoordVarying+vec2(.0,Y)).rgb).z; 48 | 49 | colorSharpenBright=colorSharpenBright*.125; 50 | 51 | vec4 ogColor=texture2D(tex0,texCoordVarying); 52 | vec3 ogColorHSB=rgb2hsb(ogColor.rgb); 53 | 54 | float VVV=ogColorHSB.z; 55 | 56 | ogColorHSB.z-=sharpenAmount*colorSharpenBright+(colorSharpenBright*vSharpenAmount*VVV); 57 | 58 | //got to boost that bb 59 | if(sharpenAmount>0.0){ 60 | ogColorHSB.z*=(1.0+sharpenAmount*.45+.45*(vSharpenAmount*VVV)); 61 | ogColorHSB.y*=(1.0+sharpenAmount*.25+.25*(vSharpenAmount*VVV)); 62 | } 63 | 64 | outColor.rgb=hsb2rgb(ogColorHSB); 65 | outColor.a=1.0; 66 | //color.rgb=1.0-color.rgb; 67 | gl_FragColor = outColor;//texture2D(tex0,texCoordVarying); 68 | } 69 | -------------------------------------------------------------------------------- /desktop_files_for_waaavepool_distro/change_resolution: -------------------------------------------------------------------------------- 1 | so there are a couple of steps to trying out the different 2 | output resolutions! this is an experimental mode and i am 3 | not planning on making seperate images for this as of 4 | quite yet. 5 | 6 | *note* the script i'm using to auto run the waaave_pool code 7 | on start up has a side effect where like it'll auto run when 8 | like terminals and other kinds of files are opend. all you need 9 | to do is hit escape whenever this happens and continue on with 10 | the instructions. modifying this script is kind of for 11 | medium advanced folks, if interested do a search on '.bashrc 12 | auto run raspbian' and you'll see what i did. 13 | 14 | 1. first click on the raspberry in the upper left corner 15 | (or hit window key on keyboard) and navigate to 16 | preferences->raspberry pi configuration, then 17 | click/tab over to "set resolution". default mode 18 | is 19 | "CEA Mode 2" which is 480p 20 | the other possible resolutions you can try will be 21 | "CEA Mode 4" 720p 22 | and 23 | "CEA Mode 16" 1080p 24 | 25 | 2. hit ok on the one you want to try, and then ok 26 | on the preferences pane. it will ask if you would like 27 | to reboot now, say no 28 | 29 | 3. next click on the folder icon at the top left of the 30 | screen and navigate to 31 | pi/openFrameworks/apps/myApps/WAAAVE_POOL_MAIN/src/main.cpp 32 | double click on this and it will open up next to these instructions 33 | 34 | 4. scroll down a tiny bit and you will see this 35 | 36 | //CEA mode 2 37 | settings.setSize(720,480); 38 | 39 | //CEA mode 4 40 | //settings.setSize(1280,720); 41 | 42 | //CEA mode 16 43 | //settings.setSize(1920,1080); 44 | 45 | in this context '//' is referred to as commenting out, this 46 | is an instruction to the compiler to ignore any lines of 47 | text following the //. what you will need to do is 48 | make sure to comment out any CEA mode you are not using 49 | and to uncomment (delete the '//') the line under the CEA 50 | mode you are using. for example if i am trying out CEA 51 | mode 4 720p then it should look like this 52 | 53 | //CEA mode 2 54 | //settings.setSize(720,480); 55 | 56 | //CEA mode 4 57 | settings.setSize(1280,720); 58 | 59 | //CEA mode 16 60 | //settings.setSize(1920,1080); 61 | 62 | once you have finished this, hit ctrl-s on your keyboard and close 63 | main.cpp 64 | 65 | 5. in the folder navigator hit the up arrow twice and then 66 | right click on WAAAVE_POOL_MAIN and select 'open in terminal' 67 | once it is opened in terminal enter 'make' and hit enter 68 | a bunch of text should scroll for about 1 minute and then you will see 69 | 70 | 71 | make[2]: Leaving directory '/home/pi/openFrameworks/apps/myApps/WAAVE_POOOL_MAIN' 72 | make[1]: Leaving directory '/home/pi/openFrameworks/apps/myApps/WAAVE_POOOL_MAIN' 73 | pi@raspberrypi:~/openFrameworks/apps/myApps/WAAVE_POOOL_MAIN $ 74 | 75 | type 'reboot', hit enter and the waaave pool should start up again with the new 76 | resolution. note that resolutions larger than 480p will result 77 | in framerates lower than 30fps. this should not affect composite 78 | video modes at all. 79 | -------------------------------------------------------------------------------- /WAAAVE_POOL_4_5/config.make: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # CONFIGURE PROJECT MAKEFILE (optional) 3 | # This file is where we make project specific configurations. 4 | ################################################################################ 5 | 6 | ################################################################################ 7 | # OF ROOT 8 | # The location of your root openFrameworks installation 9 | # (default) OF_ROOT = ../../.. 10 | ################################################################################ 11 | # OF_ROOT = ../../.. 12 | 13 | ################################################################################ 14 | # PROJECT ROOT 15 | # The location of the project - a starting place for searching for files 16 | # (default) PROJECT_ROOT = . (this directory) 17 | # 18 | ################################################################################ 19 | # PROJECT_ROOT = . 20 | 21 | ################################################################################ 22 | # PROJECT SPECIFIC CHECKS 23 | # This is a project defined section to create internal makefile flags to 24 | # conditionally enable or disable the addition of various features within 25 | # this makefile. For instance, if you want to make changes based on whether 26 | # GTK is installed, one might test that here and create a variable to check. 27 | ################################################################################ 28 | # None 29 | 30 | ################################################################################ 31 | # PROJECT EXTERNAL SOURCE PATHS 32 | # These are fully qualified paths that are not within the PROJECT_ROOT folder. 33 | # Like source folders in the PROJECT_ROOT, these paths are subject to 34 | # exlclusion via the PROJECT_EXLCUSIONS list. 35 | # 36 | # (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank) 37 | # 38 | # Note: Leave a leading space when adding list items with the += operator 39 | ################################################################################ 40 | # PROJECT_EXTERNAL_SOURCE_PATHS = 41 | 42 | ################################################################################ 43 | # PROJECT EXCLUSIONS 44 | # These makefiles assume that all folders in your current project directory 45 | # and any listed in the PROJECT_EXTERNAL_SOURCH_PATHS are are valid locations 46 | # to look for source code. The any folders or files that match any of the 47 | # items in the PROJECT_EXCLUSIONS list below will be ignored. 48 | # 49 | # Each item in the PROJECT_EXCLUSIONS list will be treated as a complete 50 | # string unless teh user adds a wildcard (%) operator to match subdirectories. 51 | # GNU make only allows one wildcard for matching. The second wildcard (%) is 52 | # treated literally. 53 | # 54 | # (default) PROJECT_EXCLUSIONS = (blank) 55 | # 56 | # Will automatically exclude the following: 57 | # 58 | # $(PROJECT_ROOT)/bin% 59 | # $(PROJECT_ROOT)/obj% 60 | # $(PROJECT_ROOT)/%.xcodeproj 61 | # 62 | # Note: Leave a leading space when adding list items with the += operator 63 | ################################################################################ 64 | # PROJECT_EXCLUSIONS = 65 | 66 | ################################################################################ 67 | # PROJECT LINKER FLAGS 68 | # These flags will be sent to the linker when compiling the executable. 69 | # 70 | # (default) PROJECT_LDFLAGS = -Wl,-rpath=./libs 71 | # 72 | # Note: Leave a leading space when adding list items with the += operator 73 | ################################################################################ 74 | 75 | # Currently, shared libraries that are needed are copied to the 76 | # $(PROJECT_ROOT)/bin/libs directory. The following LDFLAGS tell the linker to 77 | # add a runtime path to search for those shared libraries, since they aren't 78 | # incorporated directly into the final executable application binary. 79 | # TODO: should this be a default setting? 80 | # PROJECT_LDFLAGS=-Wl,-rpath=./libs 81 | 82 | ################################################################################ 83 | # PROJECT DEFINES 84 | # Create a space-delimited list of DEFINES. The list will be converted into 85 | # CFLAGS with the "-D" flag later in the makefile. 86 | # 87 | # (default) PROJECT_DEFINES = (blank) 88 | # 89 | # Note: Leave a leading space when adding list items with the += operator 90 | ################################################################################ 91 | # PROJECT_DEFINES = 92 | 93 | ################################################################################ 94 | # PROJECT CFLAGS 95 | # This is a list of fully qualified CFLAGS required when compiling for this 96 | # project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS 97 | # defined in your platform specific core configuration files. These flags are 98 | # presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below. 99 | # 100 | # (default) PROJECT_CFLAGS = (blank) 101 | # 102 | # Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in 103 | # your platform specific configuration file will be applied by default and 104 | # further flags here may not be needed. 105 | # 106 | # Note: Leave a leading space when adding list items with the += operator 107 | ################################################################################ 108 | # PROJECT_CFLAGS = 109 | 110 | ################################################################################ 111 | # PROJECT OPTIMIZATION CFLAGS 112 | # These are lists of CFLAGS that are target-specific. While any flags could 113 | # be conditionally added, they are usually limited to optimization flags. 114 | # These flags are added BEFORE the PROJECT_CFLAGS. 115 | # 116 | # PROJECT_OPTIMIZATION_CFLAGS_RELEASE flags are only applied to RELEASE targets. 117 | # 118 | # (default) PROJECT_OPTIMIZATION_CFLAGS_RELEASE = (blank) 119 | # 120 | # PROJECT_OPTIMIZATION_CFLAGS_DEBUG flags are only applied to DEBUG targets. 121 | # 122 | # (default) PROJECT_OPTIMIZATION_CFLAGS_DEBUG = (blank) 123 | # 124 | # Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the 125 | # PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration 126 | # file will be applied by default and further optimization flags here may not 127 | # be needed. 128 | # 129 | # Note: Leave a leading space when adding list items with the += operator 130 | ################################################################################ 131 | # PROJECT_OPTIMIZATION_CFLAGS_RELEASE = 132 | # PROJECT_OPTIMIZATION_CFLAGS_DEBUG = 133 | 134 | ################################################################################ 135 | # PROJECT COMPILERS 136 | # Custom compilers can be set for CC and CXX 137 | # (default) PROJECT_CXX = (blank) 138 | # (default) PROJECT_CC = (blank) 139 | # Note: Leave a leading space when adding list items with the += operator 140 | ################################################################################ 141 | # PROJECT_CXX = 142 | # PROJECT_CC = 143 | -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/config.make: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # CONFIGURE PROJECT MAKEFILE (optional) 3 | # This file is where we make project specific configurations. 4 | ################################################################################ 5 | 6 | ################################################################################ 7 | # OF ROOT 8 | # The location of your root openFrameworks installation 9 | # (default) OF_ROOT = ../../.. 10 | ################################################################################ 11 | # OF_ROOT = ../../.. 12 | 13 | ################################################################################ 14 | # PROJECT ROOT 15 | # The location of the project - a starting place for searching for files 16 | # (default) PROJECT_ROOT = . (this directory) 17 | # 18 | ################################################################################ 19 | # PROJECT_ROOT = . 20 | 21 | ################################################################################ 22 | # PROJECT SPECIFIC CHECKS 23 | # This is a project defined section to create internal makefile flags to 24 | # conditionally enable or disable the addition of various features within 25 | # this makefile. For instance, if you want to make changes based on whether 26 | # GTK is installed, one might test that here and create a variable to check. 27 | ################################################################################ 28 | # None 29 | 30 | ################################################################################ 31 | # PROJECT EXTERNAL SOURCE PATHS 32 | # These are fully qualified paths that are not within the PROJECT_ROOT folder. 33 | # Like source folders in the PROJECT_ROOT, these paths are subject to 34 | # exlclusion via the PROJECT_EXLCUSIONS list. 35 | # 36 | # (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank) 37 | # 38 | # Note: Leave a leading space when adding list items with the += operator 39 | ################################################################################ 40 | # PROJECT_EXTERNAL_SOURCE_PATHS = 41 | 42 | ################################################################################ 43 | # PROJECT EXCLUSIONS 44 | # These makefiles assume that all folders in your current project directory 45 | # and any listed in the PROJECT_EXTERNAL_SOURCH_PATHS are are valid locations 46 | # to look for source code. The any folders or files that match any of the 47 | # items in the PROJECT_EXCLUSIONS list below will be ignored. 48 | # 49 | # Each item in the PROJECT_EXCLUSIONS list will be treated as a complete 50 | # string unless teh user adds a wildcard (%) operator to match subdirectories. 51 | # GNU make only allows one wildcard for matching. The second wildcard (%) is 52 | # treated literally. 53 | # 54 | # (default) PROJECT_EXCLUSIONS = (blank) 55 | # 56 | # Will automatically exclude the following: 57 | # 58 | # $(PROJECT_ROOT)/bin% 59 | # $(PROJECT_ROOT)/obj% 60 | # $(PROJECT_ROOT)/%.xcodeproj 61 | # 62 | # Note: Leave a leading space when adding list items with the += operator 63 | ################################################################################ 64 | # PROJECT_EXCLUSIONS = 65 | 66 | ################################################################################ 67 | # PROJECT LINKER FLAGS 68 | # These flags will be sent to the linker when compiling the executable. 69 | # 70 | # (default) PROJECT_LDFLAGS = -Wl,-rpath=./libs 71 | # 72 | # Note: Leave a leading space when adding list items with the += operator 73 | ################################################################################ 74 | 75 | # Currently, shared libraries that are needed are copied to the 76 | # $(PROJECT_ROOT)/bin/libs directory. The following LDFLAGS tell the linker to 77 | # add a runtime path to search for those shared libraries, since they aren't 78 | # incorporated directly into the final executable application binary. 79 | # TODO: should this be a default setting? 80 | # PROJECT_LDFLAGS=-Wl,-rpath=./libs 81 | 82 | ################################################################################ 83 | # PROJECT DEFINES 84 | # Create a space-delimited list of DEFINES. The list will be converted into 85 | # CFLAGS with the "-D" flag later in the makefile. 86 | # 87 | # (default) PROJECT_DEFINES = (blank) 88 | # 89 | # Note: Leave a leading space when adding list items with the += operator 90 | ################################################################################ 91 | # PROJECT_DEFINES = 92 | 93 | ################################################################################ 94 | # PROJECT CFLAGS 95 | # This is a list of fully qualified CFLAGS required when compiling for this 96 | # project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS 97 | # defined in your platform specific core configuration files. These flags are 98 | # presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below. 99 | # 100 | # (default) PROJECT_CFLAGS = (blank) 101 | # 102 | # Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in 103 | # your platform specific configuration file will be applied by default and 104 | # further flags here may not be needed. 105 | # 106 | # Note: Leave a leading space when adding list items with the += operator 107 | ################################################################################ 108 | # PROJECT_CFLAGS = 109 | 110 | ################################################################################ 111 | # PROJECT OPTIMIZATION CFLAGS 112 | # These are lists of CFLAGS that are target-specific. While any flags could 113 | # be conditionally added, they are usually limited to optimization flags. 114 | # These flags are added BEFORE the PROJECT_CFLAGS. 115 | # 116 | # PROJECT_OPTIMIZATION_CFLAGS_RELEASE flags are only applied to RELEASE targets. 117 | # 118 | # (default) PROJECT_OPTIMIZATION_CFLAGS_RELEASE = (blank) 119 | # 120 | # PROJECT_OPTIMIZATION_CFLAGS_DEBUG flags are only applied to DEBUG targets. 121 | # 122 | # (default) PROJECT_OPTIMIZATION_CFLAGS_DEBUG = (blank) 123 | # 124 | # Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the 125 | # PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration 126 | # file will be applied by default and further optimization flags here may not 127 | # be needed. 128 | # 129 | # Note: Leave a leading space when adding list items with the += operator 130 | ################################################################################ 131 | # PROJECT_OPTIMIZATION_CFLAGS_RELEASE = 132 | # PROJECT_OPTIMIZATION_CFLAGS_DEBUG = 133 | 134 | ################################################################################ 135 | # PROJECT COMPILERS 136 | # Custom compilers can be set for CC and CXX 137 | # (default) PROJECT_CXX = (blank) 138 | # (default) PROJECT_CC = (blank) 139 | # Note: Leave a leading space when adding list items with the += operator 140 | ################################################################################ 141 | # PROJECT_CXX = 142 | # PROJECT_CC = 143 | -------------------------------------------------------------------------------- /WAAAVE_POOL_4_5/bin/data/shadersES2/shader_mixer.frag: -------------------------------------------------------------------------------- 1 | precision highp float; 2 | 3 | //tex0=external input 4 | uniform sampler2D tex0; 5 | //fb = feedback framebuffer 6 | uniform sampler2D fb; 7 | //temporal filter=previous frame 8 | uniform sampler2D temporalFilter; 9 | 10 | //continuous controls 11 | uniform float fbMix; 12 | uniform float lumakey; 13 | uniform float temporalFilterMix; 14 | uniform float fbXDisplace; 15 | uniform float fbYDisplace; 16 | uniform float fbZDisplace; 17 | uniform float fbRotate; 18 | uniform float fbHue; 19 | uniform float fbSaturation; 20 | uniform float fbBright; 21 | uniform float fbHuexMod; 22 | uniform float fbHuexOff; 23 | uniform float fbHuexLfo; 24 | uniform float temporalFilterResonance; 25 | 26 | //switches 27 | uniform int brightInvert; 28 | uniform int saturationInvert; 29 | uniform int hueInvert; 30 | uniform int horizontalMirror; 31 | uniform int verticalMirror; 32 | uniform int toroidSwitch; 33 | uniform int lumakeyInvertSwitch; 34 | uniform int mirrorSwitch; 35 | 36 | //videoreactive controls 37 | uniform float vLumakey; 38 | uniform float vMix; 39 | uniform float vHue; 40 | uniform float vSat; 41 | uniform float vBright; 42 | uniform float vtemporalFilterMix; 43 | uniform float vFb1X; 44 | uniform float vX; 45 | uniform float vY; 46 | uniform float vZ; 47 | uniform float vRotate; 48 | uniform float vHuexMod; 49 | uniform float vHuexOff; 50 | uniform float vHuexLfo; 51 | 52 | //location 53 | varying vec2 texCoordVarying; 54 | 55 | //--------------------------------------------------------------- 56 | vec2 mirrorCoord(in vec2 inCoord,in vec2 inDim){ 57 | 58 | 59 | if(inCoord.x<0.0){inCoord.x=abs(inCoord.x);} 60 | if(inCoord.y<0.0){inCoord.y=abs(inCoord.y);} 61 | inCoord.x=mod(inCoord.x,inDim.x*2.0); 62 | inCoord.y=mod(inCoord.y,inDim.y*2.0); 63 | 64 | if(inCoord.x>inDim.x){inCoord.x=inDim.x-mod(inCoord.x,inDim.x);} 65 | if(inCoord.y>inDim.y){inCoord.y=inDim.y-mod(inCoord.y,inDim.y);} 66 | 67 | 68 | return inCoord; 69 | } 70 | //----------------------------------------------------------------- 71 | vec2 rotate(in vec2 coord,in float theta){ 72 | //shifting x and y by .5 is equivalent to moving coordinates 0,0 to the center of the screen 73 | vec2 center_coord=vec2(coord.x-.5,coord.y-.5); 74 | vec2 rotate_coord=vec2(0,0); 75 | float spiral=(coord.x+coord.y)/2.0; 76 | coord.x=spiral+coord.x; 77 | coord.y=spiral+coord.y; 78 | rotate_coord.x=center_coord.x*cos(theta)-center_coord.y*sin(theta); 79 | rotate_coord.y=center_coord.x*sin(theta)+center_coord.y*cos(theta); 80 | 81 | rotate_coord=rotate_coord+vec2(.5,.5); 82 | return rotate_coord; 83 | 84 | 85 | } 86 | //---------------------------------------------------------------------- 87 | vec3 rgb2hsb(in vec3 c) 88 | { 89 | vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 90 | vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); 91 | vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); 92 | 93 | float d = q.x - min(q.w, q.y); 94 | float e = 1.0e-10; 95 | return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); 96 | } 97 | //-------------------------------------------------------------------- 98 | vec3 hsb2rgb(in vec3 c) 99 | { 100 | vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); 101 | vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); 102 | return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); 103 | } 104 | //--------------------------------------------------------------------- 105 | 106 | 107 | void main() 108 | { 109 | //important to note that texCoordVarying here seems to be automatically scaled between 0 and 1 110 | 111 | //define a dummy color that we use at the end of the chain when keying/mixing 112 | vec4 color=vec4(0,0,0,0); 113 | 114 | vec4 input1Color = texture2D(tex0, texCoordVarying); 115 | 116 | vec3 input1ColorHsb= rgb2hsb(vec3(input1Color.r,input1Color.g,input1Color.b)); 117 | 118 | //videoreactive attenuator 119 | float VVV=input1ColorHsb.z; 120 | 121 | vec4 temporalFilterColor = texture2D(temporalFilter, texCoordVarying); 122 | 123 | /*********coordinate zones******************/ 124 | //offset coords to make center of the screen (0,0) 125 | vec2 fbCoord=vec2(texCoordVarying.x-.5,texCoordVarying.y-.5); 126 | 127 | //zoom in or out 128 | fbCoord.x=fbZDisplace*fbCoord.x*(1.0+vZ*VVV); 129 | fbCoord.y=fbZDisplace*fbCoord.y*(1.0+vZ*VVV); 130 | 131 | //apply mirrors if switched on 132 | if(horizontalMirror==1){ 133 | if(fbCoord.x>0.0){ 134 | fbCoord.x=-1.0*fbCoord.x; 135 | } 136 | } 137 | if(verticalMirror==1){ 138 | if(fbCoord.y>0.0){ 139 | fbCoord.y=-1.0*fbCoord.y; 140 | } 141 | } 142 | //x and y displacement 143 | fbCoord=vec2(fbCoord.x+fbXDisplace+(vX*VVV)+.5,fbCoord.y+fbYDisplace+(vY*VVV)+.5); 144 | 145 | //rotate 146 | fbCoord=rotate(fbCoord,fbRotate+(vRotate*VVV)); 147 | 148 | //wrap coords around y and x direction 149 | if(toroidSwitch==1){ 150 | if(abs(fbCoord.x)>1.0){fbCoord.x=abs(1.0-fbCoord.x);} 151 | if(abs(fbCoord.y)>1.0){fbCoord.y=abs(1.0-fbCoord.y);} 152 | fbCoord=fract(fbCoord); 153 | } 154 | 155 | //mirror coords areound y and x direction 156 | if(mirrorSwitch==1){ 157 | 158 | fbCoord=mirrorCoord(fbCoord,vec2(1.0,1.0)); 159 | /* 160 | 161 | if(fbCoord.x>4.0){fbCoord.x=fract(fbCoord.x);} 162 | if(fbCoord.y>4.0){fbCoord.y=fract(fbCoord.y);} 163 | 164 | if(fbCoord.x>3.0){fbCoord.x=3.0-fract(fbCoord.x);} 165 | if(fbCoord.y>3.0){fbCoord.y=3.0-fract(fbCoord.y);} 166 | 167 | if(fbCoord.x>2.0){fbCoord.x=fract(fbCoord.x);} 168 | if(fbCoord.y>2.0){fbCoord.y=fract(fbCoord.y);} 169 | 170 | if(fbCoord.x>1.0){fbCoord.x=1.0-fract(fbCoord.x);} 171 | if(fbCoord.y>1.0){fbCoord.y=1.0-fract(fbCoord.y);} 172 | 173 | if(fbCoord.x<-2.0){fbCoord.x=fract(abs(fbCoord.x));} 174 | if(fbCoord.y<-2.0){fbCoord.y=fract(abs(fbCoord.y));} 175 | 176 | if(fbCoord.x<-1.0){fbCoord.x=abs(fract(fbCoord.x));} 177 | if(fbCoord.y<-1.0){fbCoord.y=abs(fract(fbCoord.y));} 178 | 179 | if(fbCoord.x<0.0){fbCoord.x=abs(fbCoord.x);} 180 | if(fbCoord.y<0.0){fbCoord.y=abs(fbCoord.y);} 181 | 182 | fbCoord=fract(fbCoord); 183 | */ 184 | } 185 | 186 | /*****color zones*****/ 187 | 188 | vec4 fbColor = texture2D(fb, fbCoord); 189 | 190 | //clamp the coords so that it doesnt do that annoying color stretch 191 | if(toroidSwitch ==0 && mirrorSwitch==0){ 192 | if(fbCoord.x>1.0){fbColor=vec4(0.0);} 193 | if(fbCoord.y>1.0){fbColor=vec4(0.0);} 194 | if(fbCoord.x<0.0){fbColor=vec4(0.0);} 195 | if(fbCoord.y<0.0){fbColor=vec4(0.0);} 196 | } 197 | 198 | //convert to hsb 199 | vec3 fbColorHsb= rgb2hsb(vec3(fbColor.r,fbColor.g,fbColor.b)); 200 | 201 | //attenuate hue & chaotic huezones 202 | fbColorHsb.x=abs(fbColorHsb.x*fbHue*(1.0+vHue*VVV)+(fbHuexLfo+vHuexLfo*VVV)*sin(fbColorHsb.x/3.14)); 203 | fbColorHsb.x=fract(mod(fbColorHsb.x,fbHuexMod+vHuexMod*VVV)+fbHuexOff+vHuexOff*VVV); 204 | //attenuate sat and bright 205 | fbColorHsb.y=clamp(fbColorHsb.y*fbSaturation*(1.0+vSat*VVV),0.0,1.0); 206 | fbColorHsb.z=clamp(fbColorHsb.z*fbBright*(1.0+vBright*VVV),0.0,1.0); 207 | 208 | //inverts 209 | if(brightInvert==1){fbColorHsb.z=1.0-fbColorHsb.z;} 210 | if(saturationInvert==1){fbColorHsb.y=1.0-fbColorHsb.y;} 211 | if(hueInvert==1){fbColorHsb.x=fract(abs(1.0-fbColorHsb.x));} 212 | 213 | //convert back to rgba 214 | fbColor=vec4(vec3(hsb2rgb(vec3(fbColorHsb.x,fbColorHsb.y,fbColorHsb.z))),1.0); 215 | 216 | //up the temporal Filter resonance 217 | vec3 temporalFilterColorHsb= rgb2hsb(vec3(temporalFilterColor.r,temporalFilterColor.g,temporalFilterColor.b)); 218 | temporalFilterColorHsb.z=clamp(temporalFilterColorHsb.z*(1.0+.5*temporalFilterResonance*(1.0+vFb1X*VVV)),0.0,1.0); 219 | temporalFilterColorHsb.y=clamp(temporalFilterColorHsb.y*(1.0+.25*temporalFilterResonance*(1.0+vFb1X*VVV)),0.0,1.0); 220 | temporalFilterColor=vec4(vec3(hsb2rgb(vec3(temporalFilterColorHsb.x,temporalFilterColorHsb.y,temporalFilterColorHsb.z))),1.0); 221 | 222 | /****MIX AND KEYING**/ 223 | //first 'additive/subtractive' lerping 224 | color=mix(input1Color, fbColor,fbMix+(vMix*VVV)); 225 | 226 | //janky keying 227 | if(lumakeyInvertSwitch==0){ 228 | if(VVVlumakey+(vLumakey*VVV)){color=fbColor;} 233 | } 234 | 235 | //add temporal filter into the mix 236 | color=mix(color,temporalFilterColor,temporalFilterMix+(vtemporalFilterMix*VVV)); 237 | 238 | gl_FragColor = color; 239 | } 240 | -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/bin/data/shadersES2/shader_mixer.frag: -------------------------------------------------------------------------------- 1 | precision highp float; 2 | 3 | 4 | uniform sampler2D tex0; 5 | 6 | uniform sampler2D fb0; 7 | 8 | uniform sampler2D fb1; 9 | 10 | 11 | uniform float fb0_mix; 12 | uniform float fb0_lumakey_value; 13 | uniform float fb0_lumakey_threshold; 14 | 15 | uniform float fb1_mix; 16 | 17 | uniform float fb0_xdisplace; 18 | uniform float fb0_ydisplace; 19 | uniform float fb0_zdisplace; 20 | uniform float fb0_rotate; 21 | 22 | uniform vec3 fb0_hsbx; 23 | 24 | uniform vec3 fb0_huex; 25 | 26 | uniform float fb1_brightx; 27 | uniform float cam1_brightx; 28 | 29 | uniform vec3 fb0_rescale; 30 | 31 | 32 | 33 | 34 | 35 | uniform int fb0_b_invert; 36 | uniform int fb0_s_invert; 37 | uniform int fb0_h_invert; 38 | 39 | uniform int fb0_h_mirror; 40 | 41 | uniform int fb0_v_mirror; 42 | 43 | uniform int toroid_switch; 44 | 45 | uniform int luma_switch; 46 | 47 | uniform int y_mirror_switch; 48 | uniform int x_mirror_switch; 49 | 50 | uniform int mirror_switch; 51 | 52 | varying vec2 texCoordVarying; 53 | 54 | 55 | vec2 rotate(in vec2 coord,in float theta){ 56 | //shifting x and y by .5 is equivalent to moving coordinates 0,0 to the center of the screen 57 | vec2 center_coord=vec2(coord.x-.5,coord.y-.5); 58 | vec2 rotate_coord=vec2(0,0); 59 | float spiral=(coord.x+coord.y)/2.0; 60 | coord.x=spiral+coord.x; 61 | coord.y=spiral+coord.y; 62 | rotate_coord.x=center_coord.x*cos(theta)-center_coord.y*sin(theta); 63 | rotate_coord.y=center_coord.x*sin(theta)+center_coord.y*cos(theta); 64 | 65 | 66 | 67 | 68 | // rotate_coord.x=center_coord.x*cos(theta)-center_coord.y*sin(theta); 69 | // rotate_coord.y=center_coord.x*sin(theta)+center_coord.y*cos(theta); 70 | 71 | rotate_coord=rotate_coord+vec2(.5,.5); 72 | //rotate_coord=mod(rotate_coord,vec2(width,height)); 73 | 74 | 75 | // if(abs(rotate_coord.x)>1.0){rotate_coord.x=abs(1.0-rotate_coord.x);} 76 | // if(abs(rotate_coord.y)>1.0){rotate_coord.y=abs(1.0-rotate_coord.y);} 77 | 78 | return rotate_coord; 79 | 80 | 81 | }//endrotate 82 | 83 | 84 | 85 | vec3 rgb2hsb(in vec3 c) 86 | { 87 | vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 88 | vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); 89 | vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); 90 | 91 | float d = q.x - min(q.w, q.y); 92 | float e = 1.0e-10; 93 | return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); 94 | } 95 | 96 | vec3 hsb2rgb(in vec3 c) 97 | { 98 | vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); 99 | vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); 100 | return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); 101 | } 102 | 103 | 104 | 105 | 106 | 107 | /* 108 | vec3 rgb2hsb( in vec3 c ){ 109 | vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 110 | vec4 p = mix(vec4(c.bg, K.wz), 111 | vec4(c.gb, K.xy), 112 | step(c.b, c.g)); 113 | vec4 q = mix(vec4(p.xyw, c.r), 114 | vec4(c.r, p.yzx), 115 | step(p.x, c.r)); 116 | float d = q.x - min(q.w, q.y); 117 | float e = 1.0e-10; 118 | return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), 119 | d / (q.x + e), 120 | q.x); 121 | } 122 | 123 | vec3 hsb2rgb( in vec3 c ){ 124 | vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0), 125 | 6.0)-3.0)-1.0, 126 | 0.0, 127 | 1.0 ); 128 | rgb = rgb*rgb*(3.0-2.0*rgb); 129 | return c.z * mix(vec3(1.0), rgb, c.y); 130 | } 131 | 132 | */ 133 | 134 | void main() 135 | { 136 | //important to note that texCoordVarying here seems to be automatically scaled between 0 and 1 137 | 138 | vec4 color=vec4(0,0,0,0); 139 | 140 | vec4 cam1_color = texture2D(tex0, texCoordVarying); 141 | 142 | //testing out downscaling stuffs for vidgrabber 143 | //vec4 cam1_color = texture2D(tex0, texCoordVarying*vec2(2.0,2.0)); 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | vec3 cam1_color_hsb= rgb2hsb(vec3(cam1_color.r,cam1_color.g,cam1_color.b)); 152 | 153 | cam1_color_hsb.z=pow(cam1_color_hsb.z,(1.0+cam1_brightx)); 154 | 155 | 156 | cam1_color=vec4(vec3(hsb2rgb(vec3(cam1_color_hsb.x,cam1_color_hsb.y,cam1_color_hsb.z))),1.0); 157 | 158 | 159 | 160 | vec4 fb1_color = texture2D(fb1, texCoordVarying); 161 | //trying to offset the decreased camera quality when a midi controller is connected 162 | //fb1_color=clamp(boost*fb1_color,0.0,1.0); 163 | 164 | //coordinate zones 165 | 166 | 167 | vec2 fb0_coord=vec2(texCoordVarying.x-.5,texCoordVarying.y-.5); 168 | fb0_coord.x=fb0_zdisplace*fb0_coord.x; 169 | fb0_coord.y=fb0_zdisplace*fb0_coord.y; 170 | 171 | if(x_mirror_switch==0){ 172 | if(fb0_h_mirror==1){ 173 | if(fb0_coord.x>0.0){ 174 | fb0_coord.x=-1.0*fb0_coord.x; 175 | } 176 | } 177 | 178 | } 179 | 180 | if(y_mirror_switch==0){ 181 | if(fb0_v_mirror==1){ 182 | if(fb0_coord.y>0.0){ 183 | fb0_coord.y=-1.0*fb0_coord.y; 184 | } 185 | } 186 | } 187 | 188 | fb0_coord=vec2(fb0_coord.x+fb0_xdisplace+.5,fb0_coord.y+fb0_ydisplace+.5); 189 | 190 | fb0_coord=rotate(fb0_coord,fb0_rotate); 191 | 192 | if(toroid_switch==1){ 193 | if(abs(fb0_coord.x)>1.0){fb0_coord.x=abs(1.0-fb0_coord.x);} 194 | if(abs(fb0_coord.y)>1.0){fb0_coord.y=abs(1.0-fb0_coord.y);} 195 | 196 | fb0_coord=fract(fb0_coord); 197 | }//endiftoroidswtich 198 | 199 | 200 | if(mirror_switch==1){ 201 | if(fb0_coord.x>4.0){fb0_coord.x=fract(fb0_coord.x);} 202 | if(fb0_coord.y>4.0){fb0_coord.y=fract(fb0_coord.y);} 203 | 204 | if(fb0_coord.x>3.0){fb0_coord.x=3.0-fract(fb0_coord.x);} 205 | if(fb0_coord.y>3.0){fb0_coord.y=3.0-fract(fb0_coord.y);} 206 | 207 | if(fb0_coord.x>2.0){fb0_coord.x=fract(fb0_coord.x);} 208 | if(fb0_coord.y>2.0){fb0_coord.y=fract(fb0_coord.y);} 209 | 210 | if(fb0_coord.x>1.0){fb0_coord.x=1.0-fract(fb0_coord.x);} 211 | if(fb0_coord.y>1.0){fb0_coord.y=1.0-fract(fb0_coord.y);} 212 | 213 | 214 | 215 | 216 | if(fb0_coord.x<-2.0){fb0_coord.x=fract(abs(fb0_coord.x));} 217 | if(fb0_coord.y<-2.0){fb0_coord.y=fract(abs(fb0_coord.y));} 218 | 219 | if(fb0_coord.x<-1.0){fb0_coord.x=abs(fract(fb0_coord.x));} 220 | if(fb0_coord.y<-1.0){fb0_coord.y=abs(fract(fb0_coord.y));} 221 | 222 | if(fb0_coord.x<0.0){fb0_coord.x=abs(fb0_coord.x);} 223 | if(fb0_coord.y<0.0){fb0_coord.y=abs(fb0_coord.y);} 224 | 225 | fb0_coord=fract(fb0_coord); 226 | }//endiftoroidswtich 227 | 228 | /* 229 | 230 | if(x_mirror_switch==1){ 231 | if(fb0_h_mirror==1){ 232 | if(fb0_coord.x>.5){ 233 | fb0_coord.x=.5-abs(.5-fb0_coord.x); 234 | } 235 | } 236 | } 237 | 238 | if(y_mirror_switch==1){ 239 | if(fb0_v_mirror==1){ 240 | if(fb0_coord.y>.5){ 241 | fb0_coord.y=.5-abs(.5-fb0_coord.y); 242 | } 243 | } 244 | } 245 | */ 246 | 247 | vec4 fb0_color = texture2D(fb0, fb0_coord); 248 | 249 | if(toroid_switch ==0 && mirror_switch==0){ 250 | if(fb0_coord.x>1.0){fb0_color=vec4(0.0);} 251 | if(fb0_coord.y>1.0){fb0_color=vec4(0.0);} 252 | if(fb0_coord.x<0.0){fb0_color=vec4(0.0);} 253 | if(fb0_coord.y<0.0){fb0_color=vec4(0.0);} 254 | }//endiftoroidswtich 255 | 256 | 257 | 258 | //convert to hsb 259 | 260 | 261 | vec3 fb0_color_hsb= rgb2hsb(vec3(fb0_color.r,fb0_color.g,fb0_color.b)); 262 | 263 | //attenuate hsb 264 | if(fb0_h_invert==1){fb0_color_hsb.x=1.0-fb0_color_hsb.x;} 265 | //chaotic huezones 266 | fb0_color_hsb.x=abs(fb0_color_hsb.x*fb0_hsbx.x+fb0_huex.z*sin(fb0_color_hsb.x/3.14)); 267 | fb0_color_hsb.x=fract(mod(fb0_color_hsb.x,fb0_huex.x)+fb0_huex.y); 268 | 269 | 270 | //fb0_color_hsb.x=fb0_color_hsb.x*fb0_hsbx.x; 271 | //here is a glitch between this version and the previous one 272 | //for some reason brightness is like halved when some midi controllers are attached 273 | //most likely because power supplied to the camera is reduced as well so might as well just work with it 274 | //looks like out of the two that i have tried thus far, the nanostudio draws way more power than the nanokontrol 275 | //will need to have more folks help with the testing here 276 | 277 | //fb0_color_hsb.y=clamp(fb0_color_hsb.y*fb0_hsbx.y,0.0,1.0); 278 | 279 | 280 | fb0_color_hsb.y=clamp(fb0_color_hsb.y*fb0_hsbx.y,0.0,1.0); 281 | 282 | fb0_color_hsb.z=clamp(fb0_color_hsb.z*fb0_hsbx.z,0.0,1.0); 283 | 284 | 285 | if(fb0_b_invert==1){fb0_color_hsb.z=1.0-fb0_color_hsb.z;} 286 | 287 | if(fb0_s_invert==1){fb0_color_hsb.y=1.0-fb0_color_hsb.y;} 288 | 289 | fb0_color=vec4(vec3(hsb2rgb(vec3(fb0_color_hsb.x,fb0_color_hsb.y,fb0_color_hsb.z))),1.0); 290 | 291 | 292 | 293 | vec3 fb1_color_hsb= rgb2hsb(vec3(fb1_color.r,fb1_color.g,fb1_color.b)); 294 | 295 | fb1_color_hsb.z=clamp(fb1_color_hsb.z*(1.0+.5*fb1_brightx),0.0,1.0); 296 | fb1_color_hsb.y=clamp(fb1_color_hsb.y*(1.0+.25*fb1_brightx),0.0,1.0); 297 | 298 | 299 | fb1_color=vec4(vec3(hsb2rgb(vec3(fb1_color_hsb.x,fb1_color_hsb.y,fb1_color_hsb.z))),1.0); 300 | 301 | 302 | 303 | 304 | color=mix(cam1_color, fb0_color,fb0_mix); 305 | 306 | 307 | //janky keying 308 | float cam1_bright=.33*cam1_color.r+.5*cam1_color.g+.16*cam1_color.b; 309 | 310 | if(luma_switch==0){ 311 | if(cam1_brightfb0_lumakey_value) 319 | { 320 | color=fb0_color; 321 | } 322 | } 323 | 324 | color=mix(color,fb1_color,fb1_mix); 325 | 326 | gl_FragColor = color; 327 | } 328 | -------------------------------------------------------------------------------- /WAAVE_POOOL_MAIN/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Dan Wilcox 3 | * 4 | * BSD Simplified License. 5 | * For information on usage and redistribution, and for a DISCLAIMER OF ALL 6 | * WARRANTIES, see the file, "LICENSE.txt," in this distribution. 7 | * 8 | * See https://github.com/danomatika/ofxMidi for documentation 9 | * 10 | */ 11 | #include "ofApp.h" 12 | 13 | #include "iostream" 14 | 15 | //flip this switch to try different scalings 16 | //0 is 320 1 is 640 17 | //if you reduce scale to 320 you can up the total delay time to 18 | //about 4 seconds/ 120 frames 19 | //so try that out sometime and see how that feels! 20 | bool scaleswitch=1; 21 | const int fbob=60; 22 | //const int fbob=120; 23 | 24 | 25 | //might be unnecessary now!! 26 | bool hdmi_input_switch=0; 27 | 28 | //0 is sd aspect ratio 29 | //use definitely with all of the VSERPI devices 30 | //and anything else doing like 480i/p over hdmi 31 | //1 is corner cropping to fill the screen 32 | int hdmi_aspect_ratio_switch=0; 33 | 34 | //0 is picaputre, 1 is usbinput 35 | //note that this refers to the picapture SD1 HATs which are no longer 36 | //(as of Nov 2020) in production. left in for legacy support but 37 | //mostly irrelevant to anyone just getting started with these after nov 2020 38 | bool inputswitch=1; 39 | 40 | //0 is wet (framebuffer fed from final output, internal 41 | //feedback mode 42 | //1 is dry (framebuffer fed direct from camera input, 43 | //traditional video delay mode 44 | bool wet_dry_switch=1; 45 | 46 | float az = 1.0; 47 | float sx = 0; 48 | float dc = 0; 49 | float fv = 1; 50 | float gb = 1; 51 | float hn = 1; 52 | float jm = 0.0; 53 | float kk = 0.0; 54 | float ll = 0.0; 55 | float qw = 0.0; 56 | 57 | float er = 1.0; 58 | float ty = 0.0; 59 | float ui = 0.0; 60 | 61 | float op = 0.0; 62 | 63 | float fb1_brightx=0.0; 64 | 65 | bool toroid_switch=0; 66 | 67 | float testt=1.0; 68 | 69 | bool y_skew_switch=FALSE; 70 | bool x_skew_switch=FALSE; 71 | 72 | bool luma_switch=FALSE; 73 | 74 | bool x_mirror_switch=FALSE; 75 | 76 | bool y_mirror_switch=FALSE; 77 | 78 | float y_skew=0; 79 | 80 | float x_skew=0; 81 | 82 | 83 | 84 | int fb0_delayamount=0; 85 | 86 | 87 | 88 | //dummy variables for midi control 89 | 90 | 91 | 92 | int width=0; 93 | int height=0; 94 | 95 | 96 | //dummy variables for midi to audio attenuatiors 97 | //0 is direct midi, 1 is low_x, 2 is mid_x, 3 is high_x 98 | int control_switch=0; 99 | 100 | float low_c1=0.0; 101 | float low_c2=0.0; 102 | float low_c3=0.0; 103 | float low_c4=0.0; 104 | float low_c5=0.0; 105 | float low_c6=0.0; 106 | float low_c7=0.0; 107 | float low_c8=0.0; 108 | float low_c9=0.0; 109 | float low_c10=0.0; 110 | float low_c11=0.0; 111 | float low_c12=0.0; 112 | float low_c13=0.0; 113 | float low_c14=0.0; 114 | float low_c15=0.0; 115 | float low_c16=0.0; 116 | 117 | float mid_c1=0.0; 118 | float mid_c2=0.0; 119 | float mid_c3=0.0; 120 | float mid_c4=0.0; 121 | float mid_c5=0.0; 122 | float mid_c6=0.0; 123 | float mid_c7=0.0; 124 | float mid_c8=0.0; 125 | float mid_c9=0.0; 126 | float mid_c10=0.0; 127 | float mid_c11=0.0; 128 | float mid_c12=0.0; 129 | float mid_c13=0.0; 130 | float mid_c14=0.0; 131 | float mid_c15=0.0; 132 | float mid_c16=0.0; 133 | 134 | float high_c1=0.0; 135 | float high_c2=0.0; 136 | float high_c3=0.0; 137 | float high_c4=0.0; 138 | float high_c5=0.0; 139 | float high_c6=0.0; 140 | float high_c7=0.0; 141 | float high_c8=0.0; 142 | float high_c9=0.0; 143 | float high_c10=0.0; 144 | float high_c11=0.0; 145 | float high_c12=0.0; 146 | float high_c13=0.0; 147 | float high_c14=0.0; 148 | float high_c15=0.0; 149 | float high_c16=0.0; 150 | 151 | 152 | 153 | bool clear_switch=0; 154 | //toggle switch variables 155 | bool fb0_h_invert=FALSE; 156 | bool fb0_s_invert=FALSE; 157 | bool fb0_b_invert=FALSE; 158 | 159 | bool cam1_h_invert=FALSE; 160 | bool cam1_s_invert=FALSE; 161 | bool cam1_b_invert=FALSE; 162 | 163 | bool fb0_h_mirror=FALSE; 164 | bool fb0_v_mirror=FALSE; 165 | 166 | bool clear_flip=FALSE; 167 | 168 | bool x_2=FALSE; 169 | bool x_5=FALSE; 170 | bool x_10=FALSE; 171 | 172 | bool y_2=FALSE; 173 | bool y_5=FALSE; 174 | bool y_10=FALSE; 175 | 176 | bool z_2=FALSE; 177 | bool z_5=FALSE; 178 | bool z_10=FALSE; 179 | 180 | bool theta_0=FALSE; 181 | bool theta_1=FALSE; 182 | bool theta_2=FALSE; 183 | 184 | bool huexx_0=FALSE; 185 | bool huexx_1=FALSE; 186 | bool huexx_2=FALSE; 187 | 188 | bool huexy_0=FALSE; 189 | bool huexy_1=FALSE; 190 | bool huexy_2=FALSE; 191 | 192 | bool huexz_0=FALSE; 193 | bool huexz_1=FALSE; 194 | bool huexz_2=FALSE; 195 | 196 | //framebuffer management biziness 197 | 198 | //fbob is the total number of frames that will be stored. setting fbob to 199 | //30 while fps is set to 30 means 1 second of video will be stored in memory 200 | //75 seems to work ok with usb cams but the capture device might need a little more memory 201 | 202 | 203 | 204 | //const int fbob=2; 205 | 206 | 207 | int framedelayoffset=0; // this is used as an index to the circular framebuffers eeettt 208 | unsigned int framecount=0; // framecounter used to calc offset eeettt 209 | 210 | //this is an array of framebuffer objects 211 | ofFbo pastFrames[fbob]; 212 | 213 | 214 | void incIndex() // call this every frame to calc the offset eeettt 215 | { 216 | 217 | framecount++; 218 | framedelayoffset=framecount % fbob; 219 | } 220 | 221 | 222 | //p_lock biz 223 | //maximum total size of the plock array 224 | const int p_lock_size=240; 225 | 226 | 227 | //p_lock_switch turns on and off p_locks 228 | bool p_lock_switch=0; 229 | 230 | bool p_lock_erase=0; 231 | 232 | //maximum number of p_locks available...maybe there can be one for every knob 233 | //for whatever wacky reason the last member of this array of arrays has a glitch 234 | //so i guess just make an extra array and forget about it for now 235 | const int p_lock_number=17; 236 | 237 | //so how we will organize the p_locks is in multidimensional arrays 238 | //to access the data at timestep x for p_lock 2 (remember counting from 0) we use p_lock[2][x] 239 | float p_lock[p_lock_number][p_lock_size]; 240 | 241 | 242 | //smoothing parameters(i think for all of these we can array both the arrays and the floats 243 | //for now let us just try 1 smoothing parameter for everything. 244 | float p_lock_smooth=.5; 245 | 246 | 247 | //and then lets try an array of floats for storing the smoothed values 248 | float p_lock_smoothed[p_lock_number]; 249 | 250 | 251 | //turn on and off writing to the array 252 | bool p_lock_0_switch=1; 253 | 254 | //global counter for all the locks 255 | int p_lock_increment=0; 256 | 257 | 258 | float my_normalize=0; 259 | 260 | float low_value_smoothed=0.0; 261 | float mid_value_smoothed=0.0; 262 | float high_value_smoothed=0.0; 263 | float smoothing_rate=.8; 264 | 265 | ofFbo aspect_fix_fbo; 266 | 267 | 268 | //-------------------------------------------------------------- 269 | void ofApp::setup() { 270 | //ofSetVerticalSync(true); 271 | 272 | 273 | 274 | ofSetFrameRate(30); 275 | 276 | ofBackground(0); 277 | 278 | //ofToggleFullscreen(); 279 | 280 | ofHideCursor(); 281 | 282 | 283 | if(scaleswitch==0){ 284 | width=320; 285 | height=240; 286 | } 287 | 288 | if(scaleswitch==1){ 289 | width=640; 290 | height=480; 291 | } 292 | 293 | omx_settings(); 294 | 295 | 296 | 297 | framebuffer0.allocate(width,height); 298 | 299 | framebuffer0.begin(); 300 | ofClear(0,0,0,255); 301 | framebuffer0.end(); 302 | 303 | 304 | aspect_fix_fbo.allocate(width,height); 305 | 306 | aspect_fix_fbo.begin(); 307 | ofClear(0,0,0,255); 308 | aspect_fix_fbo.end(); 309 | 310 | 311 | dry_framebuffer.allocate(width,height); 312 | 313 | 314 | dry_framebuffer.begin(); 315 | ofClear(0,0,0,255); 316 | dry_framebuffer.end(); 317 | 318 | for(int i=0;i maxMessages) { 696 | midiMessages.erase(midiMessages.begin()); 697 | } 698 | } 699 | 700 | //-------------------------------------------------------------- 701 | void ofApp::keyPressed(int key) { 702 | 703 | 704 | //error-if i decrement fb0_delayamount it always crashes... 705 | if (key == '[') {fb0_delayamount += 1;} 706 | if (key == ']') { 707 | fb0_delayamount = fb0_delayamount-1; 708 | if(fb0_delayamount<0){ 709 | fb0_delayamount=fbob-fb0_delayamount; 710 | }//endiffb0 711 | }//endifkey 712 | 713 | //fb1 mix 714 | if (key == 'o') {op += .01;} 715 | if (key == 'p') {op -= .01;} 716 | 717 | //fb0 z displace 718 | if (key == 'a') {az += .0001;} 719 | if (key == 'z') {az -= .0001;} 720 | 721 | //fb0 x displace 722 | if (key == 's') {sx += .0001;} 723 | if (key == 'x') {sx -= .0001;} 724 | 725 | //fb0 y displace 726 | if (key == 'd') {dc += .0001;} 727 | if (key == 'c') {dc -= .0001;} 728 | 729 | //fb0 hue attenuate 730 | if (key == 'f') {fv += .001;} 731 | if (key == 'v') {fv -= .001;} 732 | 733 | //fb0 saturation attenuate 734 | if (key == 'g') {gb += .001;} 735 | if (key == 'b') {gb -= .001;} 736 | 737 | //fb0 brightness attenuate 738 | if (key == 'h') {hn += .001;} 739 | if (key == 'n') {hn -= .001;} 740 | 741 | //fb0 mix 742 | if (key == 'j') {jm += .01;} 743 | if (key == 'm') {jm -= .01;} 744 | 745 | //fb0 lumakey value 746 | if (key == 'k') {kk = ofClamp(kk+.01,0.0,1.0);} 747 | if (key == ',') {kk = ofClamp(kk-.01,0.0,1.0);} 748 | 749 | 750 | if (key == 'l') {ll += .01;} 751 | if (key == '.') {ll -= .01;} 752 | 753 | if (key == ';') {fb1_brightx += .01;} 754 | if (key == '\'') {fb1_brightx -= .01;} 755 | 756 | //fb0 rotation 757 | if (key == 'q') {qw += .0001;} 758 | if (key == 'w') {qw -= .0001;} 759 | 760 | 761 | //hue chaos1 762 | if (key == 'e') {er += .001;} 763 | if (key == 'r') {er -= .001;} 764 | 765 | //hue chaos2 766 | if (key == 't') {ty += .01;} 767 | if (key == 'y') {ty -= .01;} 768 | 769 | //hue chaos3 770 | if (key == 'u') {ui += .01;} 771 | if (key == 'i') {ui -= .01;} 772 | 773 | if (key == '1') { 774 | 775 | //clear the framebuffer if thats whats up 776 | framebuffer0.begin(); 777 | ofClear(0, 0, 0, 255); 778 | framebuffer0.end(); 779 | 780 | for(int i=0;i 3 | * 4 | * BSD Simplified License. 5 | * For information on usage and redistribution, and for a DISCLAIMER OF ALL 6 | * WARRANTIES, see the file, "LICENSE.txt," in this distribution. 7 | * 8 | * See https://github.com/danomatika/ofxMidi for documentation 9 | * 10 | */ 11 | #include "ofApp.h" 12 | 13 | #include "iostream" 14 | 15 | #define MIDI_MAGIC 63.50f 16 | 17 | #define CONTROL_THRESHOLD .04f 18 | 19 | //flip this switch to try different scalings 20 | //0 is 320 1 is 640 21 | //if you reduce scale to 320 you can up the total delay time to 22 | //about 4 seconds/ 120 frames 23 | //so try that out sometime and see how that feels! 24 | bool scaleswitch=1; 25 | const int framebufferLength=60; 26 | //const int framebufferLength=120; 27 | 28 | 29 | //might be unnecessary now!! 30 | bool hdmi_input_switch=0; 31 | 32 | //0 is sd aspect ratio 33 | //use definitely with all of the VSERPI devices 34 | //and anything else doing like 480i/p over hdmi 35 | //1 is corner cropping to fill the screen 36 | int hdmi_aspect_ratio_switch=0; 37 | 38 | //0 is picaputre, 1 is usbinput 39 | //note that this refers to the picapture SD1 HATs which are no longer 40 | //(as of Nov 2020) in production. left in for legacy support but 41 | //mostly irrelevant to anyone just getting started with these after nov 2020 42 | bool inputswitch=1; 43 | 44 | //0 is wet (framebuffer fed from final output, internal 45 | //feedback mode 46 | //1 is dry (framebuffer fed direct from camera input, 47 | //traditional video delay mode 48 | bool wet_dry_switch=1; 49 | 50 | float az = 1.0; 51 | float sx = 0; 52 | float dc = 0; 53 | float fv = 1; 54 | float gb = 1; 55 | float hn = 1; 56 | float jm = 0.0; 57 | float kk = 0.0; 58 | float ll = 0.0; 59 | float qw = 0.0; 60 | float er = 1.0; 61 | float ty = 0.0; 62 | float ui = 0.0; 63 | float op = 0.0; 64 | 65 | float testt=1.0; 66 | 67 | bool y_skew_switch=FALSE; 68 | bool x_skew_switch=FALSE; 69 | 70 | 71 | 72 | float y_skew=0; 73 | 74 | float x_skew=0; 75 | 76 | 77 | 78 | int fb_delayamount=0; 79 | 80 | 81 | 82 | //dummy variables for midi control 83 | 84 | 85 | 86 | int width=640; 87 | int height=480; 88 | 89 | 90 | //dummy variables for midi to audio attenuatiors 91 | //0 is direct midi, 1 is low_x, 2 is mid_x, 3 is high_x 92 | int control_switch=0; 93 | //for audio reactive controls 94 | /* 95 | float low_c1=0.0; 96 | float low_c2=0.0; 97 | float low_c3=0.0; 98 | float low_c4=0.0; 99 | float low_c5=0.0; 100 | float low_c6=0.0; 101 | float low_c7=0.0; 102 | float low_c8=0.0; 103 | float low_c9=0.0; 104 | float low_c10=0.0; 105 | float low_c11=0.0; 106 | float low_c12=0.0; 107 | float low_c13=0.0; 108 | float low_c14=0.0; 109 | float low_c15=0.0; 110 | float low_c16=0.0; 111 | 112 | float mid_c1=0.0; 113 | float mid_c2=0.0; 114 | float mid_c3=0.0; 115 | float mid_c4=0.0; 116 | float mid_c5=0.0; 117 | float mid_c6=0.0; 118 | float mid_c7=0.0; 119 | float mid_c8=0.0; 120 | float mid_c9=0.0; 121 | float mid_c10=0.0; 122 | float mid_c11=0.0; 123 | float mid_c12=0.0; 124 | float mid_c13=0.0; 125 | float mid_c14=0.0; 126 | float mid_c15=0.0; 127 | float mid_c16=0.0; 128 | 129 | float high_c1=0.0; 130 | float high_c2=0.0; 131 | float high_c3=0.0; 132 | float high_c4=0.0; 133 | float high_c5=0.0; 134 | float high_c6=0.0; 135 | float high_c7=0.0; 136 | float high_c8=0.0; 137 | float high_c9=0.0; 138 | float high_c10=0.0; 139 | float high_c11=0.0; 140 | float high_c12=0.0; 141 | float high_c13=0.0; 142 | float high_c14=0.0; 143 | float high_c15=0.0; 144 | float high_c16=0.0; 145 | 146 | float my_normalize=0; 147 | 148 | float low_value_smoothed=0.0; 149 | float mid_value_smoothed=0.0; 150 | float high_value_smoothed=0.0; 151 | float smoothing_rate=.8; 152 | 153 | */ 154 | 155 | bool clear_switch=0; 156 | 157 | //toggle switch variables 158 | bool hueInvert=FALSE; 159 | bool saturationInvert=FALSE; 160 | bool brightInvert=FALSE; 161 | bool cam1_h_invert=FALSE; 162 | bool cam1_s_invert=FALSE; 163 | bool cam1_b_invert=FALSE; 164 | bool horizontalMirror=FALSE; 165 | bool verticalMirror=FALSE; 166 | bool lumakeyInvertSwitch=FALSE; 167 | bool toroidSwitch=0; 168 | 169 | float temporalFilterResonance=0.0; 170 | 171 | //rescaling switches 172 | bool x_2=FALSE; 173 | bool x_5=FALSE; 174 | bool x_10=FALSE; 175 | 176 | bool y_2=FALSE; 177 | bool y_5=FALSE; 178 | bool y_10=FALSE; 179 | 180 | bool z_2=FALSE; 181 | bool z_5=FALSE; 182 | bool z_10=FALSE; 183 | 184 | bool theta_0=FALSE; 185 | bool theta_1=FALSE; 186 | bool theta_2=FALSE; 187 | 188 | bool huexx_0=FALSE; 189 | bool huexx_1=FALSE; 190 | bool huexx_2=FALSE; 191 | 192 | bool huexy_0=FALSE; 193 | bool huexy_1=FALSE; 194 | bool huexy_2=FALSE; 195 | 196 | bool huexz_0=FALSE; 197 | bool huexz_1=FALSE; 198 | bool huexz_2=FALSE; 199 | 200 | bool mirrorSwitch; 201 | //framebuffer management biziness 202 | 203 | //framebufferLength is the total number of frames that will be stored. setting framebufferLength to 204 | //30 while fps is set to 30 means 1 second of video will be stored in memory 205 | //75 seems to work ok with usb cams but the capture device might need a little more memory 206 | 207 | int framedelayoffset=0; // this is used as an index to the circular framebuffers eeettt 208 | unsigned int framecount=0; // framecounter used to calc offset eeettt 209 | 210 | //this is an array of framebuffer objects 211 | ofFbo pastFrames[framebufferLength]; 212 | 213 | void incIndex() // call this every frame to calc the offset eeettt 214 | { 215 | 216 | framecount++; 217 | framedelayoffset=framecount % framebufferLength; 218 | } 219 | 220 | //p_lock biz 221 | //maximum total size of the plock array 222 | const int p_lock_size=240; 223 | 224 | 225 | //p_lock_switch turns on and off p_locks 226 | bool p_lock_switch=0; 227 | bool p_lock_erase=0; 228 | 229 | //maximum number of p_locks available...maybe there can be one for every knob 230 | //for whatever wacky reason the last member of this array of arrays has a glitch 231 | //so i guess just make an extra array and forget about it for now 232 | const int p_lock_number=17; 233 | 234 | //so how we will organize the p_locks is in multidimensional arrays 235 | //to access the data at timestep x for p_lock 2 (remember counting from 0) we use p_lock[2][x] 236 | float p_lock[p_lock_number][p_lock_size]; 237 | 238 | //smoothing parameters(i think for all of these we can array both the arrays and the floats 239 | //for now let us just try 1 smoothing parameter for everything. 240 | float p_lock_smooth=.5; 241 | 242 | //and then lets try an array of floats for storing the smoothed values 243 | float p_lock_smoothed[p_lock_number]; 244 | 245 | //turn on and off writing to the array 246 | bool p_lock_0_switch=1; 247 | 248 | //global counter for all the locks 249 | int p_lock_increment=0; 250 | 251 | 252 | 253 | ofFbo aspect_fix_fbo; 254 | 255 | 256 | //videoreactive controls 257 | bool videoReactiveSwitch=FALSE; 258 | 259 | float vLumakeyValue=0.0; 260 | float vMix=0.0; 261 | float vHue=0.0; 262 | float vSaturation=0.0; 263 | float vBright=0.0; 264 | float vTemporalFilterMix=0.0; 265 | float vTemporalFilterResonance=0.0; 266 | float vSharpenAmount=0.0; 267 | float vX=0.0; 268 | float vY=0.0; 269 | float vZ=0.0; 270 | float vRotate=0.0; 271 | float vHuexMod=0.0; 272 | float vHuexOff=0.0; 273 | float vHuexLfo=0.0; 274 | 275 | 276 | //lfos 277 | bool globalLfoAmpSwitch=false; 278 | bool globalLfoRateSwitch=false; 279 | 280 | //0 means plocks active 281 | //1 means videoreactive active 282 | int savedState=0; 283 | 284 | bool xLfoAmpSwitch=false; 285 | bool xLfoRateSwitch=false; 286 | float xLfoAmp=0.0; 287 | float xLfoRate=0.0; 288 | int xLfoShape=0; 289 | 290 | 291 | bool yLfoAmpSwitch=false; 292 | bool yLfoRateSwitch=false; 293 | float yLfoAmp=0.0; 294 | float yLfoRate=0.0; 295 | int yLfoShape=0; 296 | 297 | bool zLfoAmpSwitch=false; 298 | bool zLfoRateSwitch=false; 299 | float zLfoAmp=0.0; 300 | float zLfoRate=0.0; 301 | int zLfoShape=0; 302 | 303 | bool rotateLfoAmpSwitch=false; 304 | bool rotateLfoRateSwitch=false; 305 | float rotateLfoAmp=0.0; 306 | float rotateLfoRate=0.0; 307 | int rotateLfoShape=0; 308 | 309 | //latching 310 | bool midiActiveFloat[17]; 311 | bool vmidiActiveFloat[17]; 312 | bool lfoAmpActiveFloat[17]; 313 | bool lfoRateActiveFloat[17]; 314 | //-------------------------------------------------------------- 315 | void ofApp::setup() { 316 | //ofSetVerticalSync(true); 317 | ofSetFrameRate(30); 318 | ofBackground(0); 319 | //ofToggleFullscreen(); 320 | ofHideCursor(); 321 | cameraSetup(width, height); 322 | //omx_settings(); 323 | allocateFbo(width,height); 324 | clearFbo(); 325 | p_lockClear(); 326 | shader_mixer.load("shadersES2/shader_mixer"); 327 | shaderSharpen.load("shadersES2/shaderSharpen"); 328 | midiSetup(); 329 | 330 | for(int i=0;i<17;i++){ 331 | vmidiActiveFloat[i]=0; 332 | midiActiveFloat[i]=0; 333 | lfoAmpActiveFloat[i]=0; 334 | lfoRateActiveFloat[i]=0; 335 | } 336 | } 337 | 338 | //-------------------------------------------------------------- 339 | void ofApp::update() { 340 | cameraUpdate(); 341 | midibiz(); 342 | p_lockUpdate(); 343 | } 344 | 345 | //-------------------------------------------------------------- 346 | void ofApp::draw() { 347 | 348 | /**controlZones**/ 349 | 350 | //default values will be for wet mode 351 | float c_lumakey_value=1.01; 352 | float c_mix=2; 353 | float c_hue=.25; 354 | float c_sat=.2; 355 | float c_bright=.35; 356 | float c_temporalFilterMix=1.1; 357 | float c_sharpenAmount=.5; 358 | float c_x=.01; 359 | float c_y=.01; 360 | float c_z=.05; 361 | float c_rotate=.314159265; 362 | float c_huex_off=.25; 363 | float c_huex_lfo=.25; 364 | 365 | //change a bunch of coefficients when switching to dry mode 366 | if(wet_dry_switch==0){ 367 | c_hue=1.0; 368 | c_sat=1.0; 369 | c_bright=1.0; 370 | c_x=.1; 371 | c_y=.1; 372 | c_z=.5; 373 | } 374 | 375 | //all the dummy variables will begin with d 376 | int d_delay=(abs(framedelayoffset-framebufferLength-fb_delayamount- 377 | int((p_lock_smoothed[15])*(framebufferLength-1.0)) 378 | )-1)%framebufferLength; 379 | float d_lumakey_value=kk+c_lumakey_value*p_lock_smoothed[0]; 380 | float d_mix=jm+c_mix*p_lock_smoothed[1]; 381 | float d_hue=fv*(1.0f+c_hue*p_lock_smoothed[2]); 382 | float d_sat=gb*(1.0f+c_sat*p_lock_smoothed[3]); 383 | float d_bright=hn*(1.0f+c_bright*p_lock_smoothed[4]); 384 | float d_temporalFilterMix=op+c_temporalFilterMix*p_lock_smoothed[5]; 385 | float d_fb1_x=temporalFilterResonance+p_lock_smoothed[6]; 386 | float d_sharpenAmount=ll+c_sharpenAmount*p_lock_smoothed[7]; 387 | float d_x=sx+c_x*p_lock_smoothed[8]; 388 | float d_y=dc+c_y*p_lock_smoothed[9]; 389 | float d_z=az*(1.0f+c_z*p_lock_smoothed[10]); 390 | float d_rotate=qw+c_rotate*p_lock_smoothed[11]; 391 | float d_huex_mod=er*(1.0f-p_lock_smoothed[12]); 392 | float d_huex_off=ty+c_huex_off*p_lock_smoothed[13]; 393 | float d_huex_lfo=ui+c_huex_lfo*p_lock_smoothed[14]; 394 | 395 | /**lfo zones**/ 396 | 397 | d_x+=c_x*xLfoAmp*sin(ofGetElapsedTimef()*xLfoRate); 398 | d_y+=c_y*yLfoAmp*sin(ofGetElapsedTimef()*yLfoRate); 399 | d_z+=c_z*zLfoAmp*sin(ofGetElapsedTimef()*zLfoRate); 400 | d_rotate+=c_rotate*rotateLfoAmp*sin(ofGetElapsedTimef()*rotateLfoRate); 401 | /**shader zones**/ 402 | 403 | framebuffer0.begin(); 404 | shader_mixer.begin(); 405 | 406 | //videoGrabber.getTextureReference().draw(0, 0, 320, 640); 407 | if(scaleswitch==0){ 408 | if(inputswitch==0){ 409 | //videoGrabber.draw(0,0,320,240); 410 | } 411 | if(inputswitch==1){ 412 | cam1.draw(0,0,320,240); 413 | } 414 | } 415 | if(scaleswitch==1){ 416 | if(inputswitch==0){ 417 | //videoGrabber.draw(0,0); 418 | } 419 | if(inputswitch==1){ 420 | if(hdmi_aspect_ratio_switch==0){ 421 | cam1.draw(0,0,640,480); 422 | } 423 | if(hdmi_aspect_ratio_switch==1){ 424 | aspect_fix_fbo.draw(0,0,640,480); 425 | } 426 | } 427 | } 428 | 429 | //send the textures 430 | shader_mixer.setUniformTexture("fb", pastFrames[d_delay].getTexture(),1); 431 | 432 | if(wet_dry_switch==1){ 433 | shader_mixer.setUniformTexture("temporalFilter", pastFrames[(abs(framedelayoffset-framebufferLength)-1)%framebufferLength].getTexture(),2); 434 | } 435 | if(wet_dry_switch==0){ 436 | shader_mixer.setUniformTexture("temporalFilter", dry_framebuffer.getTexture(),2); 437 | } 438 | //send the continuous variables 439 | shader_mixer.setUniform1f("lumakey",d_lumakey_value); 440 | shader_mixer.setUniform1f("fbMix",d_mix); 441 | shader_mixer.setUniform1f("fbHue",d_hue); 442 | shader_mixer.setUniform1f("fbSaturation",d_sat); 443 | shader_mixer.setUniform1f("fbBright",d_bright); 444 | shader_mixer.setUniform1f("temporalFilterMix",d_temporalFilterMix); 445 | shader_mixer.setUniform1f("temporalFilterResonance",d_fb1_x ); 446 | shader_mixer.setUniform1f("fbXDisplace",d_x); 447 | shader_mixer.setUniform1f("fbYDisplace",d_y); 448 | shader_mixer.setUniform1f("fbZDisplace",d_z); 449 | shader_mixer.setUniform1f("fbRotate",d_rotate); 450 | shader_mixer.setUniform3f("fb_huex",ofVec3f(d_huex_mod,d_huex_off,d_huex_lfo)); 451 | shader_mixer.setUniform1f("fbHuexMod",d_huex_mod); 452 | shader_mixer.setUniform1f("fbHuexOff",d_huex_off); 453 | shader_mixer.setUniform1f("fbHuexLfo",d_huex_lfo); 454 | 455 | //send the switches 456 | shader_mixer.setUniform1i("toroidSwitch",toroidSwitch); 457 | shader_mixer.setUniform1i("mirrorSwitch",mirrorSwitch); 458 | shader_mixer.setUniform1i("brightInvert",brightInvert); 459 | shader_mixer.setUniform1i("hueInvert",hueInvert); 460 | shader_mixer.setUniform1i("saturationInvert",saturationInvert); 461 | shader_mixer.setUniform1i("horizontalMirror",horizontalMirror); 462 | shader_mixer.setUniform1i("verticalMirror",verticalMirror); 463 | shader_mixer.setUniform1i("lumakeyInvertSwitch",lumakeyInvertSwitch); 464 | 465 | //send the videoreactive controls 466 | shader_mixer.setUniform1f("vLumakey",vLumakeyValue*c_lumakey_value); 467 | shader_mixer.setUniform1f("vMix",vMix*c_mix); 468 | shader_mixer.setUniform1f("vHue",2.0f*vHue*c_hue); 469 | shader_mixer.setUniform1f("vSat",2.0f*vSaturation*c_sat); 470 | shader_mixer.setUniform1f("vBright",2.0f*vBright*c_bright); 471 | shader_mixer.setUniform1f("vtemporalFilterMix",vTemporalFilterMix*c_temporalFilterMix); 472 | shader_mixer.setUniform1f("vFb1X",vTemporalFilterResonance); 473 | shader_mixer.setUniform1f("vX",.025*vX); 474 | shader_mixer.setUniform1f("vY",.025*vY); 475 | shader_mixer.setUniform1f("vZ",1.25*vZ*c_z); 476 | shader_mixer.setUniform1f("vRotate",vRotate*c_rotate); 477 | shader_mixer.setUniform1f("vHuexMod",1.0f-vHuexMod); 478 | shader_mixer.setUniform1f("vHuexOff",vHuexOff*c_huex_off); 479 | shader_mixer.setUniform1f("vHuexLfo",vHuexLfo*c_huex_lfo); 480 | shader_mixer.end(); 481 | framebuffer0.end(); 482 | 483 | /**sharpening mode**/ 484 | sharpenFramebuffer.begin(); 485 | shaderSharpen.begin(); 486 | framebuffer0.draw(0,0); 487 | shaderSharpen.setUniform1f("sharpenAmount",d_sharpenAmount); 488 | shaderSharpen.setUniform1f("vSharpenAmount",vSharpenAmount*c_sharpenAmount); 489 | shaderSharpen.end(); 490 | sharpenFramebuffer.end(); 491 | 492 | //instead of doing another framebuffer swap we just work with sharpenFramebuffer as the end of the chain 493 | sharpenFramebuffer.draw(0,0,ofGetWidth(),ofGetHeight()); 494 | 495 | /**heres where we manage ping ponging the buffers as well as maintining the circular buffer**/ 496 | pastFrames[abs(framebufferLength-framedelayoffset)-1].begin(); 497 | //if wetdry ==0 then we are in feedforward mode so we feed the buffer from the input source instead 498 | //of from the output source 499 | if(wet_dry_switch==0){ 500 | if(inputswitch==0){ 501 | //videoGrabber.draw(0,0,framebuffer0.getWidth(),framebuffer0.getHeight()); 502 | } 503 | if(inputswitch==1){ 504 | if(hdmi_aspect_ratio_switch==0){ 505 | cam1.draw(0,0,640,480); 506 | } 507 | if(hdmi_aspect_ratio_switch==1){ 508 | aspect_fix_fbo.draw(0,0,640,480); 509 | } 510 | } 511 | //on the other hand we still want to make sure we can smooth out things 512 | //with the temporal filter so that still comes from the last draw 513 | dry_framebuffer.begin(); 514 | sharpenFramebuffer.draw(0,0); 515 | dry_framebuffer.end(); 516 | } 517 | //wetdry==1 means feedback mode 518 | if(wet_dry_switch==1){ 519 | sharpenFramebuffer.draw(0,0); 520 | } 521 | pastFrames[abs(framebufferLength-framedelayoffset)-1].end(); 522 | incIndex(); 523 | 524 | //p_lock biz 525 | if(p_lock_switch==1){ 526 | p_lock_increment++; 527 | p_lock_increment=p_lock_increment%p_lock_size; 528 | } 529 | 530 | //i use this block of code to print out like useful information for debugging various things and/or just to keep the 531 | //framerate displayed to make sure i'm not losing any frames while testing out new features. uncomment the ofDrawBitmap etc etc 532 | //to print the stuff out on screen 533 | ofSetColor(255); 534 | string msg="fps="+ofToString(ofGetFrameRate(),2);//+" z="+ofToString(az,5); 535 | //ofDrawBitmapString(msg,15,15); 536 | } 537 | 538 | //-------------------------------------------------------------- 539 | void ofApp::exit() { 540 | // clean up 541 | midiIn.closePort(); 542 | midiIn.removeListener(this); 543 | } 544 | 545 | //------------------------------------------------------------- 546 | void ofApp::p_lockUpdate(){ 547 | for(int i=0;i maxMessages) { 697 | midiMessages.erase(midiMessages.begin()); 698 | } 699 | } 700 | 701 | //-------------------------------------------------------------- 702 | void ofApp::keyPressed(int key) { 703 | 704 | if (key == '[') {fb_delayamount += 1;} 705 | if (key == ']') { 706 | fb_delayamount = fb_delayamount-1; 707 | if(fb_delayamount<0){ 708 | fb_delayamount=framebufferLength-fb_delayamount; 709 | } 710 | } 711 | //fb1 mix 712 | if (key == 'o') {op += .01;} 713 | if (key == 'p') {op -= .01;} 714 | //fb z displace 715 | if (key == 'a') {az += .0001;} 716 | if (key == 'z') {az -= .0001;} 717 | //fb x displace 718 | if (key == 's') {sx += .0001;} 719 | if (key == 'x') {sx -= .0001;} 720 | //fb y displace 721 | if (key == 'd') {dc += .0001;} 722 | if (key == 'c') {dc -= .0001;} 723 | //fb hue attenuate 724 | if (key == 'f') {fv += .001;} 725 | if (key == 'v') {fv -= .001;} 726 | //fb saturation attenuate 727 | if (key == 'g') {gb += .001;} 728 | if (key == 'b') {gb -= .001;} 729 | //fb brightness attenuate 730 | if (key == 'h') {hn += .001;} 731 | if (key == 'n') {hn -= .001;} 732 | //fb mix 733 | if (key == 'j') {jm += .01;} 734 | if (key == 'm') {jm -= .01;} 735 | //fb lumakey value 736 | if (key == 'k') {kk = ofClamp(kk+.01,0.0,1.0);} 737 | if (key == ',') {kk = ofClamp(kk-.01,0.0,1.0);} 738 | if (key == 'l') {ll += .01;} 739 | if (key == '.') {ll -= .01;} 740 | if (key == ';') {temporalFilterResonance += .01;} 741 | if (key == '\'') {temporalFilterResonance -= .01;} 742 | //fb rotation 743 | if (key == 'q') {qw += .0001;} 744 | if (key == 'w') {qw -= .0001;} 745 | //hue chaos1 746 | if (key == 'e') {er += .001;} 747 | if (key == 'r') {er -= .001;} 748 | //hue chaos2 749 | if (key == 't') {ty += .01;} 750 | if (key == 'y') {ty -= .01;} 751 | //hue chaos3 752 | if (key == 'u') {ui += .01;} 753 | if (key == 'i') {ui -= .01;} 754 | /* 755 | if (key == '1') { 756 | 757 | //clear the framebuffer if thats whats up 758 | framebuffer0.begin(); 759 | ofClear(0, 0, 0, 255); 760 | framebuffer0.end(); 761 | for(int i=0;i