aboutsummaryrefslogtreecommitdiff
path: root/audio/audio_int.h
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-11-05 18:55:28 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-11-05 18:55:28 +0000
commitc0fe3827ea18f7d29550f2ff2495cec2fe7a3d94 (patch)
tree2a9572602c93a5424a488929b56f29ac610a1641 /audio/audio_int.h
parentf04308e45274d0e74546870ea7b02aaef07b077e (diff)
audio merge (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1601 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'audio/audio_int.h')
-rw-r--r--audio/audio_int.h107
1 files changed, 43 insertions, 64 deletions
diff --git a/audio/audio_int.h b/audio/audio_int.h
index 9d288292a7..6d4c32b068 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -24,16 +24,12 @@
#ifndef QEMU_AUDIO_INT_H
#define QEMU_AUDIO_INT_H
-#include "sys-queue.h"
-
#ifdef CONFIG_COREAUDIO
#define FLOAT_MIXENG
/* #define RECIPROCAL */
#endif
#include "mixeng.h"
-int audio_bug (const char *funcname, int cond);
-
struct audio_pcm_ops;
typedef enum {
@@ -69,7 +65,6 @@ struct audio_pcm_info {
};
typedef struct HWVoiceOut {
- int active;
int enabled;
int pending_disable;
int valid;
@@ -78,7 +73,6 @@ typedef struct HWVoiceOut {
f_sample *clip;
int rpos;
- int bufsize;
uint64_t ts_helper;
st_sample_t *mix_buf;
@@ -91,13 +85,11 @@ typedef struct HWVoiceOut {
typedef struct HWVoiceIn {
int enabled;
- int active;
struct audio_pcm_info info;
t_sample *conv;
int wpos;
- int bufsize;
int total_samples_captured;
uint64_t ts_helper;
@@ -109,58 +101,6 @@ typedef struct HWVoiceIn {
LIST_ENTRY (HWVoiceIn) entries;
} HWVoiceIn;
-extern struct audio_driver no_audio_driver;
-extern struct audio_driver oss_audio_driver;
-extern struct audio_driver sdl_audio_driver;
-extern struct audio_driver wav_audio_driver;
-extern struct audio_driver fmod_audio_driver;
-extern struct audio_driver alsa_audio_driver;
-extern struct audio_driver coreaudio_audio_driver;
-extern struct audio_driver dsound_audio_driver;
-extern volume_t nominal_volume;
-
-struct audio_driver {
- const char *name;
- const char *descr;
- struct audio_option *options;
- void *(*init) (void);
- void (*fini) (void *);
- struct audio_pcm_ops *pcm_ops;
- int can_be_default;
- int max_voices_out;
- int max_voices_in;
- int voice_size_out;
- int voice_size_in;
-};
-
-typedef struct AudioState {
- int fixed_settings_out;
- int fixed_freq_out;
- int fixed_channels_out;
- int fixed_fmt_out;
- int nb_hw_voices_out;
- int greedy_out;
-
- int fixed_settings_in;
- int fixed_freq_in;
- int fixed_channels_in;
- int fixed_fmt_in;
- int nb_hw_voices_in;
- int greedy_in;
-
- void *opaque;
- struct audio_driver *drv;
-
- QEMUTimer *ts;
- union {
- int usec;
- int64_t ticks;
- } period;
-
- int plive;
-} AudioState;
-extern AudioState audio_state;
-
struct SWVoiceOut {
struct audio_pcm_info info;
t_sample *conv;
@@ -192,22 +132,58 @@ struct SWVoiceIn {
LIST_ENTRY (SWVoiceIn) entries;
};
+struct audio_driver {
+ const char *name;
+ const char *descr;
+ struct audio_option *options;
+ void *(*init) (void);
+ void (*fini) (void *);
+ struct audio_pcm_ops *pcm_ops;
+ int can_be_default;
+ int max_voices_out;
+ int max_voices_in;
+ int voice_size_out;
+ int voice_size_in;
+};
+
struct audio_pcm_ops {
- int (*init_out)(HWVoiceOut *hw, int freq, int nchannels, audfmt_e fmt);
+ int (*init_out)(HWVoiceOut *hw, audsettings_t *as);
void (*fini_out)(HWVoiceOut *hw);
int (*run_out) (HWVoiceOut *hw);
int (*write) (SWVoiceOut *sw, void *buf, int size);
int (*ctl_out) (HWVoiceOut *hw, int cmd, ...);
- int (*init_in) (HWVoiceIn *hw, int freq, int nchannels, audfmt_e fmt);
+ int (*init_in) (HWVoiceIn *hw, audsettings_t *as);
void (*fini_in) (HWVoiceIn *hw);
int (*run_in) (HWVoiceIn *hw);
int (*read) (SWVoiceIn *sw, void *buf, int size);
int (*ctl_in) (HWVoiceIn *hw, int cmd, ...);
};
-void audio_pcm_init_info (struct audio_pcm_info *info, int freq,
- int nchannels, audfmt_e fmt, int swap_endian);
+struct AudioState {
+ struct audio_driver *drv;
+ void *drv_opaque;
+
+ QEMUTimer *ts;
+ LIST_HEAD (card_head, QEMUSoundCard) card_head;
+ LIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in;
+ LIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out;
+ int nb_hw_voices_out;
+ int nb_hw_voices_in;
+};
+
+extern struct audio_driver no_audio_driver;
+extern struct audio_driver oss_audio_driver;
+extern struct audio_driver sdl_audio_driver;
+extern struct audio_driver wav_audio_driver;
+extern struct audio_driver fmod_audio_driver;
+extern struct audio_driver alsa_audio_driver;
+extern struct audio_driver coreaudio_audio_driver;
+extern struct audio_driver dsound_audio_driver;
+extern volume_t nominal_volume;
+
+void audio_pcm_init_info (struct audio_pcm_info *info, audsettings_t *as,
+ int swap_endian);
void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len);
int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int len);
@@ -217,6 +193,9 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int len);
int audio_pcm_hw_get_live_out (HWVoiceOut *hw);
int audio_pcm_hw_get_live_out2 (HWVoiceOut *hw, int *nb_live);
+int audio_bug (const char *funcname, int cond);
+void *audio_calloc (const char *funcname, int nmemb, size_t size);
+
#define VOICE_ENABLE 1
#define VOICE_DISABLE 2