Can't seem to close a MidiDevice

D

dmkoelle

I'm writing a Java application that takes MIDI events from an external
device (a Casio keyboard) and prints out the MIDI events of the notes
that I'm playing.

My problem is that after I run the program once, I can't open the
device again!

It seems that whether or not I call close() on an instance of a
MidiDevice, I get
"javax.sound.midi.MidiUnavailableException: Failed to open the device."
the next time I run my application.

In addition, if I try to undock the USB connection to my Casio
keyboard, Windows tells me I can't do that, because the device is still
being used.

Any ideas?

Thank you!
-Dave
 
A

Andrew Thompson

I'm writing a Java application that takes MIDI events from an external
device (a Casio keyboard) and prints out the MIDI events of the notes
that I'm playing.

My problem is that after I run the program once, I can't open the
device again! ....
Any ideas?

I vaguely recall encountering similar problems with
audio code, but did not resolve them at the time.

(Revisits java docs for sound..)
They mention in MidiDevice.getReceivers() that
"A receiver can be removed from the device by closing it."
I am not sure of the exact signinficance of that,
but it suggests it might be a good strategy to close
all Recievers and Transmitters attached to the
MidiDevice.

Any improvement?

Andrew T.
 
D

dmkoelle

That may work - I tried something similar because I had added a new
receiver, but maybe I need to close the default receiver as well.

I'll let you know how it goes!

-Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top