Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging

The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.

Check out The OSR Learning Library at:

WaveRT miniport: dynamic channel number change

ymukhaymukha Member Posts: 2

Dear Community,

could you, pls, advise w/ the following topic

I'm implementing Win audio driver which exposes virtual micarray and speaker (see simpleaudiosample for ex.). It has WaveRT and Topology miniports for both speaker and mic. What I need is to change number of supported channels dynamically at runtime.

Basically, driver is based on simpleaudiosample example from ms. What I'm doing to change is:
1. Get custom IOCTL w/ new channel number;
2. Handover this channel number to mic and speaker WaveRTs;
3. In each WaveRT I do the following:
3.1. Update EndpointMinipair->DeviceMaxChannels to a new channel value;
3.2. Update streaming pin's audio format data range (have only one entry) w/ new max channel number;
3.3. Update streaming pin's array with supported device formats and modes (basically formats in this structure) w/ new max channel number;
3.4. Emit KSEVENT_PINCAPS_FORMATCHANGE event for streaming pin (event is present in automation table for streaming pin and properly registered in port driver w/ AddEventToEventList() upon PCEVENT_VERB_ADD);

My expectation is that upon KSEVENT_PINCAPS_FORMATCHANGE , port driver will call KSPROPERTY_PIN_PROPOSEDATAFORMAT (implemented only set) / KSPROPERTY_PIN_PROPOSEDATAFORMA2 (implemented only get) and IMiniportWaveRT::DataRangeIntersection(), and will adjust streaming pin's format to new number of channels. My expectation to vary number of channels to any value in the range [0;32].

Problem is that:

  • OK: If I initialize miniport (upon subdevice creation) and all supported formats (step 3.3) contain 32 channels only, I can vary number of channels dynamically to any value in the range [0;32].
  • NOT OK: But if I initialize miniport (upon subdevice creation) and all supported formats (step 3.3) contain 2 channels and then try to change number of channels to 32, speaker device cannot be initialized through WASAPI AudioClient. I also can't play test tone through mmsys.cpl speaker's properties. However mic is initialized normally

I've tried to debug different things, but could not solve 'NOT OK' case. I also don't understand why there is difference between speaker and mic when KSEVENT_PINCAPS_FORMATCHANGE is emitted (mic: initialized, speaker: not). Could you, pls, share your expertise and help me to clarify how to find the root cause of 'NOT OK' case? Thank you for your time


  • ymukhaymukha Member Posts: 2

    @Tim_Roberts may be you may advice here? Previously, I've found your input extremely helpful in other osr topics. My apologies for bothering

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,718

    In the video world (AVStream), the static data formats report everything you can ever possibly do, and the DataIntersection handler trims that down to the list of things you can do right now. I have not always had the same experience with audio drivers. There do seem to be some hidden assumptions about 2-channel devices, but I was never able to come up with a mental model to describe it.

    As always, I would suggest you ask your question on the [wdmaudiodev] list at . That's where the cool audio kids hang out, including two members of the Microsoft audio team who have proven to be an incredible resource over the years.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 13-17 May 2024 Live, Online
Developing Minifilters 1-5 Apr 2024 Live, Online
Internals & Software Drivers 11-15 Mar 2024 Live, Online
Writing WDF Drivers 26 Feb - 1 Mar 2024 Live, Online