From: malc <malc@pulsesoft.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: esd audio output patch and debuging.
Date: Mon, 4 Sep 2006 04:07:51 +0400 (MSD) [thread overview]
Message-ID: <Pine.LNX.4.64.0609040406200.1966@home.oyster.ru> (raw)
[-- Attachment #1: Type: TEXT/PLAIN, Size: 73 bytes --]
Attached patch fixes a couple of problems.
--
mailto:malc@pulsesoft.com
[-- Attachment #2: Type: TEXT/PLAIN, Size: 2505 bytes --]
Index: esdaudio.c
===================================================================
RCS file: /home/malc/cvsroot/bellard/qemu/audio/Attic/esdaudio.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 esdaudio.c
--- esdaudio.c 3 Sep 2006 21:57:19 -0000 1.1.2.1
+++ esdaudio.c 3 Sep 2006 23:58:29 -0000
@@ -1,7 +1,7 @@
/*
* QEMU ESD audio driver
*
- * Copyright (c) 2006 Frederick Reeve (brushed up malc)
+ * Copyright (c) 2006 Frederick Reeve (brushed up by malc)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -44,8 +44,10 @@
static struct {
int samples;
+ int divisor;
} conf = {
- 1024
+ 1024,
+ 2
};
static void GCC_FMT_ATTR (2, 3) esd_logerr (int err, const char *fmt, ...)
@@ -117,22 +119,25 @@
{
ESDVoiceOut *esd = arg;
HWVoiceOut *hw = &esd->hw;
+ int threshold;
+
+ threshold = conf.divisor ? hw->samples / conf.divisor : 0;
for (;;) {
int decr, to_mix, rpos;
- if (esd->done) {
- break;
- }
-
- if (esd_cwait (esd, AUDIO_FUNC)) {
+ for (;;) {
if (esd->done) {
+ goto exit;
+ }
+
+ if (esd->live > threshold) {
break;
}
- }
- if (esd->live < hw->samples / 2) {
- continue;
+ if (esd_cwait (esd, AUDIO_FUNC)) {
+ goto exit;
+ }
}
decr = to_mix = esd->live;
@@ -176,14 +181,16 @@
to_mix -= chunk;
}
- if (esd_mlock (esd, AUDIO_FUNC))
+ if (esd_mlock (esd, AUDIO_FUNC)) {
return NULL;
+ }
esd->rpos = rpos;
- esd->live = 0;
+ esd->live -= decr;
esd->decr += decr;
}
+ exit:
esd_munlock (esd, AUDIO_FUNC);
return NULL;
}
@@ -235,7 +242,7 @@
goto fail1;
}
- esdfmt = as->nchannels == 2 ? ESD_STEREO : ESD_MONO;
+ esdfmt |= (as->nchannels == 2) ? ESD_STEREO : ESD_MONO;
switch (as->fmt) {
case AUD_FMT_S8:
case AUD_FMT_U8:
@@ -371,6 +378,9 @@
{"SAMPLES", AUD_OPT_INT, &conf.samples,
"buffer size in samples", NULL, 0},
+ {"DIVISOR", AUD_OPT_INT, &conf.divisor,
+ "threshold divisor", NULL, 0},
+
{NULL, 0, NULL, NULL, NULL, 0}
};
next reply other threads:[~2006-09-04 0:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-04 0:07 malc [this message]
2006-09-04 5:33 ` [Qemu-devel] Re: esd audio output patch and debuging Frederick Reeve
-- strict thread matches above, loose matches on Subject: below --
2006-09-03 22:33 malc
2006-09-04 8:56 ` Peter Oberndorfer
2006-09-04 12:01 ` Christophe Fillot
2006-09-04 14:04 ` Peter Oberndorfer
2006-09-04 12:02 ` malc
2006-08-30 15:45 [Qemu-devel] " Frederick Reeve
2006-08-31 11:46 ` [Qemu-devel] " malc
2006-08-31 17:19 ` Leonardo E. Reiter
2006-09-01 19:02 ` malc
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=Pine.LNX.4.64.0609040406200.1966@home.oyster.ru \
--to=malc@pulsesoft.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).