Hello everyone,
Thank you for your attention and your help.
I am starting a project with Processing (I am a novice) and I was nevertheless able to compile a script
which allows me to assign the 26 letters from my computer keyboard to a video (“keypressed”
function ).
I - FIRST QUESTION
I would like when I type for example “A” on my computer keyboard that the corresponding video “A”;
plays in loop until I choose another letter and so on …
I would like to be able to play videos in a loop and in full screen, one after the other, without
the sounds overlapping.
My problem: when I loop my videos, the sound of my video played is overlapped on the sounds of
the following video, which creates a kind of sound cacophony … as if the program keeps in memory
the current sound content ?
Did I make several mistakes when writing my program? Is there a function / solution to avoid this
overlapping?
II. SECOND QUESTION
I would like to create ten thematic “SketchBooks” (each one including 26 videos), and I would like to
access them via the keypad numbers (from 0 to 9).
I would like to be able to assign from 0 to 9 my thematic “SketchBook” and play for each
“SketchBook” the 26 videos corresponding to the letters of the alphabet… but also to have the
possibility of being able to go from one video to another from another “SketchBook”
For example, I would like so switch from “SketchBook” n.3 + letter A to “SketchBook” n.4 +
letter T
Below is the script that I have begun to compile : how to play the video “A” assigned to the “A”
key on my keyboard :
Script :
import processing.video.*;
Movie theMov;
int VideoPlaying;
// name the “boolean” corresponding to video 1 to 26 (Vid1 to Vid26).
boolean Vid1 = false;
boolean Vid2 = false;
//up to 26
boolean isPlaying;
//Videos
Movie Video1;
Movie Video2;
//up to 26
// SetUp
void setup() {
size(800, 600);
// Name the video
Video1 = new Movie(this, ''a.mov'');
Video2 = new Movie(this, ''b.mov'');
//up to 26 (of a.mov to z.mov)
}
void draw() {
toogle();
if (Vid1) {
println("video1");
background(0);
Video1.play();
//Video1.loop();
background(0);
image(Video1, 0, 0, width, height);
//up to 26
}
}
void movieEvent(Movie m) {
m.read();
}
void keyPressed() {
//If I click on A I play the video "A"
if (key == 'a') {
VideoPlaying = 1;
println(VideoPlaying);
}
}
//up to 26
void toogle() {
if (VideoPlaying == 1)
{
Vid1 = true;
Vid2 = false;
Vid3 = false;
Vid4 = false;
Vid5 = false;
Vid6 = false;
Vid7 = false;
Vid8 = false;
Vid9 = false;
Vid10 = false ;
Vid11 = false;
Vid12 = false;
Vid13 = false;
Vid14 = false;
Vid15 = false ;
Vid16 = false;
Vid17 = false;
Vid18 = false ;
Vid19 = false;
Vid20 = false ;
Vid21 = false;
Vid22 = false;
Vid23 = false;
Vid24 = false;
Vid25 = false;
Vid26 = false;
// repeat up to 26 for each video "True" for the video in question, "False" for the others
}
}