summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-11-09 23:09:44 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-11-09 23:09:44 +0000
commitfb065187e4ee9e0d1709b344ec01bb426ff1e43b (patch)
treeca7bf5ed6f0731429b9f9b6d62f2993583c9bcfb /audio
parentbf71c9d9b64a70e56db351c38ff71e5e27d871e7 (diff)
downloadqemu-fb065187e4ee9e0d1709b344ec01bb426ff1e43b.tar.gz
audio clean up (initial patch by malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1131 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'audio')
-rw-r--r--audio/audio.c86
-rw-r--r--audio/audio.h133
-rw-r--r--audio/audio_int.h161
-rw-r--r--audio/fmodaudio.c19
-rw-r--r--audio/fmodaudio.h39
-rw-r--r--audio/ossaudio.c31
-rw-r--r--audio/sdlaudio.c15
-rw-r--r--audio/sdlaudio.h34
-rw-r--r--audio/wavaudio.c19
-rw-r--r--audio/wavaudio.h38
10 files changed, 262 insertions, 313 deletions
diff --git a/audio/audio.c b/audio/audio.c
index f55e1a28cc..ec77c259e2 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -22,62 +22,26 @@
* THE SOFTWARE.
*/
#include <assert.h>
-#include <limits.h>
#include "vl.h"
-#define AUDIO_CAP "audio"
-#include "audio/audio.h"
-
#define USE_SDL_AUDIO
#define USE_WAV_AUDIO
-#if defined __linux__ || (defined _BSD && !defined __APPLE__)
-#define USE_OSS_AUDIO
-#endif
-
-#ifdef USE_OSS_AUDIO
-#include "audio/ossaudio.h"
-#endif
-
-#ifdef USE_SDL_AUDIO
-#include "audio/sdlaudio.h"
-#endif
-
-#ifdef USE_WAV_AUDIO
-#include "audio/wavaudio.h"
-#endif
+#include "audio/audio_int.h"
-#ifdef USE_FMOD_AUDIO
-#include "audio/fmodaudio.h"
+#define dolog(...) AUD_log ("audio", __VA_ARGS__)
+#ifdef DEBUG
+#define ldebug(...) dolog (__VA_ARGS__)
+#else
+#define ldebug(...)
#endif
#define QC_AUDIO_DRV "QEMU_AUDIO_DRV"
-#define QC_VOICES "QEMU_VOICES"
+#define QC_VOICES "QEMU_VOICES"
#define QC_FIXED_FORMAT "QEMU_FIXED_FORMAT"
#define QC_FIXED_FREQ "QEMU_FIXED_FREQ"
-extern void SB16_init (void);
-
-#ifdef USE_ADLIB
-extern void Adlib_init (void);
-#endif
-
-#ifdef USE_GUS
-extern void GUS_init (void);
-#endif
-
-static void (*hw_ctors[]) (void) = {
- SB16_init,
-#ifdef USE_ADLIB
- Adlib_init,
-#endif
-#ifdef USE_GUS
- GUS_init,
-#endif
- NULL
-};
-
-static HWVoice *hw_voice;
+static HWVoice *hw_voices;
AudioState audio_state = {
1, /* use fixed settings */
@@ -127,9 +91,10 @@ const char *audio_get_conf_str (const char *key, const char *defval)
return val;
}
-void audio_log (const char *fmt, ...)
+void AUD_log (const char *cap, const char *fmt, ...)
{
va_list ap;
+ fprintf (stderr, "%s: ", cap);
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
@@ -403,7 +368,7 @@ int pcm_hw_init (HWVoice *hw, int freq, int nchannels, audfmt_e fmt)
static int dist (void *hw)
{
if (hw) {
- return (((uint8_t *) hw - (uint8_t *) hw_voice)
+ return (((uint8_t *) hw - (uint8_t *) hw_voices)
/ audio_state.voice_size) + 1;
}
else {
@@ -411,7 +376,7 @@ static int dist (void *hw)
}
}
-#define ADVANCE(hw) hw ? advance (hw, audio_state.voice_size) : hw_voice
+#define ADVANCE(hw) hw ? advance (hw, audio_state.voice_size) : hw_voices
HWVoice *pcm_hw_find_any (HWVoice *hw)
{
@@ -648,6 +613,21 @@ SWVoice *AUD_open (SWVoice *sw, const char *name,
return sw;
}
+void AUD_close (SWVoice *sw)
+{
+ if (!sw)
+ return;
+
+ pcm_sw_fini (sw);
+ pcm_hw_del_sw (sw->hw, sw);
+ pcm_hw_gc (sw->hw);
+ if (sw->name) {
+ qemu_free (sw->name);
+ sw->name = NULL;
+ }
+ qemu_free (sw);
+}
+
int AUD_write (SWVoice *sw, void *buf, int size)
{
int bytes;
@@ -797,13 +777,13 @@ void AUD_enable (SWVoice *sw, int on)
}
static struct audio_output_driver *drvtab[] = {
-#ifdef USE_OSS_AUDIO
+#ifdef CONFIG_OSS
&oss_output_driver,
#endif
#ifdef USE_FMOD_AUDIO
&fmod_output_driver,
#endif
-#ifdef USE_SDL_AUDIO
+#ifdef CONFIG_SDL
&sdl_output_driver,
#endif
#ifdef USE_WAV_AUDIO
@@ -821,8 +801,8 @@ static int voice_init (struct audio_output_driver *drv)
drv->name, audio_state.nb_hw_voices, drv->max_voices);
audio_state.nb_hw_voices = drv->max_voices;
}
- hw_voice = qemu_mallocz (audio_state.nb_hw_voices * drv->voice_size);
- if (hw_voice) {
+ hw_voices = qemu_mallocz (audio_state.nb_hw_voices * drv->voice_size);
+ if (hw_voices) {
audio_state.drv = drv;
return 1;
}
@@ -928,8 +908,4 @@ void AUD_init (void)
dolog ("Can not initialize audio subsystem\n");
return;
}
-
- for (i = 0; hw_ctors[i]; i++) {
- hw_ctors[i] ();
- }
}
diff --git a/audio/audio.h b/audio/audio.h
index 926a1bac93..7520383a47 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -26,13 +26,6 @@
#include "mixeng.h"
-#define dolog(...) fprintf (stderr, AUDIO_CAP ": " __VA_ARGS__)
-#ifdef DEBUG
-#define ldebug(...) dolog (__VA_ARGS__)
-#else
-#define ldebug(...)
-#endif
-
typedef enum {
AUD_FMT_U8,
AUD_FMT_S8,
@@ -40,130 +33,14 @@ typedef enum {
AUD_FMT_S16
} audfmt_e;
-typedef struct HWVoice HWVoice;
-struct audio_output_driver;
-
-typedef struct AudioState {
- int fixed_format;
- int fixed_freq;
- int fixed_channels;
- int fixed_fmt;
- int nb_hw_voices;
- int voice_size;
- int64_t ticks_threshold;
- int freq_threshold;
- void *opaque;
- struct audio_output_driver *drv;
-} AudioState;
-
-extern AudioState audio_state;
-
-typedef struct SWVoice {
- int freq;
- audfmt_e fmt;
- int nchannels;
-
- int shift;
- int align;
-
- t_sample *conv;
-
- int left;
- int pos;
- int bytes_per_second;
- int64_t ratio;
- st_sample_t *buf;
- void *rate;
-
- int wpos;
- int live;
- int active;
- int64_t old_ticks;
- HWVoice *hw;
- char *name;
-} SWVoice;
-
-#define VOICE_ENABLE 1
-#define VOICE_DISABLE 2
-
-struct pcm_ops {
- int (*init) (HWVoice *hw, int freq, int nchannels, audfmt_e fmt);
- void (*fini) (HWVoice *hw);
- void (*run) (HWVoice *hw);
- int (*write) (SWVoice *sw, void *buf, int size);
- int (*ctl) (HWVoice *hw, int cmd, ...);
-};
-
-struct audio_output_driver {
- const char *name;
- void *(*init) (void);
- void (*fini) (void *);
- struct pcm_ops *pcm_ops;
- int can_be_default;
- int max_voices;
- int voice_size;
-};
-
-struct HWVoice {
- int active;
- int enabled;
- int pending_disable;
- int valid;
- int freq;
-
- f_sample *clip;
- audfmt_e fmt;
- int nchannels;
-
- int align;
- int shift;
-
- int rpos;
- int bufsize;
-
- int bytes_per_second;
- st_sample_t *mix_buf;
-
- int samples;
- int64_t old_ticks;
- int nb_voices;
- struct SWVoice **pvoice;
- struct pcm_ops *pcm_ops;
-};
-
-void audio_log (const char *fmt, ...);
-void pcm_sw_free_resources (SWVoice *sw);
-int pcm_sw_alloc_resources (SWVoice *sw);
-void pcm_sw_fini (SWVoice *sw);
-int pcm_sw_init (SWVoice *sw, HWVoice *hw, int freq,
- int nchannels, audfmt_e fmt);
-
-void pcm_hw_clear (HWVoice *hw, void *buf, int len);
-HWVoice * pcm_hw_find_any (HWVoice *hw);
-HWVoice * pcm_hw_find_any_active (HWVoice *hw);
-HWVoice * pcm_hw_find_any_passive (HWVoice *hw);
-HWVoice * pcm_hw_find_specific (HWVoice *hw, int freq,
- int nchannels, audfmt_e fmt);
-HWVoice * pcm_hw_add (int freq, int nchannels, audfmt_e fmt);
-int pcm_hw_add_sw (HWVoice *hw, SWVoice *sw);
-int pcm_hw_del_sw (HWVoice *hw, SWVoice *sw);
-SWVoice * pcm_create_voice_pair (int freq, int nchannels, audfmt_e fmt);
-
-void pcm_hw_free_resources (HWVoice *hw);
-int pcm_hw_alloc_resources (HWVoice *hw);
-void pcm_hw_fini (HWVoice *hw);
-void pcm_hw_gc (HWVoice *hw);
-int pcm_hw_get_live (HWVoice *hw);
-int pcm_hw_get_live2 (HWVoice *hw, int *nb_active);
-void pcm_hw_dec_live (HWVoice *hw, int decr);
-int pcm_hw_write (SWVoice *sw, void *buf, int len);
-
-int audio_get_conf_int (const char *key, int defval);
-const char *audio_get_conf_str (const char *key, const char *defval);
+typedef struct SWVoice SWVoice;
-/* Public API */
SWVoice * AUD_open (SWVoice *sw, const char *name, int freq,
int nchannels, audfmt_e fmt);
+void AUD_init (void);
+void AUD_log (const char *cap, const char *fmt, ...)
+ __attribute__ ((__format__ (__printf__, 2, 3)));;
+void AUD_close (SWVoice *sw);
int AUD_write (SWVoice *sw, void *pcm_buf, int size);
void AUD_adjust (SWVoice *sw, int leftover);
void AUD_reset (SWVoice *sw);
diff --git a/audio/audio_int.h b/audio/audio_int.h
new file mode 100644
index 0000000000..599d3b0614
--- /dev/null
+++ b/audio/audio_int.h
@@ -0,0 +1,161 @@
+/*
+ * QEMU Audio subsystem header
+ *
+ * Copyright (c) 2003-2004 Vassili Karpov (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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef QEMU_AUDIO_INT_H
+#define QEMU_AUDIO_INT_H
+
+#include "vl.h"
+
+struct pcm_ops;
+
+typedef struct HWVoice {
+ int active;
+ int enabled;
+ int pending_disable;
+ int valid;
+ int freq;
+
+ f_sample *clip;
+ audfmt_e fmt;
+ int nchannels;
+
+ int align;
+ int shift;
+
+ int rpos;
+ int bufsize;
+
+ int bytes_per_second;
+ st_sample_t *mix_buf;
+
+ int samples;
+ int64_t old_ticks;
+ int nb_voices;
+ struct SWVoice **pvoice;
+ struct pcm_ops *pcm_ops;
+} HWVoice;
+
+extern struct pcm_ops oss_pcm_ops;
+extern struct audio_output_driver oss_output_driver;
+
+extern struct pcm_ops sdl_pcm_ops;
+extern struct audio_output_driver sdl_output_driver;
+
+extern struct pcm_ops wav_pcm_ops;
+extern struct audio_output_driver wav_output_driver;
+
+extern struct pcm_ops fmod_pcm_ops;
+extern struct audio_output_driver fmod_output_driver;
+
+struct audio_output_driver {
+ const char *name;
+ void *(*init) (void);
+ void (*fini) (void *);
+ struct pcm_ops *pcm_ops;
+ int can_be_default;
+ int max_voices;
+ int voice_size;
+};
+
+typedef struct AudioState {
+ int fixed_format;
+ int fixed_freq;
+ int fixed_channels;
+ int fixed_fmt;
+ int nb_hw_voices;
+ int voice_size;
+ int64_t ticks_threshold;
+ int freq_threshold;
+ void *opaque;
+ struct audio_output_driver *drv;
+} AudioState;
+extern AudioState audio_state;
+
+struct SWVoice {
+ int freq;
+ audfmt_e fmt;
+ int nchannels;
+
+ int shift;
+ int align;
+
+ t_sample *conv;
+
+ int left;
+ int pos;
+ int bytes_per_second;
+ int64_t ratio;
+ st_sample_t *buf;
+ void *rate;
+
+ int wpos;
+ int live;
+ int active;
+ int64_t old_ticks;
+ HWVoice *hw;
+ char *name;
+};
+
+struct pcm_ops {
+ int (*init) (HWVoice *hw, int freq, int nchannels, audfmt_e fmt);
+ void (*fini) (HWVoice *hw);
+ void (*run) (HWVoice *hw);
+ int (*write) (SWVoice *sw, void *buf, int size);
+ int (*ctl) (HWVoice *hw, int cmd, ...);
+};
+
+void pcm_sw_free_resources (SWVoice *sw);
+int pcm_sw_alloc_resources (SWVoice *sw);
+void pcm_sw_fini (SWVoice *sw);
+int pcm_sw_init (SWVoice *sw, HWVoice *hw, int freq,
+ int nchannels, audfmt_e fmt);
+
+void pcm_hw_clear (HWVoice *hw, void *buf, int len);
+HWVoice * pcm_hw_find_any (HWVoice *hw);
+HWVoice * pcm_hw_find_any_active (HWVoice *hw);
+HWVoice * pcm_hw_find_any_passive (HWVoice *hw);
+HWVoice * pcm_hw_find_specific (HWVoice *hw, int freq,
+ int nchannels, audfmt_e fmt);
+HWVoice * pcm_hw_add (int freq, int nchannels, audfmt_e fmt);
+int pcm_hw_add_sw (HWVoice *hw, SWVoice *sw);
+int pcm_hw_del_sw (HWVoice *hw, SWVoice *sw);
+SWVoice * pcm_create_voice_pair (int freq, int nchannels, audfmt_e fmt);
+
+void pcm_hw_free_resources (HWVoice *hw);
+int pcm_hw_alloc_resources (HWVoice *hw);
+void pcm_hw_fini (HWVoice *hw);
+void pcm_hw_gc (HWVoice *hw);
+int pcm_hw_get_live (HWVoice *hw);
+int pcm_hw_get_live2 (HWVoice *hw, int *nb_active);
+void pcm_hw_dec_live (HWVoice *hw, int decr);
+int pcm_hw_write (SWVoice *sw, void *buf, int len);
+
+int audio_get_conf_int (const char *key, int defval);
+const char *audio_get_conf_str (const char *key, const char *defval);
+
+struct audio_output_driver;
+
+#define VOICE_ENABLE 1
+#define VOICE_DISABLE 2
+
+#endif /* audio_int.h */
diff --git a/audio/fmodaudio.c b/audio/fmodaudio.c
index 7457033f92..8245f93fde 100644
--- a/audio/fmodaudio.c
+++ b/audio/fmodaudio.c
@@ -25,9 +25,22 @@
#include <fmod_errors.h>
#include "vl.h"
-#define AUDIO_CAP "fmod"
-#include "audio/audio.h"
-#include "audio/fmodaudio.h"
+#include "audio/audio_int.h"
+
+typedef struct FMODVoice {
+ HWVoice hw;
+ unsigned int old_pos;
+ FSOUND_SAMPLE *fmod_sample;
+ int channel;
+} FMODVoice;
+
+
+#define dolog(...) AUD_log ("fmod", __VA_ARGS__)
+#ifdef DEBUG
+#define ldebug(...) dolog (__VA_ARGS__)
+#else
+#define ldebug(...)
+#endif
#define QC_FMOD_DRV "QEMU_FMOD_DRV"
#define QC_FMOD_FREQ "QEMU_FMOD_FREQ"
diff --git a/audio/fmodaudio.h b/audio/fmodaudio.h
deleted file mode 100644
index 9f85c30804..0000000000
--- a/audio/fmodaudio.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * QEMU FMOD audio output driver header
- *
- * Copyright (c) 2004 Vassili Karpov (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
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef QEMU_FMODAUDIO_H
-#define QEMU_FMODAUDIO_H
-
-#include <fmod.h>
-
-typedef struct FMODVoice {
- struct HWVoice hw;
- unsigned int old_pos;
- FSOUND_SAMPLE *fmod_sample;
- int channel;
-} FMODVoice;
-
-extern struct pcm_ops fmod_pcm_ops;
-extern struct audio_output_driver fmod_output_driver;
-
-#endif /* fmodaudio.h */
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 9fefaa3a27..6bf8cc40c2 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -21,20 +21,32 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-/* Temporary kludge */
-#if defined __linux__ || (defined _BSD && !defined __APPLE__)
-#include <assert.h>
-#include "vl.h"
-
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
+#include <assert.h>
+#include "vl.h"
+
+#include "audio/audio_int.h"
+
+typedef struct OSSVoice {
+ HWVoice hw;
+ void *pcm_buf;
+ int fd;
+ int nfrags;
+ int fragsize;
+ int mmapped;
+ int old_optr;
+} OSSVoice;
-#define AUDIO_CAP "oss"
-#include "audio/audio.h"
-#include "audio/ossaudio.h"
+
+#define dolog(...) AUD_log ("oss", __VA_ARGS__)
+#ifdef DEBUG
+#define ldebug(...) dolog (__VA_ARGS__)
+#else
+#define ldebug(...)
+#endif
#define QC_OSS_FRAGSIZE "QEMU_OSS_FRAGSIZE"
#define QC_OSS_NFRAGS "QEMU_OSS_NFRAGS"
@@ -463,4 +475,3 @@ struct audio_output_driver oss_output_driver = {
INT_MAX,
sizeof (OSSVoice)
};
-#endif
diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index 4d75853422..6103c4511b 100644
--- a/audio/sdlaudio.c
+++ b/audio/sdlaudio.c
@@ -25,9 +25,18 @@
#include <SDL/SDL_thread.h>
#include "vl.h"
-#define AUDIO_CAP "sdl"
-#include "audio/audio.h"
-#include "audio/sdlaudio.h"
+#include "audio/audio_int.h"
+
+typedef struct SDLVoice {
+ HWVoice hw;
+} SDLVoice;
+
+#define dolog(...) AUD_log ("sdl", __VA_ARGS__)
+#ifdef DEBUG
+#define ldebug(...) dolog (__VA_ARGS__)
+#else
+#define ldebug(...)
+#endif
#define QC_SDL_SAMPLES "QEMU_SDL_SAMPLES"
diff --git a/audio/sdlaudio.h b/audio/sdlaudio.h
deleted file mode 100644
index 380d0da2a2..0000000000
--- a/audio/sdlaudio.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * QEMU SDL audio output driver header
- *
- * Copyright (c) 2004 Vassili Karpov (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
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef QEMU_SDLAUDIO_H
-#define QEMU_SDLAUDIO_H
-
-typedef struct SDLVoice {
- struct HWVoice hw;
-} SDLVoice;
-
-extern struct pcm_ops sdl_pcm_ops;
-extern struct audio_output_driver sdl_output_driver;
-
-#endif /* sdlaudio.h */
diff --git a/audio/wavaudio.c b/audio/wavaudio.c
index dee4a060dd..f8d6acb4a2 100644
--- a/audio/wavaudio.c
+++ b/audio/wavaudio.c
@@ -23,9 +23,22 @@
*/
#include "vl.h"
-#define AUDIO_CAP "wav"
-#include "audio/audio.h"
-#include "audio/wavaudio.h"
+#include "audio/audio_int.h"
+
+typedef struct WAVVoice {
+ HWVoice hw;
+ QEMUFile *f;
+ int64_t old_ticks;
+ void *pcm_buf;
+ int total_samples;
+} WAVVoice;
+
+#define dolog(...) AUD_log ("wav", __VA_ARGS__)
+#ifdef DEBUG
+#define ldebug(...) dolog (__VA_ARGS__)
+#else
+#define ldebug(...)
+#endif
static struct {
const char *wav_path;
diff --git a/audio/wavaudio.h b/audio/wavaudio.h
deleted file mode 100644
index 0b6070be76..0000000000
--- a/audio/wavaudio.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * QEMU WAV audio output driver header
- *
- * Copyright (c) 2004 Vassili Karpov (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
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef QEMU_WAVAUDIO_H
-#define QEMU_WAVAUDIO_H
-
-typedef struct WAVVoice {
- struct HWVoice hw;
- QEMUFile *f;
- int64_t old_ticks;
- void *pcm_buf;
- int total_samples;
-} WAVVoice;
-
-extern struct pcm_ops wav_pcm_ops;
-extern struct audio_output_driver wav_output_driver;
-
-#endif /* wavaudio.h */