[wdmaudiodev] AVS and Midi

  • From: Guenter Hildebrandt <G.Hildebrandt@xxxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 02 Oct 2003 16:57:37 +0200

Hi,

I'm developing a AVStreaming driver linked with ks.sys under Windows XP. The driver has a Filter with a Midi source pin. I get the data from the hardware as a byte stream without limits. I indicate the midi data using the data structure KSMUSICFORMAT as a header for each buffer. It seems that Windows requires a complete Midi message in each buffer. So I have implemented a Midi parser which knows the size of each Midi sample and assembles the midi messages. Midi allows a special mode called "running mode", where the device sends a command e.g. 0x90 (note on) and data for several notes with out repeating the command. Now my question: Is it correct that the parser translate the following message
0x90 0x34 0x45 0x35 0x45 0x36 0x45
into
Buffer 1: 0x90 0x34 0x45 (note on, note 0x34, after touch 0x45)
Buffer 2: 0x90 0x35 0x45
Buffer 3: 0x90 0x36 0x45
The driver changes the data stream in this case.


If the parser works like this:
Buffer 1: 0x90 0x34 0x45 (note on, note 0x34, after touch 0x45)
Buffer 2: 0x35 0x45
Buffer 3: 0x36 0x45
programs like CuBase does not get the notes 0x35 and 0x36.

A second problem is the time stamping of Midi data. The DDK says: put a presentation time stamp in the KSSTREAM_HEADER and in the KSMUSICFORMAT.TimeDeltaMs the relative presentation time. This does not work with Cubase. All notes are put to time 0. During experiments I have found the following solution:
- no presentation time in KSSTREAM_HEADER
- the complete timing in KSMUSICFORMAT.TimeDeltaMs, the time stamp is derived from the system time.
- the zero point is set on the call SetDeviceState: KSSTATE_RUN


With this method I can loop a midi stream through my hardware. The first time I do so with Cubase I get a time delay of -30ms. The recording data are 30 ms before the playing data. The second and all further runs I get a delay of 8 ms which may the delay in the hardware. This implementation is very different to the documentation.

Can somebody give me a hint or comment to this.

Thanks

Guenter


******************


WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.de/

Other related posts: