|
» codelab : http://codelab.fr/accueil » Forum : Chuck : http://codelab.fr/chuck » Communication de chuck vers processing avec OSC : http://codelab.fr/1515 Ceci est la version imprimable d'un sujet du forum, pour retourner à la version complète : Communication de chuck vers processing avec OSC |
| 22_79 — 2010-02-07 19:18:36 |
Salut, // MIDI
MidiIn min;
MidiMsg msg;
if( !min.open(1)) { me.exit(); }
// OSC
OscSend xmit;
xmit.setHost("localhost", 1234);
while(true){
min => now;
while(min.recv(msg)){
<<<msg.data1, msg.data2, msg.data3, "MIDI message">>>;
xmit.startMsg("conductor/downbeat, i");
}
}et mon code p5 package com.hidden.pvc;
import processing.core.PApplet;
import oscP5.*;
import netP5.*;
public class AppletPrincipal extends PApplet {
/**
*
*/
private static final long serialVersionUID = 2698642897091035605L;
OscP5 oscP5;
// overwrite PApplets init method
// to set the frame to undecorated=true
public void init() {
// / to make a frame not displayable, you can
// use frame.removeNotify()
frame.removeNotify();
frame.setUndecorated(true);
// addNotify, here i am not sure if you have
// to add notify again.
frame.addNotify();
super.init();
}
@Override
public void setup() {
size(400, 400);
frameRate(25);
/* start oscP5, listening for incoming messages at port 1234 */
oscP5 = new OscP5(this, 1234);
}
@Override
public void draw() {
frame.setLocation(screen.width, 0);
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());
}
/**
* @param args
*/
public static void main(String[] args) {
PApplet.main(new String[] { "com.hidden.pvc.AppletPrincipal" });
}
} |
| emoc — 2010-02-07 20:38:39 |
Bonsoir, |
| 22_79 — 2010-02-08 00:29:59 |
Yep, |
| emoc — 2010-02-08 12:56:16 |
Hello, Code (chuck) :// MIDI
MidiIn min;
MidiMsg msg;
if( !min.open(1)) { me.exit(); }
// OSC
OscSend xmit;
xmit.setHost("localhost", 1234);
while(true){
min => now;
while(min.recv(msg)){
<<<msg.data1, msg.data2, msg.data3, "MIDI message">>>;
// débute la préparation du message
// le message sera envoyé dès qu'il sera complet
xmit.startMsg("/conductor/downbeat", "i");
// complète le message et envoie
msg.data2 => xmit.addInt;
}
} |
| 22_79 — 2010-02-08 17:51:55 |
Rha ! |