|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectoscP5.OscProperties
public class OscProperties
osc properties are used to start oscP5 with more specific settings. osc properties have to be passed to oscP5 in the constructor when starting a new instance of oscP5.
/**
* oscP5properities by andreas schlegel
* example shows how to use osc properties.
* if you need more specific settings for your osc session,
* osc properties serves your needs.
* oscP5 website at http://www.sojamo.de/oscP5
*/
import oscP5.*;
import netP5.*;
OscP5 oscP5;
void setup() {
size(400,400);
frameRate(25);
/* create a new osc properties object */
OscProperties properties = new OscProperties();
/* set a default NetAddress. sending osc messages with no NetAddress parameter
* in oscP5.send() will be sent to the default NetAddress.
*/
properties.setRemoteAddress("127.0.0.1",12000);
/* the port number you are listening for incoming osc packets. */
properties.setListeningPort(12000);
/* Send Receive Same Port is an option where the sending and receiving port are the same.
* this is sometimes necessary for example when sending osc packets to supercolider server.
* while both port numbers are the same, the receiver can simply send an osc packet back to
* the host and port the message came from.
*/
properties.setSRSP(OscProperties.ON);
/* set the datagram byte buffer size. this can be useful when you send/receive
* huge amounts of data, but keep in mind, that UDP is limited to 64k
*/
properties.setDatagramSize(1024);
/* initialize oscP5 with our osc properties */
oscP5 = new OscP5(this,properties);
/* print your osc properties */
println(properties.toString());
}
void mousePressed() {
/* create a new osc message with address pattern /test */
OscMessage myMessage = new OscMessage("/test");
myMessage.add(200);
/* send the osc message to the default netAddress, set in the OscProperties above.*/
oscP5.send(myMessage);
}
void draw() {
background(0);
}
/* incoming osc message are forwarded to the oscEvent method. */
void oscEvent(OscMessage theOscMessage) {
/* print the address pattern and the typetag of the received OscMessage */
print("### received an osc message.");
print(" addrpattern: "+theOscMessage.addrPattern());
println(" typetag: "+theOscMessage.typetag());
}
| Field Summary | |
|---|---|
static int |
MULTICAST
|
static boolean |
OFF
|
static boolean |
ON
|
static int |
TCP
|
static int |
UDP
|
| Constructor Summary | |
|---|---|
OscProperties()
create a new OscProperties Object. |
|
OscProperties(OscEventListener theParent)
|
|
| Method Summary | |
|---|---|
int |
datagramSize()
returns the current size of the datagram bytebuffer. |
String |
eventMethod()
|
Vector<OscEventListener> |
listeners()
|
int |
listeningPort()
returns the port number currently used to receive osc packets. |
int |
networkProtocol()
returns the network protocol being used to transmit osc packets. |
NetAddress |
remoteAddress()
returns a NetAddress of the remote host you are sending osc packets to. |
boolean |
sendStatus()
|
void |
setDatagramSize(int theSize)
set the size of the datagrampacket byte buffer. |
void |
setEventMethod(String theEventMethod)
set the name of the default event method. |
void |
setListeningPort(int thePort)
set port number you are listening for incoming osc packets. |
void |
setNetworkProtocol(int theProtocol)
set the network protocol over which osc messages are transmitted. |
void |
setRemoteAddress(NetAddress theNetAddress)
set the remote host address. |
void |
setRemoteAddress(String theHostAddress,
int thePort)
set the remote host address. |
void |
setSRSP(boolean theFlag)
SRSP stand for Send and Receive on Same Port. |
boolean |
srsp()
you can send and receive at the same port while on a udp con |
String |
toString()
prints out the current osc properties settings. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final boolean ON
public static final boolean OFF
public static final int UDP
public static final int MULTICAST
public static final int TCP
| Constructor Detail |
|---|
public OscProperties(OscEventListener theParent)
public OscProperties()
| Method Detail |
|---|
public Vector<OscEventListener> listeners()
public boolean sendStatus()
public void setRemoteAddress(String theHostAddress,
int thePort)
theHostAddress - StringthePort - intpublic void setRemoteAddress(NetAddress theNetAddress)
theNetAddress - NetAddresspublic void setListeningPort(int thePort)
thePort - intpublic void setDatagramSize(int theSize)
theSize - intpublic void setEventMethod(String theEventMethod)
theEventMethod - Stringpublic void setNetworkProtocol(int theProtocol)
theProtocol - intpublic void setSRSP(boolean theFlag)
theFlag - booleanpublic boolean srsp()
public int listeningPort()
public NetAddress remoteAddress()
public int datagramSize()
public String eventMethod()
public int networkProtocol()
public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||