hi, i'm new with processing code. i'm trying to change video footage, with visual effects based on audio in. the code works, but after a while (1-3 random video changes) it stuck and the video or the effects stop working, everything freez (including println lines..)
most of time, if the sound level getting higher, that happens. i get the same warning message everytime:
2016-01-24 23:38:55.263 java[49121:34205664] 23:38:55.263 WARNING: 140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.
this is the code so far:
import processing.video.*;
import processing.sound.*;
AudioIn input;
Amplitude rms;
int scale;
Movie myMovie;
String[] one = {"a.mp4","b.mp4","c.mp4"};
int a = 0;
float md = 0;
float mt = 0;
void setup()
{
size(1440 ,900);
frameRate(25);
background(0);
myMovie = new Movie(this, one[int(random(one.length))]);
myMovie.play();
input = new AudioIn(this, 0); //Create an Audio input and grab the 1st channel
input.start(); // start the Audio Input
rms = new Amplitude(this); // create a new Amplitude analyzer
rms.input(input); // Patch the input to an volume analyzer
}
void draw()
{
scale=int(map(rms.analyze(), 0, 0.5, 1, 350));
if(a == 0) {
image(myMovie, 0, 0,900,900);
}
image(myMovie, 0, 0,900,900);
float md = myMovie.duration();
float mt = myMovie.time();
println(md - mt);
if (Math.abs(md - mt)<0.1){// to find the end of the movie
myMovie = null;
myMovie = new Movie(this, one[int(random(one.length))]);
myMovie.play();
}
// rms.analyze() return a value between 0 and 1. To adjust the scaling and mapping of an ellipse we scale from 0 to 0.5
if ((rms.analyze()>0)&&(rms.analyze()<3))
tint (scale*20,scale*4,scale*4);
myMovie.speed(scale*0.2);
}
void movieEvent(Movie m) { // Called every time a new frame is available to read
m.read();
}
what am i doing wrong? any help will be great! thanks, Ravit :)