flat assembler
Message board for the users of flat assembler.

Index > Windows > IAudioEndpointVolume::GetVolumeRange

Author
Thread Post new topic Reply to topic
Overclick



Joined: 11 Jul 2020
Posts: 577
Location: Ukraine
Overclick
Hey there
Is it bug or am I stupid?

https://docs.microsoft.com/en-us/windows/win32/api/endpointvolume/nf-endpointvolume-iaudioendpointvolume-getvolumerange
They says increment works by fixed dB coefficient but it is not. They use some sort of linear factor, logically 1/100% but it is ratio even if wrong formula and all of drivers uses their own implementation to dB but never real dB increment.

------------------------
[out] pflVolumeIncrementdB

Pointer to the volume increment. This parameter points to a float variable into which the method writes the volume increment in decibels. This increment remains constant for the lifetime of the IAudioEndpointVolume interface instance.

Remarks
The volume range from vmin = *pfLevelMinDB to vmax = *pfLevelMaxDB is divided into n uniform intervals of size vinc = *pfVolumeIncrementDB, where

n = (vmax – vmin) / vinc.

The values vmin, vmax, and vinc are measured in decibels. The client can set the volume level to one of n + 1 discrete values in the range from vmin to vmax.

-------------------------
To check it is wrong switch your device to show dB and you will see it is not linear to dB. Each device implement min and max at their own but volume don't use dB at all. pflVolumeIncrementdB is useless or what?


Description:
Filesize: 16.01 KB
Viewed: 446 Time(s)

Capture.PNG


Post 10 Jul 2022, 10:23
View user's profile Send private message Visit poster's website Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 1889
Furs
I'm not sure I understand your issue. Could you explain what the picture is supposed to represent?

Note that decibels are logarithmic, not linear.

For example a linear slider with dB will look like (approximately):

Code:
100%  = -0.0 dB
50%   = -6.02 dB
25%   = -12 dB
12.5% = -18 dB    


and so on. The API seems to be using dB increments, so mapping them to linear will not look linear.
Post 10 Jul 2022, 14:32
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 577
Location: Ukraine
Overclick
Quote:

For example a linear slider with dB will look like

Exactly. You cannot increase it by fixed size of dB as it explained to be. Because each percent have different increment value, never like that:
Code:
100%  -0dB      (if min-max 100dB for example)
50%   -50dB
25%   -75dB
1%    -99dB    

So why they do that pflVolumeIncrementdB on API? For what, if volume always increase by ratio? Do you know how to force windows to use dB?
Post 10 Jul 2022, 20:05
View user's profile Send private message Visit poster's website Reply with quote
I



Joined: 19 May 2022
Posts: 31
I
Post 11 Jul 2022, 10:24
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 577
Location: Ukraine
Overclick
Ok, windows "mapping via tapered curve", I've got it. But it changes nothing to me. Their curve is almost linear to voltage and they decide how it be. That "almost" is my problem. I need to get one of exact values: dB or ratio. Each audio driver provides their own min-max values that is providing totally wrong dB after that. Some drivers provide from negative to positive dB that broke that curve mapping completely. I'm working on develop real Loudness for windows (iso 226:2003) not that rubbish from Microsoft. Do I have any chance to get clear current ratio for my job?

Look at this screen, tapered curve, serious?
It is virtual audio driver and volume changes exactly the same to other drivers. That is example of total rubbish on dB values.


Description:
Filesize: 17.13 KB
Viewed: 384 Time(s)

Capture.PNG


Post 12 Jul 2022, 06:35
View user's profile Send private message Visit poster's website Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 1889
Furs
In this respect, dB is a relative metric, a ratio. 0 dB means no change, positive means amplification, and negative means the other way around.

Two devices set at 0 dB will not necessarily be equally loud. All it means is that their default loudness is neither amplified nor dimmed.
Post 12 Jul 2022, 13:25
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.