From: Yaroslav Isakov <yaroslav.isakov@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] If raw DB values are known, use them in paaudio
Date: Fri, 21 Dec 2018 01:25:14 +0100 [thread overview]
Message-ID: <fca88dd3e21b29a12d6f00e65eebdd146024302f.1545425136.git.yaroslav.isakov@gmail.com> (raw)
In-Reply-To: <cover.1545425136.git.yaroslav.isakov@gmail.com>
Signed-off-by: Yaroslav Isakov <yaroslav.isakov@gmail.com>
---
audio/paaudio.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/audio/paaudio.c b/audio/paaudio.c
index 4c100bc318..d25df102ab 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -724,8 +724,13 @@ static int qpa_ctl_out (HWVoiceOut *hw, int cmd, ...)
va_end (ap);
v.channels = 2;
- v.values[0] = ((PA_VOLUME_NORM - PA_VOLUME_MUTED) * sw->vol.l) / UINT32_MAX;
- v.values[1] = ((PA_VOLUME_NORM - PA_VOLUME_MUTED) * sw->vol.r) / UINT32_MAX;
+ if (sw->vol.db_known) {
+ v.values[0] = pa_sw_volume_from_dB(sw->vol.l_db);
+ v.values[1] = pa_sw_volume_from_dB(sw->vol.r_db);
+ } else {
+ v.values[0] = ((PA_VOLUME_NORM - PA_VOLUME_MUTED) * sw->vol.l) / UINT32_MAX;
+ v.values[1] = ((PA_VOLUME_NORM - PA_VOLUME_MUTED) * sw->vol.r) / UINT32_MAX;
+ }
pa_threaded_mainloop_lock (g->mainloop);
--
2.18.1
next prev parent reply other threads:[~2018-12-21 21:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-21 20:45 [Qemu-devel] [PATCH 0/3] Allow hw/audio drivers to pass raw DB values to audio/ drivers Yaroslav Isakov
2018-12-21 0:21 ` [Qemu-devel] [PATCH 1/3] Allow audio driver to pass DB value to underlying drivers Yaroslav Isakov
2018-12-21 0:25 ` Yaroslav Isakov [this message]
2018-12-21 20:31 ` [Qemu-devel] [PATCH 2/3] Pass raw DB values from hda-codec.c to audio driver Yaroslav Isakov
2018-12-21 21:39 ` Yaroslav Isakov
2018-12-26 15:41 ` [Qemu-devel] [PATCH 0/3] Allow hw/audio drivers to pass raw DB values to audio/ drivers no-reply
-- strict thread matches above, loose matches on Subject: below --
2018-12-21 21:14 Yaroslav Isakov
2018-12-21 0:25 ` [Qemu-devel] [PATCH 3/3] If raw DB values are known, use them in paaudio Yaroslav Isakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fca88dd3e21b29a12d6f00e65eebdd146024302f.1545425136.git.yaroslav.isakov@gmail.com \
--to=yaroslav.isakov@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).