I am trying to simply play notes generated by image data and am having two major problems.
One problem is that when I try to establish a new Controller anywhere in my code I get the message that
"the type Controller is ambiguous"
This happens no matter where I put the code:
midiOut.sendController(
new Controller(1)
);
this same code in a test sketch performed perfectly.
I ultimately abandoned the Controller, and simply used Program Change :
midiOut.sendProgramChange(
new ProgramChange(1)
);
This gets notes playing 3 notes simultaneously even. However, eventually (even if I reduced the notes to one playing at a time) i get an error message, and the notes eventually stop playing:
Exception in thread "Thread-5" java.lang.ArrayIndexOutOfBoundsException: 0
at java.util.AbstractCollection.toArray(AbstractCollection.java:126)
at promidi.MidiOut$NoteBuffer.run(MidiOut.java:263)
It seems to crash sooner if I play the notes more frequently, but even playing them fairly slowly eventually I get that error.
any ideas would be greatly appreciated... even if there is another library that would work better I would like to hear about that.
Thanks in advance!
here is my code with some of the interface removed:
import controlP5.*;
import promidi.*;
//midi classes
MidiIO midiIO;
MidiOut midiOut;
//translation class
translater[] myTranslaters;
//interface classes
ControlP5 volumeControl;
ControlP5 imageControl;
ControlP5 pitchControl;
ControlP5 tempoControl;
//various volumes
public float main=50.0,reds=100.0,blues=100.0,greens=100.0;
//markers to identify sliders by ID no.
public boolean pitch,tempo;
int num;
// sets up database of images [maxImages] is the number of images to be imported
int maxImages = 4;
PImage[] images=new PImage[maxImages];
void setup(){
//format screen size
size(800,600);
//setup MIDI
//get an instance of MidiIO
midiIO = MidiIO.getInstance(this);
//print a list with all available devices
midiIO.printDevices();
//open a midiout using the first device and the first channel
midiOut = midiIO.getMidiOut(0,0);
//*********
//initialize variables
num=4;
pitch=false;
tempo=false;
//format controllers -
//seperate classes for each type of controller for formatting purposes
volumeControl = new ControlP5(this);
imageControl = new ControlP5(this);
pitchControl = new ControlP5(this);
tempoControl = new ControlP5(this);
//basic formatting of sliders for main volume and each color channel