We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
proMidi Box HELP plz (Read 500 times)
proMidi Box HELP plz
Aug 1st, 2008, 2:41pm
 
float xpos;
float ypos;
float rectW;
float rectH;
import promidi.*;

MidiIO midiIO;

void setup(){
 size(640, 480);
 smooth();
 background(0);
 
 //get an instance of MidiIO
 midiIO = MidiIO.getInstance(this);
 println("printPorts of midiIO");
 
 //print a list of all available devices
 midiIO.printDevices();
 
 //open the first midi channel of the first device
 midiIO.openInput(0,0);
 midiIO.openInput(1,0);
 frameRate(30);
}

void draw(){
 moveBox();
}
void moveBox() {
 if (rectW < 20){
  rectW = 20;
 }else if (rectH <20){
  rectH=20;
 }
 
rect(xpos, ypos, rectW, rectH);
}

void controllerIn(Controller controller, int device, int channel){
 if (controller.getNumber() == 4){
  xpos = controller.getValue() * 5;
 } else if (controller.getNumber() == 5){
  ypos = controller.getValue() *4;
 }
 else if(controller.getNumber() ==6){
  rectW = controller.getValue() *2;
 }else if (controller.getNumber() ==7){
 rectH = controller.getValue() *2;
 }
 
 
 println(controller.getValue());
}




Hello i am tiring to just draw a single box.  When i run this code it draws a new box every time i change a value.  sorry for the messy code.  I am probably just missing a simple line of code but cant seem to figure it out.  Any help will be much appreciated.  Thanks
Re: proMidi Box HELP plz
Reply #1 - Aug 2nd, 2008, 7:06pm
 
Also my box is changing color when the noteOff comes through.
I press a note the box changes color, then release the note and the box changes color again.  How would i go about stopping this?  Thanks
Re: proMidi Box HELP plz
Reply #2 - Aug 11th, 2008, 11:40am
 
The noteOff events in the controllerIn method are a bug in promidi, I fixed this in the current release which needs a bit more testing but will be released at the end of this week.
Page Index Toggle Pages: 1