I am making a program that includes playing MIDI sounds, and only today I ran into a problem in which a call
MidiSystem.getReceiver()
or opening MidiDevice, completely prevents me from displaying a frame on the screen. And then, if I try to finish everything before everything is frozen, Eclipse tells me that "completion failed."
Here is a sample code to show you what I mean:
public static void main(String args[]) {
Receiver receiver;
try {
receiver = MidiSystem.getReceiver();
} catch (MidiUnavailableException e) {
e.printStackTrace();
}
JFrame frame = new JFrame("here a frame");
Dimension d = new Dimension(500,500);
frame.setSize(d);
frame.setPreferredSize(d);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
Part getReceiver()and part JFrameeach work normally independently; it's just when I have both parts that stop working.
(Btw I did not have this problem when running similar code a couple of weeks ago ...?)
Any help would be greatly appreciated. Thank!