Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

Can't seem to close a MidiDevice

Thread view: 
dmkoelle@gmail.com - 22 Nov 2006 03:56 GMT
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
Andrew Thompson - 22 Nov 2006 06:10 GMT
> 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.
dmkoelle@gmail.com - 22 Nov 2006 15:27 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.