[wdmaudiodev] Re: Win7 usbaudio.sys MIDI bug?

  • From: Daimen Duncan <daimen@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Mon, 30 Aug 2010 11:15:30 -0400

>> If you use a Code Index of 0x0F and just pass MIDI bytes through to USB the
>> messages are corrupted if they are standard voice messages.  Sysex messages
>> go through fine.

> The company that wrote the USB MIDI specification built USB MIDI
> synthesizers that ignore CIN 0xF.

> The specification isn't quite clear on the purpose of this CIN:
> | CIN=0xF, Single Byte: in some special cases, an application may prefer
> | not to use parsed MIDI events. Using CIN=0xF, a MIDI data stream may
> | be transferred by placing each individual byte in one 32 Bit USB-MIDI
> | Event Packet. This way, any MIDI data may be transferred without being
> | parsed.

> Apparently, "in some special cases" is widely interpreted as "not in the
> general case", which would imply "not required in a general driver".

> According to the Robustness Principle, your device should never send
> CIN 0xF when another CIN would be possible, i.e., 0xF should be used
> only for system realtime messages.

>> For example, if I send a PC change message of B0 12 using CIN 0x0F the data
>> received from the Windows MIDI driver is
>> B0 00
>> B0 12
>>
>> Likewise if I send a CC message of C0 01 02 the data received is:
>> C0 00
>> C0 01
>> C0 02

> As Evert noted, these are not correct MIDI messages.  (Well, C0 01 02
> would be two messages with running status, but this wouldn't be allowed
> in one USB MIDI event packet.)

Sorry, I got the PC and CC backwards in the report.  What I meant was
whatever message I send the USB MIDI driver returns multiple messages equal
to the number of bytes in the original message (except for sysex messages).

So what I should have said is if I send a PC message of C0 01 I get:
C0 00
C0 01

and if I send a CC message of B0 01 02 I get
B0 00
B0 01
B0 02

However, if I send a sysex message of F0 00 01 F7 I get
F0 00 01 F7

I'm using the Code Index of 0x0f to simply wrap the MIDI data and send it up
one byte at a time in the MIDI packet rather than parse the data and use the
appropriate Code Index.  According to the Class Spec. you can pass MIDI data
without parsing using the Code Index 0x0f and it works for sysex data.  It
just doesn't work for voice data.  But I think you've helped clarify this a
bit above.

Other related posts: