audio clean up (initial patch by malc)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1131 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/hw/adlib.c b/hw/adlib.c
index a49b32b..939a7ed 100644
--- a/hw/adlib.c
+++ b/hw/adlib.c
@@ -23,8 +23,12 @@
  */
 #include "vl.h"
 
-#define AUDIO_CAP "adlib"
-#include "audio/audio.h"
+#define dolog(...) AUD_log ("adlib", __VA_ARGS__)
+#ifdef DEBUG
+#define ldebug(...) dolog (__VA_ARGS__)
+#else
+#define ldebug(...)
+#endif
 
 #ifdef USE_YMF262
 #define HAS_YMF262 1
diff --git a/hw/pc.c b/hw/pc.c
index fbcd969..06ec7b1 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -555,8 +555,19 @@
     DMA_init(0);
 
     if (audio_enabled) {
-        /* no audio supported yet for win32 */
         AUD_init();
+#ifdef USE_SB16
+        if (sb16_enabled)
+            SB16_init ();
+#endif
+#ifdef CONFIG_ADLIB
+        if (adlib_enabled)
+            Adlib_init ();
+#endif
+#ifdef USE_GUS
+        if (gus_enabled)
+            GUS_init ();
+#endif
     }
 
     floppy_controller = fdctrl_init(6, 2, 0, 0x3f0, fd_table);
diff --git a/hw/sb16.c b/hw/sb16.c
index d932056..a94e689 100644
--- a/hw/sb16.c
+++ b/hw/sb16.c
@@ -23,12 +23,16 @@
  */
 #include "vl.h"
 
-/* #define DEBUG */
-#define AUDIO_CAP "sb16"
-#include "audio/audio.h"
-
 #define LENOFA(a) ((int) (sizeof(a)/sizeof(a[0])))
 
+#define dolog(...) AUD_log ("sb16", __VA_ARGS__)
+#ifdef DEBUG
+#define ldebug(...) dolog (__VA_ARGS__)
+#else
+#define ldebug(...)
+#endif
+
+/* #define DEBUG */
 /* #define DEBUG_SB16_MOST */
 
 #define IO_READ_PROTO(name)                             \
@@ -511,7 +515,7 @@
     return;
 
  warn:
-    dolog ("warning command %#x,%d is not trully understood yet\n",
+    dolog ("warning: command %#x,%d is not trully understood yet\n",
            cmd, s->needed_bytes);
     s->cmd = cmd;
     return;
@@ -1172,8 +1176,10 @@
     qemu_get_be32s (f, &s->mixer_nreg);
     qemu_get_buffer (f, s->mixer_regs, 256);
 
-    if (s->voice)
-        AUD_reset (s->voice);
+    if (s->voice) {
+        AUD_close (s->voice);
+        s->voice = NULL;
+    }
 
     if (s->dma_running) {
         if (s->freq)