Hey guys,
I have been trying to write a basic program that will send and receive MIDI. I have successfully managed to send a MIDI message, but am unable to come up with the code that will receive a MIDI signal from an external source and simply display the information in a textfield.
I have spent nearly a week looking for anything to help me, but unfortunately all the source I have found is for reading in from files.
This is my code so far:
if (midiIOIn == thisThread) {
try {
Transmitter getTrans = MidiSystem.getTransmitter();
MidiEvent recMSG = null;
MidiMessage getMSG1 = recMSG.getMessage();
int recStatus = getMSG1.getStatus();
byte[] recMSG1 = getMSG1.getMessage();
String statusString = Integer.toString(recStatus);
String messageString = recMSG1.toString();
gui.midiInTextField.setText(statusString + messageString);
gui.midiStatusTextField.setText("Data Received");
}
catch (MidiUnavailableException ex1) {
gui.midiStatusTextField.setText("FAIL");
}
}
I understand that there are some issues with it, but if anyone can help me I would be greatful.
Regards,
winn_man