模拟 MIDI 设备 - Windows
我需要一些有关 Windows 编程、MIDI 和 WDM 的建议。我正在尝试编写一个小应用程序,该应用程序将位于系统托盘中,并作为 MIDI 输入/输出设备发布到系统,以便 MIDI 程序可以发送给它,并将消息转换为不同的格式。我一直在阅读 Cant 的 WDM 书籍,并搜索有关编写设备驱动程序的信息,但不知道我是否走在正确的道路上。 我还不知道如何:-a
)将我的驱动程序注册为具有 MIDI 功能(我是否在注册表中粘贴对它的引用,并让操作系统直接对 dll 中的功能进行 MIDI 调用?)
b)通过直接 MIDI 数据我的应用程序的驱动程序,它可能太大而无法成为驱动程序本身。
任何关于从哪里开始的建议将不胜感激。 谢谢, 皮特
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Windows MIDI 驱动程序不需要在内核中实现,它们可以完全在用户空间中作为 DLL 实现。
MSDN 有一些关于您需要实现的功能的信息 -
MIDI 音频设备消息 - 不幸的是是有些欠缺。
作为 NT4 DDK 的一部分,曾经有此类驱动程序的示例代码,但不幸的是,最新版本的 DDK / WDK 不再包含它。
经过一番搜索后,仍然可以找到一些更好的(尽管较旧的)文档和示例代码:
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:
设备由设备驱动程序而不是应用程序枚举(或模拟)。您在系统托盘中看到的是一个应用程序图标。因此,您需要同时拥有驱动程序和应用程序 - 您不能让一点已编译的代码同时充当两者。
在驱动程序方面,您可能希望查看MSDN 文档。这将回答 yopur 问题的 (a) 部分。
假设您仍然想继续,(b) 最好让您的应用程序从驱动程序中提取数据。这比其他方式要容易得多 - 应用程序可以轻松找到驱动程序,但驱动程序在查找特定应用程序(进程)时遇到很大问题
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)
如果您正在寻找更简单的入门方法,那么有一个 MIDI 环回驱动程序,并且制作它的人们还提供(或曾经提供)它的一个版本,允许您的程序直接与驱动程序通信。这为您提供了您正在寻找的行为,其中程序显示为 MIDI 设备。环回驱动程序位于 http://nerds.de/en/loopbe1.html。我不再看到开发人员页面,但如果您联系他们,您也许可以购买驱动程序的许可证,您可以直接访问该驱动程序而无需环回。
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.