I'm making a program that involves playing MIDI sounds, and just today I encountered a problem where calling
MidiSystem.getReceiver()
or opening up a MidiDevice
, totally prevents me from making a frame show up on the screen. And then if I try to terminate everything while everything is frozen up, Eclipse tells me that "terminate failed".
Here's some 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's a frame");
Dimension d = new Dimension(500,500);
frame.setSize(d);
frame.setPreferredSize(d);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
The getReceiver()
part and the JFrame
part each work fine on their own; it's just when I have both pieces there that stuff stops working.
(Btw I was not having this problem when running similar code a couple weeks ago...?)
Any help would be greatly appreciated. Thanks!