[wdmaudiodev] Re: AVStream virtual mic: why could external application 'reset' volume level to 100%?

  • From: "Matthew van Eerde" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "Matthew.van.Eerde" for DMARC)
  • To: Alexander Ivash <elderorb@xxxxxxxxx>, "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Fri, 12 Aug 2016 17:13:00 +0000

Thanks.

Q1: what is the application in question? I suspect the application is either 
pegging the volume control at max, or is gradually turning up the volume in an 
attempt to get the signal to use as many bits as possible without clipping.

If you right-click the volume slider, you should get the option to switch 
between “percent” and “decibels” view.

Switch to “decibels” view. Then drag the slider all the way to the left and 
right to get the min and max.

Q2: Can you share the min and max dB for your virtual device, and also the min 
and max dB for the real device?

The min and max for your virtual device hopefully come from this table:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff536251(v=vs.85).aspx

The min and max for the real device come from the High Definition audio class 
driver, which in turn gets them from the amplifier properties as exposed by the 
hardware.

From: Alexander Ivash<mailto:elderorb@xxxxxxxxx>
Sent: Friday, August 12, 2016 9:58 AM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: AVStream virtual mic: why could external application 
'reset' volume level to 100%?

Sure! It is from different environment but it looks absolutely in the same way. 
[cid:ii_irrzxcr30_1567faf3e11b34d9]

2016-08-12 19:35 GMT+03:00 Matthew van Eerde 
<Matthew.van.Eerde@xxxxxxxxxxxxx<mailto:Matthew.van.Eerde@xxxxxxxxxxxxx>>:

Can you send a screenshot of the mixer?



From: Alexander Ivash<mailto:elderorb@xxxxxxxxx>
Sent: Friday, August 12, 2016 9:33 AM

To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: AVStream virtual mic: why could external application 
'reset' volume level to 100%?



The issue I'm fighting is that some applications reset sound volume to
100% during startup. Let say I open application, specify 50% of
volume, apply changes, check windows mixer - still 50%. Close
application - windows mixer still 50%. Open application again - mixer
is 100%. This doesn't happen with real microphones, only with my
virtual and that's the issue.

2016-08-12 19:22 GMT+03:00 Matthew van Eerde 
<Matthew.van.Eerde@xxxxxxxxxxxxx<mailto:Matthew.van.Eerde@xxxxxxxxxxxxx>>:

Let’s back up a level.



What are you attempting to accomplish?



Right now you have no KSNODETYPE_VOLUME in your signal path, so Windows is
inserting a volume APO above you. Are you OK with that? If so, you don’t
need to do anything.



If you are not OK with that, why not? What is the behavior you’re seeing
that you don’t like?



From: Alexander Ivash
Sent: Friday, August 12, 2016 9:17 AM


To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: AVStream virtual mic: why could external
application 'reset' volume level to 100%?



Thank you Matthew,

I understand what needs to be done from the high-level, but a bit not
sure how to achieve it. As I said at the moment I have two pins in
descriptor table (two pin factories, correct?) - one is 'bridged
input' or 'fake mic' in your diagram, right? Another one is 'real
output'. At the moment topology between them is senseless because the
data is coming directly to output pin so no matter what I will
introduce between these two pins - it will not have any influence on
the volume.

What I need is to send the data to 'fake' mic, introduce volume node
between 'fake' mic and 'real' output and that's it. But the issue is
that 'fake' mic - is bridged pin. Can I send the data to it? Can I
attach automation table it it? Based on my understanding 'bridged' is
not real pin, should I convert it not bridged, but still
'KSPIN_DATAFLOW_IN', 'KSNODETYPE_MICROPHONE' ?

Regards, Alexander

2016-08-12 18:46 GMT+03:00 Matthew van Eerde
<Matthew.van.Eerde@xxxxxxxxxxxxx<mailto:Matthew.van.Eerde@xxxxxxxxxxxxx>>:
If you want Windows (and apps) to manipulate the volume by talking to your
driver, you need to update your topology to have a KSNODETYPE_VOLUME node
which supports the KSPROPERTY_AUDIO_VOLUMELEVEL property.



The simplest such topology looks like this:



Microphone pin factory --> volume node --> streaming pin factory



The microphone factory represents the connection to the (fake) physical
microphone. Windows will use the KSPIN_DESCRIPTOR.Category field to decide
whether this is a microphone, a line in, etc.



The streaming pin factory represents the connection to Windows. Windows
will
query format support on this pin factory, call KsCreatePin here, and
submit
streaming IRPs.



Things in between (nodes) represent stuff that happens between the (fake)
physical microphone and Windows. Volume is one such thing. You could also
stick a mute node here, an automatic gain control, or all kinds of other
things.



From: Alexander Ivash
Sent: Friday, August 12, 2016 4:59 AM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: AVStream virtual mic: why could external
application 'reset' volume level to 100%?



Based on msdn, there is no such a node like
'KSPROPERTY_AUDIO_VOLUMELEVEL', did you mean
'KSPROPERTY_AUDIO_VOLUMELEVEL' property for 'KSNODETYPE_VOLUME' node?
If yes, do I understand correctly that I have to specify such a node,
adjust topology to make data flow through this node and implement
handler for 'KSPROPERTY_AUDIO_VOLUMELEVEL' ?

If all the above is true, I'n not sure how to achieve it with my
current structure / topology..

At the moment my filter has one input pin and one output, input pin is
not used, it is declared as 'bridged' just to make sysaudio happy and
allow driver to be visible as a mic. The actual data is being inside
'Process' function of output pin.

And topology is as simple as the following:

const
KSNODE_DESCRIPTOR AudioNodes[] =
{
DEFINE_NODE_DESCRIPTOR(NULL, &KSNODETYPE_ADC, NULL),
};

const
KSTOPOLOGY_CONNECTION AudioConnections[] =
{ //--FromNode-------FromPin----ToNode---------ToPin
{ KSFILTER_NODE,    1,      0,              0 },
{ 0,                1,      KSFILTER_NODE,  0 }
};

Pin 0 - is real output pin
Pin 1 - is not used bridged pin

Not sure what is the right place to insert 'KSNODETYPE_VOLUME' node
into such a topology... I feel like I should introduce additional
'real' input PIN (or just changed 'bridged' to real), move population
of data from 'output' to 'input' and introduce 'KSNODETYPE_VOLUME' in
between 'output' and 'input'. Does it makes any sense? Or I can just
implement 'KSPROPERTY_AUDIO_VOLUMELEVEL' for my output pin? Based on
my understanding it will not help because docs say:

'The KSPROPERTY_AUDIO_VOLUMELEVEL property specifies the volume level
of a channel in a volume node (KSNODETYPE_VOLUME)'

... but hopefully I'm wrong..

2016-08-12 1:19 GMT+03:00 Matthew van Eerde
<Matthew.van.Eerde@xxxxxxxxxxxxx<mailto:Matthew.van.Eerde@xxxxxxxxxxxxx>>:
Windows offers an API to applications to change the endpoint volume.



If the driver offers a KSPROPERTY_AUDIO_VOLUMELEVEL node, the API will be
connected to this node.



If the driver does not, Windows will insert a software volume APO.





https://msdn.microsoft.com/en-us/library/windows/hardware/ff536251(v=vs.85).aspx



From: Alexander Ivash
Sent: Thursday, August 11, 2016 3:18 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] AVStream virtual mic: why could external
application
'reset' volume level to 100%?



For some reasons it happens with virtual mic, but everything looks
fine with real one, what could be the difference?

Another observation, real mic's volume level changes from "+40dB" to
"+60dB" in Win10, while virtual mic changes from "0" to "100". Is it
because I didn't specify 'volume' node in topology or something like
this?

Regards, Alexander
******************

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/

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

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/

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

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/

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

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/


PNG image

Other related posts: