[wdmaudiodev] Re: USB Audio/WASAPI channel limits?

  • From: "Jerry Evans" <jerry@xxxxxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Thu, 13 Feb 2014 10:02:56 -0000

Hello Matthew

 

Update: Using an absolutely minimal exclusive WASAPI capture app on W7x64 I
am getting 48 channels of 48K/16bit audio. Which is great. The recorded
audio is a bit perfect pattern of the 16bit samples originating in the
device firmware.

 

For anyone else who may visit here:

 

The firmware channel mask is set to 0, as is the mask in the
WAVEFORMATEXTENSIBLE used to query the supported formats.

The WASAPI app is querying the property store with
PKEY_AudioEngine_DeviceFormat to check for the 'native' format. This entry
appears to not be created until (at least) the device is queried using the
Sound 

applet >> Advanced Properties tab.

 

Many thanks for the help.

 

Now. What about USB Audio 2 class support?

 

Cheers!

 

From: wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Matthew van Eerde
Sent: 07 February 2014 21:48
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: USB Audio/WASAPI channel limits?

 

I would expect an app to always be able to use 0, whether the hardware is 0
or not.

 

I would expect an app to always be able to use the hardware value, whether
it was 0 or not.

 

I would not expect an app to ever be able to use a non-zero value which does
not match the hardware.

 

If the number of channels is more than. oh, say, 8. then I would expect the
value to always be 0.

 

From: wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Jerry Evans
Sent: Friday, February 7, 2014 1:38 PM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: USB Audio/WASAPI channel limits?

 

Matthew, indeed. Thanks.

 

I will try this next roll. Is your expectation that masks must match?

 

The 1.0 spec we get "If none of the bits in wChannelConfigare set, then all
channels have non-predefined spatial positions." (3.7.2.3). We can source
more than 16 bits worth of channels so I cannot see this field can used used
in any meaningful way (?)

 

 

From:  <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
wdmaudiodev-bounce@xxxxxxxxxxxxx [ <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Matthew van Eerde
Sent: 07 February 2014 21:07
To:  <mailto:wdmaudiodev@xxxxxxxxxxxxx> wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: USB Audio/WASAPI channel limits?

 

It's probably possible to set a breakpoint in
IAudioClient::IsFormatSupported, but let's not go there yet.

 

If you set the channel mask to 0x60f in firmware, I would expect both 0x0
and 0x60f to work in the WAVEFORMATEXTENSIBLE. Let me know if that's not the
case.

 

On your device, what do you get for the following?

 

IAudioClient::GetMixFormat()

 

IAudioClient::IsFormatSupported(x, y)

 

x in { AUDCLNT_SHAREMODE_EXCLUSIVE, AUDCLNT_SHAREMODE_SHARED }

y in { 2-channel, 6-channel w/ channel mask = 0, 6-channel w/ channel mask =
0x3f, 6-channel w/ channel mask = 0x60f }

 

From:  <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
wdmaudiodev-bounce@xxxxxxxxxxxxx [ <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Jerry Evans
Sent: Friday, February 7, 2014 12:02 PM
To:  <mailto:wdmaudiodev@xxxxxxxxxxxxx> wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: USB Audio/WASAPI channel limits?

 

Hi Matthew

 

The wchannelMask is clearly having more impact than I expected. 

 

If I set a channel mask of 0x00 in device firmware and ensure channel mask
in WAVEFORMATEXTENSIBLE is also zero , I can record data correctly using
WASAPI exclusive mode via the Portaudio libraries. I am getting data as
expected, which is good.

 

Question arising are: 

 

If one calls IAudioClient::IsFormatSupported() to check the device's native
format using a WAVEFORMATEXTENSIBLE struct where the channel mask does *not*
match that of the device, will this return a 'format not supported' error?

 

An well-known audio recording app is failing with the device, whilst others
work as expected with WASAPI mode. Is there any way I can determine if (and
what) channel mask it uses when checking in with the audi engine? Is there
any ETW style log data? Or a KS spy?

 

Thanks.

 

From:  <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
wdmaudiodev-bounce@xxxxxxxxxxxxx [ <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Matthew van Eerde
Sent: 06 February 2014 19:35
To:  <mailto:wdmaudiodev@xxxxxxxxxxxxx> wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: USB Audio/WASAPI channel limits?

 

Nitpick: you probably want 0x60f instead of 0x3f or 0; that is, you want
side speakers rather than rear speakers or a "direct out" channel mask.

 

To try instantiating a pin in KS Studio, instantiate the filter first, then
right-click the streaming pin factory and choose "Instantiate." You will
then be able to enter all the parameters to KsCreatePin.

 

cid:image001.png@01CF2853.D030F620

 

The speaker configuration wizard in the Sound control panel doesn't affect
KS Studio; it just tells the Windows audio engine what to pass to
KsCreatePin.

 

From:  <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
wdmaudiodev-bounce@xxxxxxxxxxxxx [ <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Jerry Evans
Sent: Thursday, February 6, 2014 11:22 AM
To:  <mailto:wdmaudiodev@xxxxxxxxxxxxx> wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: USB Audio/WASAPI channel limits?

 

Matthew, a little more exploration and things get more puzzling. For
reference I'm using the cross paltform Portaudio library with exclusive
WASAPI mode as we also have to test this stuff on a Mac.

 

1.       Configure as 2 channel device, all is good. Device is enumerated
correctly, stream precisely the sample pattern we have loaded into firmware.
Channel mask is 0

2.       Configure as 6 channel device, WASAPI baulks claiming sample format
not supported etc (can send you more detail if interested)

3.       Configure as 6 channel device with channel mask set to 0x3F, c.

 

What Is even stranger is that if I run up Audacity (cross-platform audio
editor) the device does not appear if WASAPI mode is selected. It *does*
appear if DirectSound is specified as the audio engine. And to put things
right out there into the twilight zone, for DirectSound reverse the outcomes
for configurations 2 and 3 - i.e. DirectSound mode streams zeroes if, and
only if, the channel mask is set to zero.

 

Thoughts?

 

Many thanks.

 

KS Studio spew follows for 6 channel mode, apparently identical if
channelmask is set to 0x00 or to 0x3F. 

 

( I'm unsure if the failed queries are an issue. Precisely the same is
reported when I instantiate a filter for an M-Audio PCI soundcard and
others):

 

------------------------------

Instantiating Filter: "Chordia 6CH"

 

------------------------------

Profiling filter "\\?\usb#vid_face
<file:///\\%3f\usb%23vid_face&pid_0646&mi_00%238&3864bd55&0&0000%23%7b6994ad
04-93ef-11d0-a3cc-00a0c9223196%7d\global>
&pid_0646&mi_00#8&3864bd55&0&0000#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\glo
bal" 

Getting property KSPROPERTY_TYPE_SETSUPPORT:

Filter Property set supported:

        {c3fa16d7-274e-4f2b-a63b-d5e10955fa27} 

        KSPROPSETID_Pin 

        KSPROPSETID_Audio 

        KSPROPSETID_Topology 

        KSPROPSETID_General 

        {a60d8368-5324-4893-b020-c431a50bcbe3} 

 

Getting event KSEVENT_TYPE_SETSUPPORT:

Filter Event set supported:

 

          Getting property KSPROPERTY_PIN_CTYPES

Getting property KSPROPSETID_Topology.KSPROPERTY_TOPOLOGY_CATEGORIES

          Getting property KSPROPERTY_TOPOLOGY_CATEGORIES

          Got KSPROPERTY_TOPOLOGY_CATEGORIES: 

Getting property KSPROPSETID_Topology.KSPROPERTY_TOPOLOGY_NODES

          Getting property KSPROPERTY_TOPOLOGY_NODES

          Got KSPROPERTY_TOPOLOGY_NODES: 

Getting property KSPROPSETID_Topology.KSPROPERTY_TOPOLOGY_CONNECTIONS

          Getting property KSPROPERTY_TOPOLOGY_CONNECTIONS

          Got KSPROPERTY_TOPOLOGY_CONNECTIONS: 

          Getting property KSPROPERTY_TOPOLOGY_NAME

          Got KSPROPERTY_TOPOLOGY_NAME: 

          Getting property KSPROPERTY_TOPOLOGY_NAME

          Got KSPROPERTY_TOPOLOGY_NAME: 

SyncGetSupportedPropertySets: size query failed

Warning:  QueryPropSetSupport failed for node 0.  Defaulting to "supported
propertyset" array from filter

SyncGetSupportedEventSets: size query failed

Warning:  QueryEventSetSupport failed for node 0.  Defaulting to "supported
eventset" array from filter

SyncGetSupportedPropertySets: size query failed

Warning:  QueryPropSetSupport failed for node 1.  Defaulting to "supported
propertyset" array from filter

SyncGetSupportedEventSets: size query failed

Warning:  QueryEventSetSupport failed for node 1.  Defaulting to "supported
eventset" array from filter

PIN [0]    (pin 1 of 2)

          Getting property KSPROPERTY_PIN_INTERFACES

          Got KSPROPERTY_PIN_INTERFACES: 

          Getting property KSPROPERTY_PIN_MEDIUMS

          Got KSPROPERTY_PIN_MEDIUMS: 

          Getting property KSPROPERTY_PIN_DATARANGES

          Got KSPROPERTY_PIN_DATARANGES: 

          Getting property KSPROPERTY_PIN_CONSTRAINEDDATARANGES

Failed to get property KSPROPSETID_Pin.KSPROPERTY_PIN_CONSTRAINEDDATARANGES

          Getting property KSPROPERTY_PIN_DATAFLOW

          Getting property KSPROPERTY_PIN_COMMUNICATION

          Getting property KSPROPERTY_PIN_CINSTANCES

          Getting property KSPROPERTY_PIN_GLOBALCINSTANCES

Failed to get property KSPROPSETID_Pin.KSPROPERTY_PIN_GLOBALCINSTANCES

          Getting property KSPROPERTY_PIN_NECESSARYINSTANCES

          Getting property KSPROPERTY_PIN_PHYSICALCONNECTION

Failed to get property KSPROPSETID_Pin.KSPROPERTY_PIN_PHYSICALCONNECTION

          Getting property KSPROPERTY_PIN_CATEGORY

          Getting property KSPROPERTY_PIN_NAME

          Got KSPROPERTY_PIN_NAME: 

          Getting property KSPROPERTY_JACK_DESCRIPTION

Failed to get property KSPROPSETID_Jack.KSPROPERTY_JACK_DESCRIPTION

PIN [1]    (pin 2 of 2)

          Getting property KSPROPERTY_PIN_INTERFACES

          Got KSPROPERTY_PIN_INTERFACES: 

          Getting property KSPROPERTY_PIN_MEDIUMS

          Got KSPROPERTY_PIN_MEDIUMS: 

          Getting property KSPROPERTY_PIN_DATARANGES

          Got KSPROPERTY_PIN_DATARANGES: 

          Getting property KSPROPERTY_PIN_CONSTRAINEDDATARANGES

Failed to get property KSPROPSETID_Pin.KSPROPERTY_PIN_CONSTRAINEDDATARANGES

          Getting property KSPROPERTY_PIN_DATAFLOW

          Getting property KSPROPERTY_PIN_COMMUNICATION

          Getting property KSPROPERTY_PIN_CINSTANCES

          Getting property KSPROPERTY_PIN_GLOBALCINSTANCES

Failed to get property KSPROPSETID_Pin.KSPROPERTY_PIN_GLOBALCINSTANCES

          Getting property KSPROPERTY_PIN_NECESSARYINSTANCES

          Getting property KSPROPERTY_PIN_PHYSICALCONNECTION

Failed to get property KSPROPSETID_Pin.KSPROPERTY_PIN_PHYSICALCONNECTION

          Getting property KSPROPERTY_PIN_CATEGORY

          Getting property KSPROPERTY_PIN_NAME

          Got KSPROPERTY_PIN_NAME: 

          Getting property KSPROPERTY_JACK_DESCRIPTION

Failed to get property KSPROPSETID_Jack.KSPROPERTY_JACK_DESCRIPTION

          Getting property KSPROPERTY_PIN_CINSTANCES

          Getting property KSPROPERTY_PIN_NECESSARYINSTANCES

          Getting property KSPROPERTY_PIN_CINSTANCES

          Getting property KSPROPERTY_PIN_NECESSARYINSTANCES

  Node (0) KSNODETYPE_ADC (ADC)

      Supported PropertySets:

                 KSStudio does not recognize PropertySet GUID
{c3fa16d7-274e-4f2b-a63b-d5e10955fa27} supported on Node 0

                                                This is not a driver bug.

        Filter reports support for PropertySet KSPROPSETID_Pin on node 0

        Filter reports support for PropertySet KSPROPSETID_Audio on node 0

        Filter reports support for PropertySet KSPROPSETID_Topology on node
0

        Filter reports support for PropertySet KSPROPSETID_General on node 0

                 KSStudio does not recognize PropertySet GUID
{a60d8368-5324-4893-b020-c431a50bcbe3} supported on Node 0

                                                This is not a driver bug.

      Supported EventSets:

  Node (1) KSNODETYPE_SRC (Sample Rate Converter)

      Supported PropertySets:

                 KSStudio does not recognize PropertySet GUID
{c3fa16d7-274e-4f2b-a63b-d5e10955fa27} supported on Node 1

                                                This is not a driver bug.

        Filter reports support for PropertySet KSPROPSETID_Pin on node 1

        Filter reports support for PropertySet KSPROPSETID_Audio on node 1

        Filter reports support for PropertySet KSPROPSETID_Topology on node
1

        Filter reports support for PropertySet KSPROPSETID_General on node 1

                 KSStudio does not recognize PropertySet GUID
{a60d8368-5324-4893-b020-c431a50bcbe3} supported on Node 1

                                                This is not a driver bug.

      Supported EventSets:

Misc. Supported PropertySets

                 KSStudio does not recognize PropertySet GUID
{c3fa16d7-274e-4f2b-a63b-d5e10955fa27} supported by the filter

                                                This is not a driver bug.

        Filter reports support for PropertySet KSPROPSETID_Audio

        Filter reports the following support for Property
KSPROPERTY_AUDIO_MIC_ARRAY_GEOMETRY: 0x00000001 { KSPROPERTY_TYPE_GET}


          Getting property KSPROPERTY_AUDIO_MIC_ARRAY_GEOMETRY

          KSPROPERTY_AUDIO_MIC_ARRAY_GEOMETRY      get failed

        Filter reports support for PropertySet KSPROPSETID_General

        Filter reports the following support for Property
KSPROPERTY_GENERAL_COMPONENTID: 0x00000001 { KSPROPERTY_TYPE_GET}       

          Getting property KSPROPERTY_GENERAL_COMPONENTID

                 KSStudio does not recognize PropertySet GUID
{a60d8368-5324-4893-b020-c431a50bcbe3} supported by the filter

                                                This is not a driver bug.

 

 

From:  <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
wdmaudiodev-bounce@xxxxxxxxxxxxx [ <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Matthew van Eerde
Sent: 05 February 2014 19:11
To:  <mailto:wdmaudiodev@xxxxxxxxxxxxx> wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: USB Audio/WASAPI channel limits?

 

Well, let's see.

 

You can use KS Studio to validate directly that instantiating a pin with a
(say) 40-channel WAVEFORMATEX works.

 

If your data ranges advertise only a (say) 40-channel format, then I would
expect shared-mode capture not to work at all, since Windows has no idea how
to downmix 40 channels without a channel mask to, e.g., mono. Whether
exclusive-mode capture should work in this situation is less clear.

 

If you advertise both a (say) 2-channel format and a 40-channel format, then
I would expect shared-mode capture to work (in 2-channel mode) and I would
also expect exclusive-mode capture to work in both 2-channel mode and
40-channel mode (with a zero channel mask.) If that is not the case I would
open a support ticket on  <http://support.microsoft.com/>
http://support.microsoft.com/ since there's likely a bug in the capture
stack.

 

It would be helpful to know what function was failing (e.g.,
IAudioClient::IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, .)) as well as
the specific HRESULT that was being returned.

 

From:  <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
wdmaudiodev-bounce@xxxxxxxxxxxxx [ <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Jerry Evans
Sent: Wednesday, February 5, 2014 10:55 AM
To:  <mailto:wdmaudiodev@xxxxxxxxxxxxx> wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: USB Audio/WASAPI channel limits?

 

Yes. It is odd. The descriptors all appear valid. 

 

Can I infer there are no explicit limitations in the stack? This is possibly
not a show stopper as 32+ channels is a large number in most practical
contexts. However, and annoyingly, the audio system for another well-known
proprietary OS seems happy to allow us to stream 80 channels .

 

Thanks and any other suggestions welcomed.

 

From:  <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
wdmaudiodev-bounce@xxxxxxxxxxxxx [ <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Matthew van Eerde
Sent: 05 February 2014 18:36
To:  <mailto:wdmaudiodev@xxxxxxxxxxxxx> wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: USB Audio/WASAPI channel limits?

 

The "channel mask" section of a WAVEFORMATEXTENSIBLE is a 32-bit number.
Perhaps you're tripping some wave format validation that assumes a valid
WAVEFORMATEX only ever has fewer than 32 channels. (This sounds like a bug
to me, since a channel mask of zero is always valid.)

 

From:  <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
wdmaudiodev-bounce@xxxxxxxxxxxxx [ <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Jerry Evans
Sent: Wednesday, February 5, 2014 10:27 AM
To:  <mailto:wdmaudiodev@xxxxxxxxxxxxx> wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] USB Audio/WASAPI channel limits?

 

Greetings.

 

I'm developing a USB2 input only audio device that exposes a large (N >= 24)
number of channels. 

 

The device is recognized and streams correctly on W7x64 at up to 32
channels, 48K sample rate and both 16 and 24 bit sample sizes. Data is
recorded accurately using various commercial WASAPI hosts (Sonar/Tracktion)

 

Windows, however, appears to baulk at any larger channel count. The various
USB tracers (both stack and wire) show Windows sending a QUERY_CAPABILITIES
every second or so when device is configured with 32 channels. Anything
above that and zero action.

 

Is there some hard limit or have I missed something?

 

Cheers.

 

Jerry

PNG image

Other related posts: