Attached patch fixes a couple of problems.

--
mailto:[EMAIL PROTECTED]
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}
 };
 
_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to