22_79 — 2010-02-07 19:18:36

Salut,

J'essaye désespérément d'envoyer des données de chuck vers processing mais sans y arriver.
Si ça parle à quelqu'un.


Voici mon 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">>>;
    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,

Pas trop le temps de regarder ton code dans le détail pour le moment, juste un lien...
http://urzhiata.emoc.org/communication- … r-osc.html

22_79 — 2010-02-08 00:29:59

Yep,

Merci ... déjà vu ce post, je ne me suis pas attardé dessus parce que la communication va dans l'autre sens ... pe que je devrais me pencher un peu dessus.

emoc — 2010-02-08 12:56:16

Hello,

Il manque une ligne dans ton code Chuck, startMsg prépare le message mais il faut y ajouter la valeur que tu veux transmettre, c'est à dire ajouter un entier. Dès que le message est complet il est envoyé. Voila ce que ça donne, testé et approuvé :) :

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 !

Merci :)