MIDI programming under NT and Win2000: device lockout

MIDI programming under NT and Win2000: device lockout

Post by Mark Walse » Wed, 28 Mar 2001 06:59:26



Using Microsoft Visual C++ 6.0 to debug a MIDI app under
NT or Win2000, I'm having a terrible problem with the
MIDI devices locking up.  If the debugged app doesn't get
a chance to call midiInClose or midiOutClose, then the system
considers the MIDI device to still be owned, even after the
app is terminated.  The next time I run any MIDI app, the
MIDI device is reported as unavailable with a
MMSYSERR_ALLOCATED result.  Even if I completely exit
VC and restart it, the MIDI device is still unavailable.  The
only way to overcome the problem is to reboot the system,
which, of course, is very time-consuming.

If you have encountered this problem and have found a solution,
and can share it with me, I would be thrilled!  And would gladly
send you a free copy of my MidiNotate program.

Thanks!
-- Mark Walsen

   Notation Software, Inc.
   www.notation.com

 
 
 

MIDI programming under NT and Win2000: device lockout

Post by Ray » Thu, 29 Mar 2001 11:35:47


Mark,

   I have encountered the same problem and have overcome it by getting the
handle of the Midi Device as it is opened then use that handle to close the
opened Midi Device if the user wants to stop the Midi file before it
finishes or wants to exit the program before the Midi file finishes.

   The only problem I haven't overcome yet is that if I have opened a Midi
Device and the software crashes, I no longer have access to the handle of
the opened Midi Device. The crashed software took the handle down with it. I
have considered saving the handle to a temporary file so that if needed a
restarted app could acces the file, grab the handle of the last opened Midi
Device and close it properly.

   Hope this helps.

    -Ray
     http://www.quantumportal.com
     Orchaos Tapestry


>Using Microsoft Visual C++ 6.0 to debug a MIDI app under
>NT or Win2000, I'm having a terrible problem with the
>MIDI devices locking up.  If the debugged app doesn't get
>a chance to call midiInClose or midiOutClose, then the system
>considers the MIDI device to still be owned, even after the
>app is terminated.  The next time I run any MIDI app, the
>MIDI device is reported as unavailable with a
>MMSYSERR_ALLOCATED result.  Even if I completely exit
>VC and restart it, the MIDI device is still unavailable.  The
>only way to overcome the problem is to reboot the system,
>which, of course, is very time-consuming.

>If you have encountered this problem and have found a solution,
>and can share it with me, I would be thrilled!  And would gladly
>send you a free copy of my MidiNotate program.

>Thanks!
>-- Mark Walsen

>   Notation Software, Inc.
>   www.notation.com


 
 
 

MIDI programming under NT and Win2000: device lockout

Post by Mark Walse » Sat, 31 Mar 2001 02:38:01


Quote:>    The only problem I haven't overcome yet is that if I have opened a Midi
> Device and the software crashes, I no longer have access to the handle of
> the opened Midi Device. The crashed software took the handle down with it.
I
> have considered saving the handle to a temporary file so that if needed a
> restarted app could acces the file, grab the handle of the last opened
Midi
> Device and close it properly.

Hi, Ray,

That's the problem I'm having: the MIDI device locks up after the app
crashes.
I doubt that saving the handle will work, because I think handles are always
specific to a process.  When the app runs again, it's a new process, and the
old handle from the previous process will point to who knows where.
Thanks for your thoughts, though.

-- Mark

 
 
 

MIDI programming under NT and Win2000: device lockout

Post by Brian Grainge » Sat, 31 Mar 2001 05:25:41



Quote:>    The only problem I haven't overcome yet is that if I have opened a Midi
> Device and the software crashes, I no longer have access to the handle of
> the opened Midi Device. The crashed software took the handle down with it.
I
> have considered saving the handle to a temporary file so that if needed a
> restarted app could acces the file, grab the handle of the last opened
Midi
> Device and close it properly.

If the process dies, I don't think a saved device handle is going to do you
any good.

Perhaps you could get around the problem by first starting an UberProcess
which creates all of your needed handles and flags, and then hands off the
grunt work of the program to one or more child processes. Then if a child
process dies, hopefully the UberProcess will still be there holding valid
handles, etc.

Regards,
Brian

 
 
 

MIDI programming under NT and Win2000: device lockout

Post by Ray » Sat, 31 Mar 2001 13:48:10


I did not realize that handles were so temporary, but your thoughts make
sense. It's a shame windows does not have a similar Unix Proccess ID command
so one could find the process of the Open Midi Device then Kill it.

  -Ray


>Hi, Ray,

>That's the problem I'm having: the MIDI device locks up after the app
>crashes.
>I doubt that saving the handle will work, because I think handles are
always
>specific to a process.  When the app runs again, it's a new process, and
the
>old handle from the previous process will point to who knows where.
>Thanks for your thoughts, though.

>-- Mark

 
 
 

MIDI programming under NT and Win2000: device lockout

Post by A.Hodgkinso » Wed, 04 Apr 2001 21:23:04




> I did not realize that handles were so temporary, but your thoughts
> make sense. It's a shame windows does not have a similar Unix
> Proccess ID command so one could find the process of the Open Midi
> Device then Kill it.

I must be missing something - why not just close down the Midi
device in your atexit() handler? Or does Doze not even have the
grace to call that when kicking a process out?

If so, then I recommend making sure your app doesn't crash ;-)

--
TTFN, Andrew (on behalf of myself, not my employer).

"Hold tight, lad, and think of Lancashire Hotpot!" - A Grand Day Out

 
 
 

MIDI programming under NT and Win2000: device lockout

Post by Grant Jone » Thu, 05 Apr 2001 19:51:05




Quote:> I must be missing something - why not just close down the Midi
> device in your atexit() handler? Or does Doze not even have the
> grace to call that when kicking a process out?

> If so, then I recommend making sure your app doesn't crash ;-)

What they need is a reliable box of tricks. Something that runs RISC OS
maybe ;-)
What programs are there for an Acorn machine.
Oregan seem to have forgot about Midi works.

My thoughts are my own..... Well that's what they tell me!
--
                                                Hereford the home of
                                                 F.A. giant killers
  http://www.heartfeltmusic.fsnet.co.uk            Bulmers cider

 
 
 

MIDI programming under NT and Win2000: device lockout

Post by A.Hodgkinso » Thu, 05 Apr 2001 23:08:16




> What they need is a reliable box of tricks. Something that runs RISC
> OS maybe ;-)

Well, I'm biased...

Quote:> What programs are there for an Acorn machine.
> Oregan seem to have forgot about Midi works.

What about Pete Goodliffe's "Anthem!" sold via. R-Comp?

  http://www.arsvcs.demon.co.uk/rci/sound/anthem/anthem.htm

--
TTFN, Andrew (on behalf of myself, not my employer).

"Hold tight, lad, and think of Lancashire Hotpot!" - A Grand Day Out

 
 
 

MIDI programming under NT and Win2000: device lockout

Post by Grant Jone » Fri, 06 Apr 2001 07:07:52


I Think I'll be spending a few UKP's

But will it run RISC OS 5 and the new 2.5 Gig multi Xscale M/c. Oop's
got carried away there, I think it's know as "Jarl" speak in the trade.

And for any one else listening. Follow the link below and afterwards you
will wish you Had gone to Ampcast. I wonder how much extra revenue has
been made by people on this news group downloading stuff just to
criticise. :-)

Still it's home from home. By the way Andrew, you don't think Jarl is an
alias for some one off c.s.a.a.
--

...
  Did You Know No.947: 1 square inch = 6.542 square centimetres

 
 
 

MIDI programming under NT and Win2000: device lockout

Post by A.Hodgkinso » Fri, 06 Apr 2001 18:46:06




> But will it run RISC OS 5 and the new 2.5 Gig multi Xscale M/c.
> Oop's got carried away there, I think it's know as "Jarl" speak in
> the trade.

This is probably off-topic for comp.music.midi.

That said, a StrongARM Risc PC is more than capable of doing solid
MIDI stuff, just not much in the way of synchronised digital audio
alongside it. It's not the OS (in fact the relatively crude way the
kernel operates makes it very good for real-time work), it's the
ultimate limitations of the hardware. Bung the same processor on a
decent memory bus with a good HD I/O system and it'd be a lot
better (Omega, if it ever appears, might be useful). Put a better
processor in there and you'd have a whale of a time, but that's
rather hard.

XScale may be on the cards but its a *long* way off, and being a
32-bit only device means you'll not be able to run *any* 26-bit
legacy apps whatsoever. There's a lot of stuff that RISC OS users
still rely on day to day that isn't supported anymore (for music
people, consider Sibelius - hand crafted 26-bit ARM code). So you'll
have to wave goodbye to those, but the highlights should still be
OK... OvPro, TWPro, Vantage, Photodesk, all core tools - note the
dearth of any audio stuff though. !Maestro, anyone? ;-)

Quote:> Still it's home from home. By the way Andrew, you don't think Jarl
> is an alias for some one off c.s.a.a.

No. Surely, Jarl is quite unique!

--
TTFN, Andrew (on behalf of myself, not my employer).

"Hold tight, lad, and think of Lancashire Hotpot!" - A Grand Day Out

 
 
 

1. MIDI device for NT?

        I gave up on using the SoundBlaster joystick port for MIDI some
time ago due to dropped and stuck notes when recording a full piano piece.
The MOTU PC Flyer (which attaches via the parallel port) corrected this
problem and serves me well, however they do not have an NT driver for it!

        Does anyone know of a MIDI device with NT drivers that does not
rely on the soundcard??

        thanks in advance,

--
                                     _ _          
WEB: www.ccs.neu.edu/home/jpappas   | (_)_ __ ___  

                                | |_| | | | | | | |  
                                 \___/|_|_| |_| |_|
"The only futile attempt is not attempting at all."

2. 3dfx Screensaver contest - can you compete with Shiny?

3. Java Midi programming - switching devices?

4. ECCO

5. MIDI DEVICE FOR PROGRAM-CHANGES ON STAGE ??????

6. NIS master, sendmail hub, and yppasswd...

7. MIDI NT/95/98 programming API documentation

8. Midi and Win2000 - how to get it work?

9. midi under win2000???

10. USB MIDI Interface for Win2000