Processing Forum
Change Video Code:import codeanticode.gsvideo.*; // import GSvideo Libraryimport oscP5.*; // import oscP5 Libraryimport netP5.*; // import netP5 Library (part of oscP5 Library)
OscP5 osculator;GSMovie player;
//global variablesint direction;
boolean speedSet = false;boolean isPlaying = true;boolean rollBool = true;boolean pressA = true;boolean pressB;float rollVar;boolean backward;boolean forward;boolean pressUp;boolean pressRight;boolean pressLeft;
String folderPath; // string to specify folderPathboolean saving = false; // boolean to store if current frame will be saved at end of frame
public void setup() {size(640, 480);background(0);
// osculator setuposculator = new OscP5(this, 9000);osculator.plug(this, "xyz", "/wii/1/accel/pry");osculator.plug(this, "buttonA", "/wii/1/button/A");osculator.plug(this, "buttonB", "/wii/1/button/B");osculator.plug(this, "buttonLeft", "/wii/1/button/Left");osculator.plug(this, "buttonRight", "/wii/1/button/Right");osculator.plug(this, "buttonUp", "/wii/1/button/Up");osculator.plug(this, "buttonDown", "/wii/1/button/Down");
// GSvideo setupplayer = new GSMovie(this, "tdogg.mov");player.loop();
}
void draw() {image(player, 0, 0, width, height);
if (pressA) {player.play();speedSet = false;}
if (!pressA) {player.pause();//speedSet = false;}if (forward) {//speedSet = false;forward();}if (backward) {//speedSet = false;backward();}if (pressLeft){buttonLeft();}if (pressRight){buttonRight();}
if (pressUp){buttonUp();}//SAVING THE FRAMEif (saving) { // if the boolean named saving is truesaveFrame(folderPath); // save frame to selected folder (path to folder is stored in folder path)println("FRAME SAVED"); // prints "FRAMED SAVED" in processing displaysaving = false; // set boolean saving to false (otherwise every frame would be saved)}}
void buttonA (float press) {if (press != 0) {//speedSet = false;pressA = !pressA; // toggle}}void xyz (float p, float r, float y, float a) {rollVar = r;if (rollVar <= 0.35) {backward = true;forward = false;}if (rollVar >= 0.65) {forward = true;backward = false;}if (rollVar == 0.5 ) {forward = false;backward = false;}}
void buttonLeft() {player = new GSMovie (this, "tdogg.mov");}
void buttonRight() {player = new GSMovie (this, "bunny.mov");}
void buttonUp () {player = new GSMovie (this, "transit.mov");}