Package net.paulhertz.pixelaudio.example
Class Bagatelle.NetworkDelegate
java.lang.Object
net.paulhertz.pixelaudio.example.Bagatelle.NetworkDelegate
- Enclosing class:
- Bagatelle
A class to handle network connections over UDP, for example, with a Max or Pd patch.
Used by applications that implement the PANetworkClientINF.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PANetworkClientINFprivate intprivate intprivate oscP5.OscP5private intprivate processing.core.PAppletprivate netP5.NetAddressprivate Stringprivate netP5.NetAddressprivate String -
Constructor Summary
ConstructorsConstructorDescriptionNetworkDelegate(PANetworkClientINF app, String remoteFromAddr, String remoteToAddr) NetworkDelegate(PANetworkClientINF app, String remoteFromAddr, String remoteToAddr, int inPort, int outPort) -
Method Summary
Modifier and TypeMethodDescriptionvoidcontrolMsg(String ctrl, float val) voiddrawHit(int... args) Play audio/animation events using a supplied list of event points.intintintnetP5.NetAddressnetP5.NetAddressprivate voidinit()voidSET UP RESPONSE TO INCOMING MESSAGES Call the osc.plug(Object theObject, String the MethodName, String theAddrPattern) or osc.plug(Object theObject, String the MethodName, String theAddrPattern, String the TypeTag) to setup callbacks to methods in the current object ("this") or other object instance.voidmultislider(int... args) Receive Max MultiSlider data.(package private) voidoscEvent(oscP5.OscMessage theOscMessage) Post address pattern and typetag from incoming osc message to the console.voidSends a "/clear" message.voidoscSendDelete(int index) Sends a "/del" message with an index.voidoscSendDrawPoints(ArrayList<processing.core.PVector> drawPoints) Sends a list of points.voidoscSendFileInfo(String path, String name, String tag) Sends a "/file" message with file path, file name, and file tag.voidoscSendMouseClicked(int sampleX, int sampleY, int sample) Sends display coordinates and audio buffer index associated with a mouse click.voidoscSendMultiSlider(ArrayList<processing.core.PVector> drawPoints) Sends a list of points as possible Max MultiSlider settings.voidoscSendOnOff(int index, boolean state) Sends an "/onoff" message with an index and state value.voidoscSendSetnum(int index, float value) Sends a "/setnum" message with an index and value.voidoscSendTimeStamp(int timeStamp, int timeOffset) Sends a "/time" message with a time stamp and offset.voidoscSendTrig(int index) Sends a trigger message, "/trig", with a numerical value.voidparseKey(int arg) Interprets a received value as a char and uses it as an argument toparseKey().voidsampleHit(int sam) Play an audio event at a position in the audio buffer.voidsetDrawCount(int drawCount) voidsetInPort(int inPort) voidsetOutPort(int outPort) voidsetRemoteFrom(netP5.NetAddress remoteFrom) voidsetRemoteTo(netP5.NetAddress remoteTo)
-
Field Details
-
parent
private processing.core.PApplet parent -
app
-
osc
private oscP5.OscP5 osc -
inPort
private int inPort -
outPort
private int outPort -
remoteFromAddress
-
remoteToAddress
-
remoteFrom
private netP5.NetAddress remoteFrom -
remoteTo
private netP5.NetAddress remoteTo -
drawCount
private int drawCount
-
-
Constructor Details
-
NetworkDelegate
public NetworkDelegate(PANetworkClientINF app, String remoteFromAddr, String remoteToAddr, int inPort, int outPort) -
NetworkDelegate
-
NetworkDelegate
-
-
Method Details
-
init
private void init() -
getInPort
public int getInPort() -
setInPort
public void setInPort(int inPort) -
getOutPort
public int getOutPort() -
setOutPort
public void setOutPort(int outPort) -
getRemoteFrom
public netP5.NetAddress getRemoteFrom() -
setRemoteFrom
public void setRemoteFrom(netP5.NetAddress remoteFrom) -
getRemoteTo
public netP5.NetAddress getRemoteTo() -
setRemoteTo
public void setRemoteTo(netP5.NetAddress remoteTo) -
getDrawCount
public int getDrawCount() -
setDrawCount
public void setDrawCount(int drawCount) -
initOscPlugs
public void initOscPlugs()SET UP RESPONSE TO INCOMING MESSAGES Call the osc.plug(Object theObject, String the MethodName, String theAddrPattern) or osc.plug(Object theObject, String the MethodName, String theAddrPattern, String the TypeTag) to setup callbacks to methods in the current object ("this") or other object instance. -
oscEvent
void oscEvent(oscP5.OscMessage theOscMessage) Post address pattern and typetag from incoming osc message to the console.- Parameters:
theOscMessage- forwarded OscMessage
-
oscSendMouseClicked
public void oscSendMouseClicked(int sampleX, int sampleY, int sample) Sends display coordinates and audio buffer index associated with a mouse click.- Parameters:
sampleX-sampleY-sample-
-
oscSendMultiSlider
Sends a list of points as possible Max MultiSlider settings.- Parameters:
drawPoints-
-
oscSendDrawPoints
Sends a list of points.- Parameters:
drawPoints-
-
oscSendTimeStamp
public void oscSendTimeStamp(int timeStamp, int timeOffset) Sends a "/time" message with a time stamp and offset.- Parameters:
timeStamp- milliseconds time stamptimeOffset- milliseconds time offset
-
oscSendTrig
public void oscSendTrig(int index) Sends a trigger message, "/trig", with a numerical value.- Parameters:
index- number to send
-
oscSendOnOff
public void oscSendOnOff(int index, boolean state) Sends an "/onoff" message with an index and state value.- Parameters:
index-state-
-
oscSendSetnum
public void oscSendSetnum(int index, float value) Sends a "/setnum" message with an index and value.- Parameters:
index-value-
-
oscSendDelete
public void oscSendDelete(int index) Sends a "/del" message with an index.- Parameters:
index-
-
oscSendClear
public void oscSendClear()Sends a "/clear" message. -
oscSendFileInfo
Sends a "/file" message with file path, file name, and file tag.- Parameters:
path-name-tag-
-
sampleHit
public void sampleHit(int sam) Play an audio event at a position in the audio buffer.- Parameters:
sam- buffer index
-
drawHit
public void drawHit(int... args) Play audio/animation events using a supplied list of event points.- Parameters:
args-
-
multislider
public void multislider(int... args) Receive Max MultiSlider data.- Parameters:
args- MultiSlider values
-
parseKey
public void parseKey(int arg) Interprets a received value as a char and uses it as an argument toparseKey().- Parameters:
arg-
-
controlMsg
-