views:

60

answers:

2

Hi, I need some advice on windows programming, MIDI and WDM. I am trying to write a small application that will sit in the sys tray and be advertised to the system as a MIDI In/Out device so that MIDI programs can send to it and it will convert the messages into a different format. I have been reading Cant's WDM book and scouring for information about writing device drivers, but don't know if I'm going down the right path. I don't see yet how to:-

a) register my driver as MIDI capable (do I stick a ref to it in the registery and let the OS direct MIDI calls to the functionality in a dll?)

b) direct MIDI data through the my driver to my app, which is probably going to be too large to be a driver itself.

Any advice on where to start would be much appreciated. thanks, Pete

A: 

Devices are enumerated (or simulated) by device drivers, not applications. What you see in the sys tray is an application icon. Hence, you will need to have both a driver and an app - you can't have one bit of compiled code acting as both.

On the driver side, you probably want to have a peek at the MSDN docs. This will answer part (a) of yopur question.

Assuming that you still would like to continue, (b) is best don by letting your application pull the data from the driver. That's far easier than the other way around - an application can trivially find a driver, but a driver has big problems finding a specific app (process)

MSalters
Thanks for the reply. I've been reading more of the drivers book and running the samples this afternoon and I am starting to see a path through this. One thing? Having my app continously perform a read to pull info from the device driver seems inefficient. Is there no easy way to register my app with the driver to be given a nudge via some form of IPC to wake up and pull the data?Things are becoming more clear ... slowly.cheers,Pete
Just use a cyclic buffer in your driver. MIDI is fairly realtime; if there's no application consuming it, the driver can safely overwrite older data.
MSalters
A: 

If you are looking for a bit easier way to get started, there is a MIDI loopback driver out there, and the folks that make it also offer (or used to offer) a version of it that allows your program to communicate directly with the driver. This gives you the behavior you are looking for, where a program appears as a MIDI device. The loopback driver is at http://nerds.de/en/loopbe1.html. I don't see the developer page anymore, but if you contact them, you might be able to purchase a license to a driver that you can access directly without the loopback.

Brad