[jitter] @loopreport being slow
vade
doktorp at mac.com
Thu Aug 23 10:22:53 MDT 2007
- Previous message: [jitter] @loopreport being slow
- Next message: [jitter] Re: Text through Matrix
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
A while ago I wrote a patch that uses javascript that got me timing
as tight as final cut.
it was an automatic steven segal trailer generator (dont ask, long
story - I need to put that project online.. ), the crux of the
situation was that yes indeed, loop-report reports when it loops, but
your movies also have to have preroll enables otherwise you 'wait'
for disk access/spooling the next movie. Thus everything is a bit late.
I used a modified JS moviebank with some loadram logic based on the
timescale of the movie. So id load a bit of the movie into ram, and
be ready to go. I did a bit of guesswork at the latency involved, and
found on my system timescale * 0.5 was enough to load into ram to
compensate for the disk.
For some reason I did not use this patch, but a patch that did the
same thing without JS, within a poly~ (polymovie style), I blame
steven segal for that one... *cough*
-----
// vade --added -- changed from 3
outlets = 4;
var vdim = [320,240];
var vindex = 0;
var vcount = 0;
var movarray = new Array();
var outmatrix = new Array();
var dummymatrix = new JitterMatrix(4,"char",vdim[0],vdim[1]);
var filenames = new Array();
// might want to try using an output array to avoid black flicker
when switching movies
function bang()
{
if (vcount) {
movarray[vindex].matrixcalc(outmatrix[vindex]/*null*/,outmatrix
[vindex]);
outlet(0,"jit_matrix",outmatrix[vindex].name);
} else {
outlet(0,"jit_matrix",dummymatrix.name);
}
// vade -- added here...
if(vcount)
{
// check to see if the movie is about to end (0.1 frame from end of
movie playing in QTUNITS), and bang out of 4th outlet
//(ive added one more outlet!
if(movarray[vindex].time >= (movarray[vindex].duration - ( 0.1 *
movarray[vindex].timescale)) )
{
outlet(3, "bang");
// since we end the movie just a *bit* early, set the time back to
0 so next time we loop, we dont play 1/10th or
// whatever of a frame.
movarray[vindex].time = 0;
}
}
}
function index(i)
{
if (i>=vcount)
i = vcount-1;
if (i<0)
i = 0;
movarray[vindex].stop();
vindex = i;
movarray[vindex].start();
}
function readfolder(foldername)
{
var fold;
var i,rv;
fold = new Folder(foldername);
fold.typelist =
["MooV","PICT","MPEG","GIFf","JPEG","PNG","TIFF","SWFL","8BPS","BMP","Vf
W"]
if (fold.count) {
// reset old movies
for (i=0;i<vcount;i++) {
movarray[i].dispose();
movarray[i].matrixcalc(dummymatrix/*null*/,dummymatrix);
}
// build filename array
vcount = 0;
fold.reset();
filenames = new Array();
outlet(1,"clear");
// load new movies
for (i=0;i<fold.count;i++) {
fold.next();
filenames[vcount] = fold.pathname + "/" + fold.filename;
movarray[vcount] = new JitterObject("jit.qt.movie");
movarray[vcount].autostart = 0;
rv = movarray[vcount].read(filenames[vcount]);
if (rv[1]==1) { // success, read returns an array [filename,success]
if (!outmatrix[vcount])
outmatrix[vcount] = new JitterMatrix(4,"char",vdim[0],vdim[1]);
outlet(1,"append",fold.filename);
movarray[vcount].matrixcalc(outmatrix[vcount]/*null*/,outmatrix
[vcount]);
// added --
movarray[vcount].loop = 0; // dont loop, we only want to play once.
movarray[vcount].loadram(0 , movarray[vcount].timescale*.5) ;
// ---
vcount++;
}
}
if (vindex>=vcount)
vindex = 0;
movarray[vindex].matrixcalc(outmatrix[vindex]/*null*/,outmatrix
[vindex]);
outlet(2,vcount);
}
}
function dim(width,height)
{
vdim[0] = width;
vdim[1] = height;
for (i=0;i<vcount;i++) {
outmatrix[i].dim = vdim;
}
dummymatrix.dim = vdim;
}
function anything()
{
//pass off all other messages to the movie object
var a = arrayfromargs(arguments);
if (Function.prototype.isPrototypeOf(movarray[vindex][messagename])) {
movarray[vindex][messagename](a);
} else {
movarray[vindex][messagename] = a;
}
}
v a d e //
www.vade.info
abstrakt.vade.info
- Previous message: [jitter] @loopreport being slow
- Next message: [jitter] Re: Text through Matrix
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
