From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/2] Introduce AUD_set_volume v2
Date: Fri, 02 May 2008 21:04:44 +0200 [thread overview]
Message-ID: <481B65CC.7080801@web.de> (raw)
This is second revision to improve the volume control abilities of QEMU
is based on Andrzej's patch, ie. works per-voice.
In addition, this patch corrects the nominal_volume initialization and
enables volume control by default (the user searching for this feature
will thank us ;) ). For now the NOVOL infrastructure is left in place
although I think it is useless. If we can agree on removing it, I would
immediately post an according patch.
Unless I oversaw some path, input volume control should not yet work, we
still have to apply the per-voice level before delivering the data.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
---
audio/audio.c | 22 ++++++++++++++++++++--
audio/audio.h | 3 +++
audio/mixeng.c | 2 +-
3 files changed, 24 insertions(+), 3 deletions(-)
Index: b/audio/audio.c
===================================================================
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -117,8 +117,8 @@ volume_t nominal_volume = {
1.0,
1.0
#else
- UINT_MAX,
- UINT_MAX
+ 1ULL << 32,
+ 1ULL << 32
#endif
};
@@ -1955,3 +1955,21 @@ void AUD_del_capture (CaptureVoiceOut *c
}
}
}
+
+void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t rvol)
+{
+ if (sw) {
+ sw->vol.mute = mute;
+ sw->vol.l = nominal_volume.l * lvol / 255;
+ sw->vol.r = nominal_volume.r * rvol / 255;
+ }
+}
+
+void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvol)
+{
+ if (sw) {
+ sw->vol.mute = mute;
+ sw->vol.l = nominal_volume.l * lvol / 255;
+ sw->vol.r = nominal_volume.r * rvol / 255;
+ }
+}
Index: b/audio/audio.h
===================================================================
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -124,6 +124,9 @@ int AUD_is_active_out (SWVoiceOut *sw);
void AUD_init_time_stamp_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts);
uint64_t AUD_get_elapsed_usec_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts);
+void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t rvol);
+void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvol);
+
SWVoiceIn *AUD_open_in (
QEMUSoundCard *card,
SWVoiceIn *sw,
Index: b/audio/mixeng.c
===================================================================
--- a/audio/mixeng.c
+++ b/audio/mixeng.c
@@ -28,7 +28,7 @@
#define AUDIO_CAP "mixeng"
#include "audio_int.h"
-#define NOVOL
+//#define NOVOL
/* 8 bit */
#define ENDIAN_CONVERSION natural
reply other threads:[~2008-05-02 19:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=481B65CC.7080801@web.de \
--to=jan.kiszka@web.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.