Maybe it is an issue with the installed codecs.
↧
Re : JavaSound Minim Errors
↧
Re : Frame-differencing on a Movie (file) instead of Capture
No tip on how to do framedifferencing on a movie?
↧
↧
Re : Movie Maker Tool
Same problem here...:S
↧
Re : Frame-differencing on a Movie (file) instead of Capture
I rarely, if ever, use the video library, but I experimented a bit.
In addition to the changes you described (and pointing to a movie file on my computer), I made two changes:
- Set the size of the sketch to the one of the movie; and remove the P2D declaration, as it is OpenGL in 2.0, and you reported an error with it.
- Compute: numPixels = width * height; ie. using the real size of the movie. I hard-coded it, because apparently the size of the movie isn't available in setup().
Perhaps we can use a trick to get the size after reading the first frame, but it should get you going.
In addition to the changes you described (and pointing to a movie file on my computer), I made two changes:
- Set the size of the sketch to the one of the movie; and remove the P2D declaration, as it is OpenGL in 2.0, and you reported an error with it.
- Compute: numPixels = width * height; ie. using the real size of the movie. I hard-coded it, because apparently the size of the movie isn't available in setup().
Perhaps we can use a trick to get the size after reading the first frame, but it should get you going.
↧
Re : How to get the GL and GLU in P2.0 b3
Using this now...
- pgl = (PGraphicsOpenGL) g;
- gl = g.beginPGL().gl.getGL2();
- glu = new GLUgl2();
↧
↧
updating text
Hi, new to processing and this might seem obvious but how do i update text? the examples i've seen don't seem to work and involve a kludge of drawing over the text with a rectangle (surely this isn't the answer....)
the application is simple - it writes to a serial port and gets an answer back from an arduino with ambient temp and the time. the text scrolls down the screen with the current code.
import processing.serial.*;
Serial myPort;
String val;
void setup()
{
size(500, 500);
myPort = new Serial(this, "COM5", 9600);
}
void draw()
{
frameRate(1);
textSize(32);
myPort.write("temp?");
while ( myPort.available() > 0) {
val += char(myPort.read());
}
println(val);
if (val != null && val.length() > 9) {
text(val.substring(9),50,100);
}
}
↧
Re : updating text
This should be in red, blinking letters in the first page of the Processing tutorial (unless it is there already): unless you make a specific, cumulative kind of sketch, always start your draw() function with a background() call (or similar).
Otherwise, everything you draw on each frame will just be drawn over the previous frames.
Note: frameRate() and textSize() calls can be safely moved to setup(): no need to repeatedly set them.
Otherwise, everything you draw on each frame will just be drawn over the previous frames.
Note: frameRate() and textSize() calls can be safely moved to setup(): no need to repeatedly set them.
↧
Re : updating text
the behavour i see is like a new line being printed with the text appearing under the last text line, not over the top of each other?
↧
Video list array, out of memory
Hi,
I'm working on a video playlist application which i can control with my mobile over internet.
My code work fine but after playing 7 videos, the application say to me that she don't want to play more video because it is out of memory.
I notice that i have to remove each video i play after it finished but i don't know how.
Somebody know how to avoid to keep video in memory after it played ?
Thanks.
Here is the code :-)
import processing.net.*;
import processing.video.*;
int port = 5204;
Server myServer;
String argumentA;
PFont f;
Movie movie;
String[] numbers = {
"comp5.mov",
"s-dikinson.mov",
"s-GS.mov",
"s-meca.mov",
"s-mariner.mov",
"s-rising.mov",
};
PImage img;
void setup()
{
size(1500, 900);
background(0);
myServer = new Server(this, port);
f = createFont("Arial",16,true);
movie = new Movie(this, numbers[2]);
movie2 = new Movie(this, numbers[0]);
movie.play();
}
void movieEvent(Movie m) {
m.read();
}
int varX=1280;
int varY=720;
void draw()
{
image(movie, width/2-640,height/2-360, varX, varY);
Client thisClient = myServer.available();
if (thisClient !=null) {
String whatClientSaid = thisClient.readString();
if (whatClientSaid.indexOf("login=")!=-1) {
thisClient.write("You will be disconnected now.rn");
println(thisClient.ip() + " has been disconnected");
int argumentA2 = whatClientSaid.indexOf("&");
int argumentA1 = whatClientSaid.indexOf("login");
argumentA = whatClientSaid.substring(argumentA1+6,argumentA2);
println(argumentA);
background(0);
img = loadImage("jon.jpg");
myServer.disconnect(thisClient);
}
}
float md = movie.duration();
float mt = movie.time();
if (mt == md) {
movie.stop();
movie = new Movie(this, numbers[2]);
movie.play();
}
}
↧
↧
Re : updating text
I dont't have serial but this is the idea when you want the last entry on top of a list:
you store the serial data in temp (line 16) and after the while loop you place temp with a line break \n in front of val (line 20).
Greetings, Chrisir
- String val="pwwe";
- int j=0;
- void setup()
- {
- size(500, 500);
- frameRate(1);
- textSize(32);
- }
- void draw()
- {
- background(111);
- //myPort.write("temp?");
- int i=0;
- String temp="";
- while ( i < 10) {
- temp = temp+char(i+j+65) ;
- i++;
- }
- j++;
- val = temp+"\n"+val;
- println(val);
- if (val != null && val.length() > 0) {
- text(val, 50, 100);
- }
- }
↧
Re : updating text
doesn't processing allow some kind of separation of the formatting and code though? why do i need a loop to create new text in the same place as old text?
↧
Re : Video list array, out of memory
Just a wild guess:
Have you tried using movie.finish(); as well?
Have you tried using movie.finish(); as well?
↧
Re : Video list array, out of memory
nope..but when i'm trying this, it does not recognize the command :
"The function finish() does not exist"
↧
↧
Re : updating text
Hm...
Maybe look at libs like g4p or controlp5.....
↧
Re : updating text
"the behavour i see is like a new line being printed with the text
appearing under the last text line, not over the top of each other?"
Uh? It looks like you are always displaying the text at the same place, though.
I don't have a serial device too, so I cannot experiment.
Unless you are meaning that's the behavior you look for. In this case, Chrisir is showing the right way.
Uh? It looks like you are always displaying the text at the same place, though.
I don't have a serial device too, so I cannot experiment.
Unless you are meaning that's the behavior you look for. In this case, Chrisir is showing the right way.
↧
Re : updating text
When you only want to see the last line / temp var (in my code), show it via text() and don't use val.
That works together with background().
You can also choose a font and a fontsize and a color for the text.
text() also allows to define a rect that will not be exceeded even by too long text.
Hope this helps!
Greetings, Chrisir
like this...
- //String val="pwwe";
- int j=0;
- void setup()
- {
- size(500, 500);
- frameRate(1);
- textSize(32);
- }
- void draw()
- {
- background(111);
- //myPort.write("temp?");
- int i=0;
- String temp="";
- while ( i < 10) {
- temp = temp+char(i+j+65) ;
- i++;
- }
- j++;
- // val = temp+"\n"+val;
- //println(val);
- if (temp != null && temp.length() > 0) {
- text(temp, 50, 100, 110, 200);
- }
- }
↧
Re : frameRate() can crash 2.0b7
I'm seeing a larger problem with regard to the crash reported here. If you have a similar sketch and do a resize, it crashes as well. They seem to be fixed by resetting the gl in the draw.
- gl = pgl.beginPGL().gl.getGL2();
However, this doesn't always work. I have shaders where I use the gl as such:
It will crash on this regardless if I reset the gl or not.
- gl.glUseProgramObjectARB(programObject);
It will crash on this regardless if I reset the gl or not.
↧
↧
Re : updating text
I know why my example wasn't working, I declared val as a global and each iteration of draw() was appending to the variable.
doh!!!
↧
PLEASE HELP!!! Serial Error
This is the code I worked on over summer and it worked perfectly fine. Now I after a few months, it magically doesn't want to work anymore. The following is my ARDUINO code:
- int ledPin;int ledPin13 = 13;int ledPin12 = 12;int ledPin11 = 11;int sensorPin = A2;int sensorValue = 0;int analogPin = 0;char c = 0;void setup(){pinMode( ledPin13, OUTPUT );pinMode( ledPin12, OUTPUT);pinMode( ledPin11, OUTPUT);Serial.begin( 57600 );}void loop(){// Wait for a character to arrive at the serial port.if( Serial.available() > 0 ){// Read one byte (character).c = Serial.read();switch( c ){case 'e':Serial.println("case e received");digitalWrite( ledPin13, HIGH );Serial.println("Pin 13 HIGH");break;case 'i':Serial.println("case i received");digitalWrite( ledPin12, HIGH );Serial.println("Pin 12 HIGH");break;case 'q':Serial.println("case q received");sensorValue = analogRead( sensorPin )/32;Serial.print(sensorValue);analogWrite(ledPin11, sensorValue);Serial.println("Pin 11 HIGH");break;case 'z':Serial.println("case z received");digitalWrite( ledPin13, LOW );Serial.println("Pin 13 LOW");break;case 'p':Serial.println("case p received");digitalWrite( ledPin12, LOW );Serial.println("Pin 12 LOW");break;case 'l':Serial.println("case l received");digitalWrite( ledPin11, LOW );Serial.println("Pin 11 LOW");break;}}}
Next is my PROCESSING code:
- import processing.serial.*; //Import the serial library into your sketchimport cc.arduino.*; //Import the Arduino-Firmata library into your sketchArduino arduino; //Create an instance of Arduino named arduino (can be any name)char e;int ledPin;char serial;Serial scope;String adaptor= "/dev/tty.usbmodem1a21";void portConnect(){int portNumber = 99;String [] ports;println(Serial.list());ports = Serial.list();for(int j = 0; j< ports.length; j++) {if(adaptor.equals(Serial.list()[j])) portNumber = j;}if(portNumber == 99) portNumber = 0;String portName = Serial.list()[portNumber];println("Connected to "+portName);scope = new Serial(this, portName, 57600);scope.bufferUntil(10);}void serialEvent(Serial scope) { // this gets called every time a line feed is receivedString recieved = scope.readString() ;println(recieved + " from serial port"); // show it at the bottom of the processing window// also do the stuff you want to do when you get things back from the arduino}void setup() {size(200, 200);print(arduino.list());arduino = new Arduino(this, Arduino.list()[0], 57600); //defines arduino our board and sets the communication ratearduino.pinMode(ledPin, Arduino.OUTPUT);}void keyPressed() {print(key);delay(10);switch (key) {case 'e':case 'E':scope.write('e');break;case 'i':case 'I':scope.write('i');break;case 'q':case 'Q':scope.write('q');break;}};void keyReleased() {delay(10);switch (key) {case 'e':case 'E':scope.write('z');break;case 'i':case 'I':scope.write('p');break;case 'q':case 'Q':scope.write('l');break;}}
The error I am getting is: Error inside Serial.<init.()
and it highlights the following code:
arduino = new Arduino(this, Arduino.list()[0], 57600); //defines arduino our board and sets the communication rate
I have no idea what is wrong.
I would like to also mention that I had to import the following file so it would stop failing:
librxtxSerial.jnilib
When I didn't have this plugin I get the error that my code quit while using the plugin.
Please help!
↧
Re : PLEASE HELP!!! Serial Error
It is often better to show a non-truncated version of the error message. I guess it tells ArrayIndexOutOfBounds... This means that Arduino.list() returns an empty list. Perhaps your device is no longer recognized.
↧