开发者

Simulating a MIDI device - Windows

开发者 https://www.devze.com 2023-01-05 13:56 出处:网络
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 prog

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 capab开发者_运维百科le (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


Windows MIDI drivers do not need to be implemented in the kernel, they can be implemented entirely in userspace as DLLs.

MSDN has some information about the functions you need to implement - Audio Device Messages for MIDI - unfortunately it is somewhat lacking.

There used to be sample code for this kind of driver, as part of the NT4 DDK, but more recent releases of the DDK / WDK unfortunately don't include it any more.

Some better (though older) documentation and sample code can still be found after some searching:

  • Introduction to Multimedia Drivers (From NT4 DDK)
  • Sample MIDI Wine Driver for Mac OS X


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)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号