void mousePressed() { if (mouseButton == LEFT) { if (sourceManager.dir != null) { sourceManager.importURI(sourceManager.dir + "/" + sourceManager.selection[(int)random(sourceManager.selection.length)]); } } if (mouseButton == RIGHT) { snapshot(); } } boolean videoRecord; void mouseWheel(MouseEvent event) { if (event.getCount() < 0) renderSize += 8; else renderSize -= 8; renderSize = constrain(renderSize, 8, 15000); println("Render size: " + renderSize); } String[] params; void keyPressed() { if (key == 'c') { if (fxManager.fxList.size() < maxFx) fxManager.addFx(new DARKER()); } if (key == 'r') { for (int i = 0; i < fxManager.fxList.size(); i ++) { for (int j = 0; j < fxManager.fxList.get(i).shader.params.size(); j++) { fxManager.fxList.get(i).shader.params.get(j).randomize(); } } } if (key == 'x') { videoRecord = !videoRecord; if (videoRecord) { println("Started video recording"); videoExport = new VideoExport(this, "data/videos/" + str(frameCount + int(uptime)) + ".mp4", renderer); //String[] settings = {"[ffmpeg]","-y","-f","rawvideo","-vcodec","rawvideo","-s",str(renderer.width)+"x"+str(renderer.height),}; videoExport.setFrameRate(frameRate); videoExport.setQuality(100, 0); // (crf, audiobitrate) String videoSize = str(renderer.width)+"x"+str(renderer.height); videoExport.setFfmpegVideoSettings( new String[]{ "[ffmpeg]", // ffmpeg executable "-y", // overwrite old file "-f", "rawvideo", // format rgb raw "-vcodec", "rawvideo", // in codec rgb raw "-s", videoSize, // size "-pix_fmt", "rgb24", // pix format rgb24 "-r", "[fps]", // frame rate "-i", "-", // pipe input //"-vf", "scale="+str(renderer.width)+":"+str(renderer.height)+":force_original_aspect_ratio=decrease", "-an", // no audio "-vcodec", "h264", // out codec h264 "-pix_fmt", "yuv420p", // color space yuv420p "-crf", "[crf]", // quality "-metadata", "comment=[comment]", // comment "[output]" // output file }); videoExport.setDebugging(true); videoExport.startMovie(); } else { println("Ended video recording"); videoExport.endMovie(); videoExport.dispose(); } } if (key == 'f') { if (fxManager.fxList.size() < maxFx) fxManager.addFx(new FM()); } if (key == 'j') { if (fxManager.fxList.size() < maxFx) fxManager.addFx(new DRAWSTROKES()); } if (key == 'h') { if (fxManager.fxList.size() < maxFx) fxManager.addFx(new DRAWGENERATIVE()); } if (key == 'd') { if (fxManager.fxList.size() < maxFx) fxManager.addFx(new ASDFPIXELSORT()); } if (key == 'b') { if (fxManager.fxList.size() < maxFx) fxManager.addFx(new BRIGHTER()); } if (key == 'e') { if (fxManager.fxList.size() < maxFx) fxManager.addFx(new DISTORTER()); } if (key == 'w') { if (fxManager.fxList.size() < maxFx) fxManager.addFx(new WZIP()); } if (key == 'g') { if (fxManager.fxList.size() < maxFx) fxManager.addFx(new GRAUZONE()); } if (key == 'q') { if (fxManager.fxList.size() < maxFx) fxManager.addFx(new SLITSCAN()); } if (key == ' ') { } if (key == 'o') { renderSize = 10000; } if (key == '1') { mode = 0; } if (key == '2') { if (mode != 1) sourceManager.fallback(); mode = 1; } if (keyCode == KeyEvent.VK_F10) { airisRender(5000); //15000 would be fine as well i guess } if (key == 'a') { if (fxManager.fxList.size() < maxFx) fxManager.addFx(new AUECHO()); } if (key == 'v') { fxManager.removeFx(fxManager.fxList.size()-1); //remove last in arraylist // fxManager.removeFx(2); //remove at position in arraylist } /* if (key == 'a') { params = loadStrings(dataPath("params.txt")); for (int i = 0; i < params.length; i++) { println(params[i]); } }*/ } int guiOffsetTop = 0; boolean guiHidden; String noparams = "no directly controllable parameters, try play/ pausing to randomize"; void drawGUI(int topOffset) { fill(255); for (int i = 0; i < fxManager.fxList.size(); i++) { textSize(20); textAlign(RIGHT); int fi = i+1; float textOffset = textWidth(fxManager.fxList.get(i).shader.name); fill(0, 0, 0, 255); rect(width-(textOffset+54), 8+(i*65)+topOffset, textOffset+54, 30); fill(255); text("[" + fi + "] " + fxManager.fxList.get(i).shader.name, -10, 10+(i*65)+topOffset, width, 100); String playText = (fxManager.fxList.get(i).shader.animating) ? "animated" : "manual set"; fill(75, 75, 75, 255); rect(width-(textOffset+54+textWidth(playText)), 10+(i*65)+5+topOffset, textWidth(playText), 25); fill(255); textAlign(RIGHT); textSize(15); text(playText, -(textOffset+65), 10+(i*65)+5+topOffset, width, 100); textOffset = 0; for (int j = 0; j < fxManager.fxList.get(i).shader.params.size(); j ++) { textOffset += textWidth(fxManager.fxList.get(i).shader.params.get(j).name) + textWidth(fxManager.fxList.get(i).shader.params.get(j).formattedValue()) +15; } fill(75, 75, 75, 255); textOffset = (textOffset == 0) ? textWidth(noparams)+15 : textOffset; rect(width-textOffset-15, 37+(i*65)+topOffset, textOffset+15, 25); fill(255); textOffset = 0; textAlign(RIGHT); if (fxManager.fxList.get(i).shader.params.size()>0) { for (int j = 0; j < fxManager.fxList.get(i).shader.params.size(); j ++) { text(fxManager.fxList.get(i).shader.params.get(j).name + ": " + fxManager.fxList.get(i).shader.params.get(j).formattedValue(), -textOffset-10, 40+(i*65)+topOffset, width, 100); textOffset += textWidth(fxManager.fxList.get(i).shader.params.get(j).name) + textWidth(fxManager.fxList.get(i).shader.params.get(j).formattedValue()) +15; } } else { text(noparams, -textOffset-10, 40+(i*65)+topOffset, width, 100); } } } PImage droppedImage; void dropEvent(DropEvent theDropEvent) { sourceManager.importURI(theDropEvent.filePath()); }