Max -> OSC -> Processing
Hello,
I seem to be having some trouble.
Been working with the example ASH posted on the max forum, https://cycling74.com/forums/beginner-tut-max-osc-processing/
this is the tutorial
http://www.conceptualinertia.net/aoakenfo/sketch-1
When I copy-paste the finished example, everything works smoothly. But there is a little bit too much going on with the processing side of the code for me to know exactly where I should pull from to create the building blocks of my own Max~Processing OSC communication project.
So naturally, I am trying to start from square one, with the first portion of the example, where the goal is to simply send the message ’42’ via the /foo prepend. For some reason it’s not working for me.
The console reads:
### [2015/5/29 2:5:41] PROCESS @ OscP5 stopped.
### [2015/5/29 2:5:41] PROCESS @ UdpClient.openSocket udp socket initialized.
### [2015/5/29 2:5:42] PROCESS @ UdpServer.start() new Unicast DatagramSocket created @ port 8080
### [2015/5/29 2:5:42] PROCESS @ UdpServer.run() UdpServer is running @ 8080
### [2015/5/29 2:5:42] INFO @ OscP5 is running. you (192.168.0.7) are listening @ port 8080
### [2015/5/29 2:5:42] PROCESS @ OscPlug plugging class sketch_150529b | addrPattern:/foo typetag:i method:foo
OscP5 0.9.9 infos, comments, questions at http://www.sojamo.de/oscP5
### [2015/5/29 2:5:42] PROCESS @ OscP5 stopped.
### [2015/5/29 2:5:42] PROCESS @ UdpClient.openSocket udp socket initialized.
### [2015/5/29 2:5:43] ERROR @ UdpServer.start() IOException, couldnt create new DatagramSocket @ port 8080 java.net.BindException: Address already in use
### [2015/5/29 2:5:43] INFO @ OscP5 is running. you (192.168.0.7) are listening @ port 8080
### [2015/5/29 2:5:43] PROCESS @ OscP5 stopped.
### [2015/5/29 2:5:43] PROCESS @ OscP5 stopped.
### [2015/5/29 2:5:43] PROCESS @ UdpServer.run() socket closed.
________________________________________________________________________________________
This is my source code
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
void setup() {
size(400,400);
frameRate(25);
initOsc();
oscP5 = new OscP5(this,8080);
myRemoteLocation = new NetAddress("127.0.0.1",8080);
}
void initOsc(){
oscP5 = new OscP5(this, 8080);
myRemoteLocation = new NetAddress("127.0.0.1", 8080);
oscP5.plug(this, "foo", "/foo");
}
public void foo(int value){
println("int received! =" + value);
}
___________________________________________________________________________________
along with the v simple max patch
I have tried restarting, changing the ip, changing the port, all to which returns the same results. I have also looked at the send receive example in the oscP5 but to no avail. Comparing my source code with the finished example source code and nothing jumps out. I know that OSC communication works with my setup because both the finished example from ASH and the oscP5sendreceive example work.
What the dingus is happening?
Thanks for any and all help!!!
It seems like you have some redundant code. After framerate(25), delete these:
initOsc();
oscP5 = new OscP5(this,8080);
myRemoteLocation = new NetAddress("127.0.0.1",8080);
}
The function you're declaring with: void initOsc() {... etc. Has what you need.
Heyo thanks for the help! And sorry for the repeat post, it was late- I decided to just post a new discussion and accidentally posted twice- wut.
So glad for your help, though I finally figured out that it was closing each time because I had no void draw() to keep it running.
Took out the redundant coding too
:P