Re: MIDI device "driver" how-to?
Re: MIDI device "driver" how-to?
- Subject: Re: MIDI device "driver" how-to?
- From: Doug Wyatt <email@hidden>
- Date: Mon, 25 Jun 2001 20:58:27 -0400
On Monday, June 25, 2001, at 06:00 PM, Stephen Davis wrote:
I would like to write a device "driver" for an external MIDI device I
own. From reading the Core Audio pdf it seems that I only need to
write a CFPlugin-based "driver" for the device since it is a generic
device with midi-in and midi-out ports.
If so, is there any documentation or example code for creating a midi
device "driver"? Haven't located anything other than the
CoreMIDIServer/MIDIDriver.h header file so far. There is a note in
there to "see MIDIDriver.cpp" but where might that be?
Also, is there a generic driver that would just let me get started
talking to my device before I write the driver for it? Right now, when
I do a scan I see my USB interface (MIDISPORT with driver from the
music kit folks) but not the device that's hooked up to it. Then
again, I have no idea if any sort of probing is going on and I haven't
yet tried just sending it a query to see what happens. I'm guessing
that for generic devices I just need to open an in/out port pair and
shove data at it.
There's starting point in
/Developer/Examples/CoreAudio/MIDI/SampleUSBDriver. It implements a
base C++ class for a USB MIDI driver. You only need to override a few
methods to do things like identify the hardware and convert between
MIDIPacketList's and the way the maker encodes MIDI in USB packets. You
can use IORegistryExplorer (or USB Prober on 9) to find the device's USB
manufacturer and model codes. Actually USB Prober's probably a bit more
useful because you'll need to see what USB configurations, interfaces
and endpoints there are -- the sample driver assumes bulk. Then you can
look at the USB messages coming in from the device and start trying to
deduce how MIDI is encoded in them. Some manufacturers use something
that looks a lot like the USB/MIDI class spec. Others don't.
Doug
_____________________
Doug Wyatt
Core Audio
Apple
408.974.9314