[wdmaudiodev] Re: MSVAD (simple) MIN/MAX SAMPLE_RATE

  • From: "Don Bell" <0dbell@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Fri, 8 Jun 2007 17:24:55 -0500

Well, finding some of the answers was quicker than I thought. :)

On 6/8/07, Don Bell <0dbell@xxxxxxxxx> wrote:

The class CSaveData (savedata.cpp), which seems to be common to all
MSVAD samples (including simple and even ac3) has a method named
SetDataFormat().

In there, no check is performed against MAX_SAMPLE_RATE:
whatever data format is requested,
it is registered (accepted). This member function
always returns STATUS_SUCCESS!

Does this make sense?

It makes sense only if the caller of CSaveData::SetDataFormat()
guarantees that this format is already acceptable by the device.
Hmmm... I am going to check this right away.


No - it doesn't make sense. The caller CSaveData::SetDataFormat() is
CMiniportWaveCyclicStreamMSVAD::SetFormat() which is an implementation
of the IMiniportWaveCyclicStream::SetFormat method. This
implementation does not validate the format - and now I actually
notice a comment inside: "MSVAD does not validate the format."

I think that I found the answer to my original question, right? This
is why I am getting a bugcheck when I attempt to hard-code
MAX_SAMPLE_RATE that is lower than the code actually accepts...


My question now is *which* SetFormat? There are several of them in the

Answer: IMiniportWaveCyclicStream::SetFormat - which is implemented in
MSVAD as CMiniportWaveCyclicStreamMSVAD::SetFormat.

Thanks again for listening. :)
Don


---------- Forwarded message ----------
From: Don Bell <0dbell@xxxxxxxxx>
Date: Jun 8, 2007 2:57 PM
Subject: MSVAD (simple) MIN/MAX SAMPLE_RATE
To: wdmaudiodev@xxxxxxxxxxxxx


I wrote an audio device driver, based on MSVAD simple, which seems to
be working fine.

The device for which I wrote this WDM audio driver supports only 8KHz
sample rate. That is, even if my driver (or the client application)
could deliver higher quality audio (say 44.1 KHz), the device cannot
really utilize any of it.

Therefore, I decided to simplify sample handling in the driver by
changing MIN_SAMPLE_RATE and MIN_SAMPLE_RATE in simple.h from:

#define MIN_SAMPLE_RATE             4000    // Min Sample Rate
#define MAX_SAMPLE_RATE           64000   // Max Sample Rate

to:

#define MIN_SAMPLE_RATE             8000    // Min Sample Rate
#define MAX_SAMPLE_RATE            8000    // Max Sample Rate

I then rebuilt the driver and attempted to update it (as usual) via
Device Manager. The result was unpleasantly surprising: The test
machine crashed and WinDbg disconnected abruptly, preventing me from
having the tiniest clue of why this happened. Fortunately, I limited
the changes for this debug session to only these two parameters, so I
know that they are the culprit.

Despite being able to write a working WDM audio driver, I am really a
beginner who doesn't have in-depth knowledge of how things really work
inside PortCls (or MSVAD for that matter). Is there a tip you can
provide for why such an intuitive (and inoccent?) change would send
the driver into oblivion? It reminds me of invalid pointer or
divide-by-zero cases... Why does a change as straightforward as this
doesn't work? What am I missing? Where do I begin/look when
troubleshooting this kind of problem?

Any tip or hint (or pointer to an article) would be greatly appreciated.

Thanks,
Don

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

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.com/

Other related posts: