[wdmaudiodev] Re: WDM audio driver for 32 bit floating point device.

  • From: Zubin Polra <zubin.polra2007@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Tue, 11 Aug 2015 17:15:39 +0530

Hi Matthew,

I downloaded msvad sample from
https://code.msdn.microsoft.com/windowshardware/Windows-Driver-Kit-WDK-80-e3161626#content
I opened (<My downloads folder>\Windows Driver Kit (WDK) 8.0
Samples\C++\WDK 8.0 Samples\Microsoft Virtual Audio Device Driver
Sample\Solution) in VS2012 integrated with wdk 8.0 on windows 7 and I built
and successfully with Win7 Debug x64 configuration.
I deployed and installed vadsimpl.sys to my test machine.
I am able to see the devices added by the driver at playback device as well
as recording device tabs at sound dialog.

Now, I just changed data range of pin to support floating point PCM format
instead of integer PCM format.

static
KSDATARANGE_AUDIO PinDataRangesStream[] =
{
{
{
sizeof(KSDATARANGE_AUDIO),
0,
0,
0,
STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
STATICGUIDOF(*KSDATAFORMAT_SUBTYPE_IEEE_FLOAT*), //Changed
STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)
},
MAX_CHANNELS_PCM, // *2 *
MIN_BITS_PER_SAMPLE_PCM, // *32*
MAX_BITS_PER_SAMPLE_PCM, // *32*
MIN_SAMPLE_RATE, // *44100*
MAX_SAMPLE_RATE // *44100*
},
};

Also made relevant changes to ValidateFormat

..............
...................
case *WAVE_FORMAT_IEEE_FLOAT*:
{
switch (pwfx->wFormatTag)
{
case *WAVE_FORMAT_IEEE_FLOAT*:
{
ntStatus = ValidatePcm(pwfx);
break;
}
}
break;
}
................
..............

and
PropertyHandlerProposedFormat

.......................
........................
if ((pKsFormat->DataFormat.MajorFormat ==
KSDATAFORMAT_TYPE_AUDIO) &&
(pKsFormat->DataFormat.SubFormat ==
*KSDATAFORMAT_SUBTYPE_IEEE_FLOAT*) &&
(pKsFormat->DataFormat.Specifier ==
KSDATAFORMAT_SPECIFIER_WAVEFORMATEX))
{
WAVEFORMATEX* pWfx =
(WAVEFORMATEX*)&pKsFormat->WaveFormatEx;

// make sure the WAVEFORMATEX part of the format makes
sense
if ((pWfx->wBitsPerSample == *32*) &&
((pWfx->nSamplesPerSec == 44100) ||
(pWfx->nSamplesPerSec == 48000)) &&
(pWfx->nBlockAlign == (pWfx->nChannels * 2)) &&
(pWfx->nAvgBytesPerSec == (pWfx->nSamplesPerSec *
pWfx->nBlockAlign)))
{
if ((pWfx->wFormatTag == *WAVE_FORMAT_IEEE_FLOAT*)
&& (pWfx->cbSize == 0))
{
if (pWfx->nChannels == 2)
{
ntStatus = STATUS_SUCCESS;
}
}
else
if ((pWfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) &&
(pWfx->cbSize == CB_EXTENSIBLE))
{
WAVEFORMATEXTENSIBLE* pWfxT =
(WAVEFORMATEXTENSIBLE*)pWfx;

if (((pWfx->nChannels == 2) &&
(pWfxT->dwChannelMask == KSAUDIO_SPEAKER_STEREO)) ||
((pWfx->nChannels == 6) &&
(pWfxT->dwChannelMask == KSAUDIO_SPEAKER_5POINT1_SURROUND)) ||
((pWfx->nChannels == 8) &&
(pWfxT->dwChannelMask == KSAUDIO_SPEAKER_7POINT1_SURROUND)))
{
ntStatus = STATUS_SUCCESS;
}
}
}
...............................
.........................

I built,deployed and installed the driver with above changes.

No devices are added by the driver at playback device as well as recording
device tabs at sound dialog.

I am able to instantiate pin and change its states like acquire, start etc.
using KS Studio.

Could anybody please help me to use 32 bit floating point format in WDM
audio driver.

Thanks,
Zubin.


On Mon, Aug 10, 2015 at 9:01 PM, Matthew van Eerde <
Matthew.van.Eerde@xxxxxxxxxxxxx> wrote:

Sure. Have your data range expose KSDATAFORMAT_SUBTYPE_IEEE_FLOAT instead
of KSDATAFORMAT_SUBTYPE_PCM.



*From:* wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:
wdmaudiodev-bounce@xxxxxxxxxxxxx] *On Behalf Of *Zubin Polra
*Sent:* Monday, August 10, 2015 4:46 AM
*To:* Wdmaudiodev@xxxxxxxxxxxxx
*Subject:* [wdmaudiodev] WDM audio driver for 32 bit floating point
device.



Hello everybody,

Our hardware device expects 32 bit floating point formatted samples. Is
this possible to develop WDM audio driver that can successfully advertise
its pin format as 32 bit floating point and Windows allows clients like
windows media player to feed data to the device?

Thanks

Zubin.

Other related posts: