name
openInput ( )
import promidi.*;

MidiIO midiIO;

void setup(){
  size(128*5,128*5);
  smooth();
  background(0);
  
  midiIO = MidiIO.getInstance(this);
  println("printPorts of midiIO");
  midiIO.printDevices();
  midiIO.openInput(0,0);
}

void draw(){

}

void noteOn(
  Note note,
  int deviceNumber,
  int midiChannel
){
  int vel = note.getVelocity();
  int pit = note.getPitch();
  
  fill(255,vel*2,pit*2,vel*2);
  stroke(255,vel);
  ellipse(vel*5,pit*5,30,30);
}

void noteOff(
  Note note,
  int deviceNumber,
  int midiChannel
){
  int pit = note.getPitch();
  
  fill(255,pit*2,pit*2,pit*2);
  stroke(255,pit);
  ellipse(pit*5,pit*5,30,30);
}

void controllerIn(
  Controller controller,
  int deviceNumber,
  int midiChannel
){
  int num = controller.getNumber();
  int val = controller.getValue();
  
  fill(255,num*2,val*2,num*2);
  stroke(255,num);
  ellipse(num*5,val*5,30,30);
}

void programChange(
  ProgramChange programChange,
  int deviceNumber,
  int midiChannel
){
  int num = programChange.getNumber();
  
  fill(255,num*2,num*2,num*2);
  stroke(255,num);
  ellipse(num*5,num*5,30,30);
}
description
Use this Methode to open an input device. You can open an input device with its number or with its name. Once a input device is opened it is reserved for your program. All opened devices are closed by promidi when you close your application. You can also close opened devices on your own.
Note that you open inputs with midi channels now, this makes you more flexible with handling incoming mididata. Instead of opening an input and analysing the incoming events in noteOn, controllerIn, noteOff or programChange you could use the plug method to directly forward the incoming events to a method and object of your choice.
syntax
openInput(inputDeviceNumber, midiChannel);
openInput(inputDeviceName, midiChannel);
parameters
inputDeviceNumber
int, number of the inputdevice to open
midiChannel
int, the midichannel of the input to open
inputDeviceName
String, name of the input to open
returns
None
usage
Web & Application
related