aboutsummaryrefslogtreecommitdiff
path: root/audio/audio.h
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/audio.h
parentbf71c9d9b64a70e56db351c38ff71e5e27d871e7 (diff)
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/audio.h')
-rw-r--r--audio/audio.h133
1 files changed, 5 insertions, 128 deletions
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);