From: Michael Walle <michael@walle.cc>
To: qemu-devel@nongnu.org
Cc: Michael Walle <michael@walle.cc>
Subject: [Qemu-devel] [PATCH 2/2] alsaaudio: add endianness support for VoiceIn
Date: Sat, 8 Jan 2011 17:53:30 +0100 [thread overview]
Message-ID: <1294505610-20187-2-git-send-email-michael@walle.cc> (raw)
In-Reply-To: <alpine.LNX.2.00.1101081938570.1684@linmac>
Signed-off-by: Michael Walle <michael@walle.cc>
---
audio/alsaaudio.c | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index 0741203..8d77646 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -318,7 +318,7 @@ static int alsa_write (SWVoiceOut *sw, void *buf, int len)
return audio_pcm_sw_write (sw, buf, len);
}
-static snd_pcm_format_t aud_to_alsafmt (audfmt_e fmt)
+static snd_pcm_format_t aud_to_alsafmt (audfmt_e fmt, int endianness)
{
switch (fmt) {
case AUD_FMT_S8:
@@ -328,16 +328,32 @@ static snd_pcm_format_t aud_to_alsafmt (audfmt_e fmt)
return SND_PCM_FORMAT_U8;
case AUD_FMT_S16:
- return SND_PCM_FORMAT_S16_LE;
+ if (endianness) {
+ return SND_PCM_FORMAT_S16_BE;
+ } else {
+ return SND_PCM_FORMAT_S16_LE;
+ }
case AUD_FMT_U16:
- return SND_PCM_FORMAT_U16_LE;
+ if (endianness) {
+ return SND_PCM_FORMAT_U16_BE;
+ } else {
+ return SND_PCM_FORMAT_U16_LE;
+ }
case AUD_FMT_S32:
- return SND_PCM_FORMAT_S32_LE;
+ if (endianness) {
+ return SND_PCM_FORMAT_S32_BE;
+ } else {
+ return SND_PCM_FORMAT_S32_LE;
+ }
case AUD_FMT_U32:
- return SND_PCM_FORMAT_U32_LE;
+ if (endianness) {
+ return SND_PCM_FORMAT_U32_BE;
+ } else {
+ return SND_PCM_FORMAT_U32_LE;
+ }
default:
dolog ("Internal logic error: Bad audio format %d\n", fmt);
@@ -809,7 +825,7 @@ static int alsa_init_out (HWVoiceOut *hw, struct audsettings *as)
snd_pcm_t *handle;
struct audsettings obt_as;
- req.fmt = aud_to_alsafmt (as->fmt);
+ req.fmt = aud_to_alsafmt (as->fmt, as->endianness);
req.freq = as->freq;
req.nchannels = as->nchannels;
req.period_size = conf.period_size_out;
@@ -918,7 +934,7 @@ static int alsa_init_in (HWVoiceIn *hw, struct audsettings *as)
snd_pcm_t *handle;
struct audsettings obt_as;
- req.fmt = aud_to_alsafmt (as->fmt);
+ req.fmt = aud_to_alsafmt (as->fmt, as->endianness);
req.freq = as->freq;
req.nchannels = as->nchannels;
req.period_size = conf.period_size_in;
--
1.7.2.3
prev parent reply other threads:[~2011-01-08 16:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-08 15:28 [Qemu-devel] [PATCH 1/2] ossaudio: add endianness support for VoiceIn Michael Walle
2011-01-08 15:28 ` [Qemu-devel] [PATCH 2/2] alsaaudio: " Michael Walle
2011-01-08 16:42 ` [Qemu-devel] Re: [PATCH 1/2] ossaudio: " malc
2011-01-08 16:53 ` [Qemu-devel] " Michael Walle
2011-01-09 0:07 ` [Qemu-devel] " malc
2011-01-08 16:53 ` Michael Walle [this message]
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=1294505610-20187-2-git-send-email-michael@walle.cc \
--to=michael@walle.cc \
--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).