I am currently trying to connect my midiport piano to my computer. I read everything I could find about it, but for some reason I am missing something, so I hope someone here can help me. I have been trying to do this for a week, and it complicates things.
public class MidiDeviceGetter { public MidiDeviceGetter() {} public static void listTransmitterDevices() throws MidiUnavailableException { MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo(); for (int i = 0; i < infos.length; i++) { MidiDevice device = MidiSystem.getMidiDevice(infos[i]); if (device.getMaxTransmitters() != 0) System.out.println(device.getDeviceInfo().getName().toString() + " has transmitters"); } }
Well, that’s what I have so far. I just wanted to tie the piano so that I could go further from there, but, as I said, I can’t get it to work.
For testing, I took the DumpReceiver class from http://www.jsresources.org/examples/DumpReceiver.java.html .
I am very grateful for any help, thanks.
PS: And sorry for my English, I'm not a native speaker.
Edit1: According to the comment:
I expect the program to print something in the console when I press the System.in () key is running, because in the Receiver send (Midimessage, long) method, the last line is Prinstream.print (midimsg). I’m right in assuming that the method of sending the receiver interface class is always called if the note to which the receiver is connected is played on the transmitter, isn’t it? If this did not work, I could understand this, but there are also some recipient membervariables that must retain the number of deleted keys, but these membervariables are always zero. So my main problem is that the send method is never called. I hope I made it clear that my main problem.
Edit2: If you are in all this "midi programming in java" and you do not see any serious errors, please tell me. I just found out that I cannot get any Midisignals in Steinbergs Cubase. Perhaps this time the problem was not in front of the screen.