[pulseaudio-discuss] Get or set volume instead of dB in most cases

zhaochengyi at uniontech.com zhaochengyi at uniontech.com
Tue Jul 12 07:14:38 UTC 2022


Hi guys,

Because many new models of sound cards have various problems with dB 
volume, I would like get or set the element volume in dB only when
e->has_dB is true and e->db_fix is valid.

That is, get or set volume instead of dB in most cases.

Would you please tell me your opinion? Thanks.

patch:
--------------------

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 49c3968..2e88610 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -849,7 +849,7 @@ static int element_get_volume(pa_alsa_element *e, 
snd_mixer_t *m, const pa_chann
          int r;
          pa_volume_t f;

-        if (e->has_dB) {
+        if (e->has_dB && e->db_fix) {
              long value = 0;

              if (e->direction == PA_ALSA_DIRECTION_OUTPUT) {
@@ -1199,7 +1199,7 @@ static int element_set_volume(pa_alsa_element *e, 
snd_mixer_t *m, const pa_chann
              f = pa_cvolume_max(v);
          }

-        if (e->has_dB) {
+        if (e->has_dB && e->db_fix) {
              long value = to_alsa_dB(f);
              int rounding;

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

Thanks,
Chengyi




More information about the pulseaudio-discuss mailing list