I have created a program that loads multiple instances of the same video. On playback it copies a vertical section of each video to the stage at the correct position (8 sections), essentially re-creating the original clip. The reason for doing this is that each section is controlled by a live audio input allowing me to jump to different times, alter playback speed etc. for each of them individually.
All is working fine, but I am now trying to implement a feature that allows you to select a different video clip to load and this is giving me some playback issues. I can load and replace the video with no problems (program freezes on loading new clip but this is fine) but once loaded the new video plays back slowly and the frame rate drops significantly.
I am guessing this has something to do with the fact that the old videos are not being removed from memory? and am unsure as to how to do this. have had a look through the forums and tried 'System.gc();' but has achieved nothing.
I have posted the section of code that deals with setting up and loading the video below and was wondering if anyone had any suggestions?
String vidFile = "chile - 151.mov"; //stores current video file path and name
void initVideo() {
// Loading the movies into the array
for (int i = 0; i < myMovies.length; i ++ ) {
myMovies[i] = new Movie(this, vidFile);
myMovies[i].loop();
}
// Initializing all the elements of the array (video objects)
for (int i = 0; i < sections.length; i++) {
sections[i] = new Section(i);
}
}
//called via selectInput() when new video file is selected
void fileSelected(File selection) {
if (selection == null) {
println("Window was closed or the user hit cancel.");
I am at the start of creating a program that can draw an image then copy sections of that image (in irregular shapes e.g. triangle) and overlay them on the stage. To extract sections of the initial drawing I have followed the 'graphic image mask' example here (
http://processing.org/discourse/yabb2/YaBB.pl?num=1231933751/1) but although I am setting no background() on any of the off-screen buffers the program will not preserve the background transparency.
It also seems to make the graphics crispy when drawing them to the stage although I have used the smooth() function throughout.
I am guessing this is something to do with the conversion from PGraphics to PImage but don't think I can apply a mask to PGraphic?
Not sure if I'm doing something wrong or if there is a better way to approach this problem...
I have a slight problem with a section of a larger program I am writing. I have distilled the section causing the issue which basically generates a radius and attempts to evenly distribute ellipses of a set diameter around it. (code below)
Although it largely works, often when drawing the circle it seems that it is not dividing the angles properly causing a gap between the last and first ellipse drawn. Am guessing this is to do with the way I am dividing then re-assembling the angles (leaving a remainder) but cannot work out how to correct it.
Hope this makes sense, any advice would be appreciated.
Thanks
void setup() {
size(800, 800);
smooth();
}
void draw() {
}
void mouseReleased() {
drawRing(mouseX, mouseY);
}
void drawRing(int cX, int cY) {
background(140); //draw BG
float r = random(100, 200); //radius of circle
float circWid = 20.0; //width of ellipses
float theta = circWid / r; //arc angle in radians
//calculates number of dots that can be draw around circumference
float numDots = int(radians(360.00)/theta);
pushMatrix();
translate(cX, cY);
for (float p = 0; p < numDots; p++) {
float myTheta = p*theta; //calculate current angle