/**************************************** * Reception des donnees de capteurs * Module 4 entrees analogiques / 8 numériques vers Midi * Interface-Z * Sensors data reception from * 4 analogical ways / 8 digital ways to Midi *****************************************/ import rwmidi.*; // RWMidi se trouve chez http://ruinwesen.com/blog?id=95 MidiInput input; void setup() { // Affichage des peripheriques Midi disponibles sur l'ordinateur // Displaying Midi devices existing on the computer println("........Peripheriques Midi In........"); println(RWMidi.getInputDevices()); // Choisir le numero du peripherique, ici [1], dans la liste // Choose the appropriate Midi device from the list input = RWMidi.getInputDevices()[1].createInput(this); } // Reception des capteurs tout ou rien // Receiving "all or nothing" sensors int[] inter_4 = new int[8]; int pitch; void noteOnReceived(Note note) { pitch = note.getPitch(); if ((pitch>=8)&&(pitch<16)) { pitch = pitch-8; inter_4[pitch] = note.getVelocity(); println("Note On " + pitch + " " + inter_4[pitch]); } } // Reception des capteurs analogiques // Receiving analogical sensors int[] valeur = new int[8]; int numero; void controllerChangeReceived(Controller ctlchg) { numero = ctlchg.getCC(); if ((numero<52)&&(numero>47)){ numero = numero-48; valeur[numero] = ctlchg.getValue(); println("Capteur n°" + (numero+1) + " " + valeur[numero]); } } void draw() { }