if (IncomingByte==1)
{
println("last: "+outfile);
ClipIncr++;
IncomingByte=0;
}
in your case ( combine my counter / jeremydouglass clip / your DateStamp // ideas )
you can just reset the x = 0; too, when you change the clip number,
so the movie starts with 000.
also a little MOD to the clip idea,
not use it as filename, use it as path? ( tested “saveFrame” makes the path automatically )
it does make the use of movie maker easier, but not solve the pointer info ( now inside its path ) problem
nevertheless, if xend is still 900
every THE EVENT creates 900 more files and your drive will get full.
and if there is no event you burn your drive ( SSD ? ) as you still
store to the sketch path?
with
nf(clip,3)
clip++
and clip unlimited can get max 1000 sub directories,
again you could limit your clips like
if ( clip++ >= 9 ) clip = 0;
x=0;
get only the last 9 event ( and the running directory )
nice but creates the same ring buffer problem again for the directories
- you must look for the date of the pointer file to know whats the newest one.
// rev 0 make filename
// rev 1 make point file
// rev 2 try clip as path idea what fits to moviemaker
// rev 3 use new win10 ramdisk
// https://www.youtube.com/watch?v=KvjH6p5pB5Q
// http://memory.dataram.com/products-and-services/software/ramdisk
String d0 = "R:/TEMP/"; // use my new WIN 10 / RAMDISK ( with save / recover option so not loose files on reboot!)
//String d0 = ""; // now use sketch path
int clip = 0, clipend = 3; // create max 4 subdirs
String p0 = "event"+nf(clip, 3)+"/"; // make a path
String fn0 = "snap";
int fps = 2; // 2 frames / pictures per sec
int x = 0, xend = 9; // and max 10 files == 5 sec recording time
String fn1 = nf(x, 3);
String fn2 = ".png";
String outfile = p0+fn0+fn1+fn2; // filename
String pointfile = p0+"pointer.txt"; // pointer file at same path
boolean record = true; // init mode RECORDING
void setup() {
size(300, 100);
println("recording: "+record);
frameRate(fps);
} // end function setup
void draw() {
background(200, 200, 0);
recording();
} // end function draw
void recording() { // called from main draw()
if ( record ) {
fn1 = nf(x, 3);
if ( x++ >= xend ) x = 0; // so we start with "000"
p0 = "event"+nf(clip, 3)+"/"; // use clip counter sub dir
outfile = d0+p0+fn0+fn1+fn2; // drive / path / file + counter + .filetype
pointfile = d0+p0+"pointer.txt"; // pointerfile there too
text(outfile, 0, 10); // test show filename in canvas ( to check in files later )
//save(outfile);
saveFrame(outfile); // save every frame
String[] info = {outfile, ""};
saveStrings(pointfile, info); // and record that name in first line of a pointer file
}
} // end function recording
void mousePressed() {
if ( record ) { // toggle recording
record = false;
println("last: "+outfile+" \nrecording: "+record+" ,for start recording must click again");
} else {
record = true;
if (clip++ >= clipend ) clip = 0; // increment and limit recorded clips ( path )
x = 0; // reset filename number
println("recording: "+record);
}
} // end function mousePressed