[wdmaudiodev] Re[2]: Re: DirectX and AVStream

  • From: Waldemar Haszlakiewicz <waldemar.haszlakiewicz@xxxxxxxx>
  • To: Stephan Kappertz <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Tue, 28 Dec 2004 23:39:42 +0100

Hi Stephan

I still need a little of your time if you can spare. :(

The problem is with the MIDI in part of the AVStream driver.
I really tried everything but still MIDI DX IN doesn't want to work.

I've build next filter as with the dmusuart example in DDK (well except for the 
SUM node).
//                   --------------------------
//                   | "Filter"               |
//                   |  (1)--------------(0)  |
//  Bridge Pin  1 o--|-->o-|SYNTH Node 0|-o>--|--o 0  Sink Pin
//                   |     --------------     |      (MidiIn MME and DX)
//                   |                        |
//                   |                        |
//                   |  (1) ------------ (0)  |
//    Sink Pin  2 o--|-->o--|SUM Node 1|--o>- |
//  (MidiOut MME)    |      ------------    | |
//                   |                      --|--o 4  Bridge Pin
//                   |  (1)--------------(0)| |
//    Sink Pin  3 o--|-->o-|SYNTH Node 2|--o>-|
//  (MidiOut DX)     |     --------------     |
//                   |                        |
//                   --------------------------


Now both MIDI outputs and MME input work flawlessly, but DX input doesn't want 
to work at all.

As I get UART data -> open stream pointer -> set the DMUS_EVENTHEADER
and call KsStreamPointerAdvanceOffsetsAndUnlock. (with advancement of whole 
buffer).


Now for MME input everything works as it should -> as soon I advance the buffer 
to the end point the buffer is
send to the system and then to the application.
But with DX input the application doesn't get any data at all.
I don't know, is it maybe something wrong with the timestamp or something.
As even if I've set all the clock things as said in DDK the clock procedures 
never gets called.
Now I can't even get the KsPinGetReferenceClockInterface to return a clock 
interface.

Now for audio part this isn't really a problem as timeStamp (as it looks) get 
through the
application and then it can do with it whatever it wants.

But now with MIDI I assume the timeStamp is wrong and the MIDI message isn't 
forward to the
application. Now after I advance the streamPointer I can't get another.
Well if I don't structure the MIDI messages I get a few streamPointers and then 
the same thing
happens -> no more available.
(Anyway I get the timeStamp from KeQueryInterruptTime().)

Now at first I though the KSPROPERTY_SYNTH_PORTPARAMETERS property is not 
returned, but I've
reversed the dmusic.dll and after the DeviceIoControl returns the structure is 
updated with the
driver values, so this works -> except if I return the wrong numbers???
Which I doubt as I set them as the DDK says.

PropertyItem_Midi_Synth_Get -> Start (0:0:0:55:296:875 (d:h:m:s:ms:us))
KSPROPERTY_SYNTH_PORTPARAMETERS: (IN)
  ValidParams: 2
  Voices: 0x0
  ChannelGroups: 0
  AudioChannels: 0x0
  SampleRate: 0
  EffectsFlags: 0
  Share: 0
KSPROPERTY_SYNTH_PORTPARAMETERS: (OUT)
  ValidParams: 2
  Voices: 0x0
  ChannelGroups: 1
  AudioChannels: 0x0
  SampleRate: 0
  EffectsFlags: 0
  Share: 0
PropertyItem_Midi_Synth_Get -> Return=STATUS_NOT_ALL_ASSIGNED (0:0:0:55:312:500 
(d:h:m:s:ms:us))

or the other one:

PropertyItem_Midi_Synth_Get -> Start (0:0:0:55:328:125 (d:h:m:s:ms:us))
KSPROPERTY_SYNTH_PORTPARAMETERS: (IN)
  ValidParams: 0
  Voices: 0x0
  ChannelGroups: 0
  AudioChannels: 0x0
  SampleRate: 0
  EffectsFlags: 0
  Share: 0
KSPROPERTY_SYNTH_PORTPARAMETERS: (OUT)
  ValidParams: 0
  Voices: 0x0
  ChannelGroups: 1
  AudioChannels: 0x0
  SampleRate: 0
  EffectsFlags: 0
  Share: 0
PropertyItem_Midi_Synth_Get -> Return=STATUS_SUCCESS (0:0:0:55:343:750 
(d:h:m:s:ms:us))

Now for KSPROPERTY_SYNTH_CHANNELGROUPS the driver always returns 0.
Which is again correct as I only have 1 channel available per PIN.

PropertyItem_Midi_Synth_Get -> Start (0:0:0:55:343:750 (d:h:m:s:ms:us))
KSPROPERTY_SYNTH_CHANNELGROUPS: 0 (GET)
PropertyItem_Midi_Synth_Get -> Return=STATUS_SUCCESS (0:0:0:55:359:375 
(d:h:m:s:ms:us))


Now all this definitions get returned to the the MidiTest by the Evert van der 
Poll.

Now for SX2 I can even get the ChannelGroups of value of 2, which I don't know 
why as I set the
MaxChannelGroups of the SYNTHCAPS to 1.



Now the second thing could be wrong that I set the streamPointer to the wrong 
values, but
again I really doubt that.

pStreamPointer = KsPinGetLeadingEdgeStreamPointer(
  pin,
  KSSTREAM_POINTER_STATE_LOCKED
);
if ( pStreamPointer != NULL )
{
//DX driver uses DMUS_EVENTHEADER.
//
//typedef struct _DMUS_EVENTHEADER
//{
//    DWORD           cbEvent;                Unrounded bytes in event
//    DWORD           dwChannelGroup;         Channel group of event
//    REFERENCE_TIME  rtDelta;                Delta from start time of entire 
buffer
//    DWORD           dwFlags;                Flags DMUS_EVENT_xxx
//} DMUS_EVENTHEADER;
//
//Initialize.
  pData = (DMUS_EVENTHEADER*)pStreamPointer->OffsetOut.Data;
  pData_midi = (BYTE*)( pData + 1 );
  ByteCount = pMidiCommand->ByteCount;

//Set DMUS_EVENTHEADER.
  pData->cbEvent = ByteCount;
  pData->dwChannelGroup = 0;
  pData->rtDelta = 0;
  if ( ByteCount > 3 )
  {
    pData->dwFlags = 0; //no order (DMUS_EVENT_STRUCTURED)
  }
  else
  {
    pData->dwFlags = DMUS_EVENT_STRUCTURED;
  }

//Set data.
  RtlCopyBytes( pData_midi, &pMidiCommand->data, ByteCount );

//Set the streamPointer.
  pStreamPointer->StreamHeader->PresentationTime.Time = 
pMidiCommand->timeStamp;  //from KeQueryInterruptTime()
  pStreamPointer->StreamHeader->PresentationTime.Denominator = 1;
  pStreamPointer->StreamHeader->PresentationTime.Numerator = 1;
//pStreamPointer->StreamHeader->OptionsFlags |= 
KSSTREAM_HEADER_OPTIONSF_TIMEVALID;

//Send data to system -> release streamPointer.
  KsStreamPointerAdvanceOffsetsAndUnlock(
    pStreamPointer,
    0,
    pStreamPointer->OffsetOut.Remaining,
    FALSE
  );
}



Now any data you could give me would really be useful as I don't know what to 
do anymore. :(

Peace
Waldemar


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

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:

  • » [wdmaudiodev] Re[2]: Re: DirectX and AVStream