Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
oneseconds
Website:
http://www.oneseconds.com
Twitter Link:
http://www.twitter.com/oneseconds
Facebook Link:
http://www.facebook.com/oneseconds
oneseconds's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Simple serial/osc control applet taking up 50% of cpu?
[0 Replies]
20-Jul-2011 05:39 AM
Forum:
Contributed Library Questions
Hi All, my first post as a newbie.
I developed an applet that controls a Kramer matrix switcher trough serial, and receives OSC from another program.
All works fine, but it takes up 50% of my macbook pro's cpu. I figured out that the serial library could be the cause of this.
Is this normal behaviour for the serial library, or is my coding the cause? Any (optimisation) tips welcome!
Thanks!
import processing.serial.*;
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
Serial myPort;
void setup() {
oscP5 = new OscP5(this,11111);
myPort = new Serial(this, Serial.list()[0], 9600);
delay(1000);
}
void draw() {
}
void oscEvent(OscMessage theOscMessage) {
float firstValue = theOscMessage.get(0).floatValue();
float secondValue = theOscMessage.get(1).floatValue();
float thirtValue = theOscMessage.get(2).floatValue();
if (thirtValue == 1) {
int[] pip = {1, int(firstValue), int(secondValue), 129} ;
for (int i=0; i< 4; i=i+1){
myPort.write(pip[i]);
}
myPort.clear();
}
}
«Prev
Next »
Moderate user : oneseconds
Forum