MIDI-OX User Forum (http://www.midiox.com/cgi-bin/yabb/YaBB.pl)
MIDI Yoke >> MIDI Yoke NT >> How to close MIDI Yoke Port left open by dead app.
(Message started by: markwa on Sep 19th, 2004, 8:48pm)

Title: How to close MIDI Yoke Port left open by dead app.
Post by markwa on Sep 19th, 2004, 8:48pm
I've been using MIDI Ox and MIDI Yoke for debugging a MIDI app I'm working on.  Sometimes my app crashes (blush) during debugging.  If the app had opened a MIDI Yoke port, but doesn't close the port because of the crash.  The next time I try to run the app, the Windows midiInOpen or midiOutOpen for the MIDI Yoke port fails with "invalid handle".  The only solution for the problem is to reboot Windows.

Is there a faster way than rebooting Windows to free up the MIDI Yoke drivers that the app didn't close because it crashed?

Most MIDI drivers don't have this problem.  However, I have had this same problem with the MIDI driver for a Midiman Keystation 49 keyboard.  That got to be such a problem that I just threw the Midiman keyboard in a closest and never use it any more during software development.

Cheers
-- Mark

Title: Re: How to close MIDI Yoke Port left open by dead
Post by Jamie OConnell on Sep 20th, 2004, 12:10pm
The MIDI Yoke driver tries to clean itself up, the next time it is opened after a crash.  This can cause problems under a debugger (NTDLL breakpoint).  The work-around is to open MIDI-OX with a selected MIDI Yoke port, after stopping the debugged application.  MIDI-OX will open the driver and allow it to cleanup.  You can then close MIDI-OX (thus closing the cleaned up MIDI Yoke) and relaunch your debugee client.


Title: Re: How to close MIDI Yoke Port left open by dead
Post by markwa on Sep 20th, 2004, 9:24pm
If I wanted to clean up all 16 MIDI Yoke In and Out Ports, should I just prepare MIDI-OX / MIDI Device / Preset that opens all 16 MIDI Yoke In and Out Ports, and then closes them?

Or, could I just implement a quickie app that opens and closes all 16 of the ports?

Cheers
-- Mark

Title: Re: How to close MIDI Yoke Port left open by dead
Post by Jamie OConnell on Sep 21st, 2004, 12:26pm
You only have to reopen and close one port to cleanup all 16.  I don't think it matters if it's an input or an output, but I would recommend attaching an input.

Title: Re: How to close MIDI Yoke Port left open by dead
Post by markwa on Sep 21st, 2004, 2:49pm
I have now written the above proposed "MIDI Yoke Reset" app, but it fails the same way my main app fails.  The call to the Windows midiInOpen fails with an "invalid handle" error in NTDLL.DLL when trying to open MIDI Yoke NT 1 for input.

I can't make sense out of the wording of the "invalid handle" message.  midiInOpen is supposed to _return_ a HMIDIIN handle for the opened port. The error message instead makes it sound like midiInOpen was expecting a HMIDIIN handle as an input parameter and found it invalid.

Any suggestions about how I can reset the MIDI Yoke port?

Do you have a reset tool yourself that you could share?

Thanks
-- Mark

Title: Re: How to close MIDI Yoke Port left open by dead
Post by Jamie OConnell on Sep 21st, 2004, 6:27pm

Quote:
The call to the Windows midiInOpen fails with an "invalid handle" error in NTDLL.DLL when trying to open MIDI Yoke NT 1 for input.


How are you determining this?  You certainly can't run this tool in a debugger or you'll repeat the same result that caused the original failure.


Quote:
Any suggestions about how I can reset the MIDI Yoke port?  

Do you have a reset tool yourself that you could share?


As I said in my original post, I use MIDI-OX to clean up a crashed MIDI Yoke.  My default configuration includes MIDI Yoke 1 as an input port.  I have MIDI-OX setup as a quick launch from the Task Bar.  I click once to open it and then I click once to close it.  After that, MIDI Yoke is fine.

Title: Re: How to close MIDI Yoke Port left open by dead
Post by markwa on Sep 22nd, 2004, 7:03pm
Jamie,

Thanks.  You're right.  Running MIDI-OX and then exiting it does nicely reset the MIDI Yoke NT driver.  

Cheers
-- Mark



MIDI-OX User Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.