aboutsummaryrefslogtreecommitdiff
path: root/audio/audio.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.h
parentf04308e45274d0e74546870ea7b02aaef07b077e (diff)
downloadqemu-c0fe3827ea18f7d29550f2ff2495cec2fe7a3d94.zip
qemu-c0fe3827ea18f7d29550f2ff2495cec2fe7a3d94.tar.gz
qemu-c0fe3827ea18f7d29550f2ff2495cec2fe7a3d94.tar.bz2
audio merge (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1601 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'audio/audio.h')
-rw-r--r--audio/audio.h78
1 files changed, 46 insertions, 32 deletions
diff --git a/audio/audio.h b/audio/audio.h
index 6dd2fd2..682d0e0 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -24,18 +24,33 @@
#ifndef QEMU_AUDIO_H
#define QEMU_AUDIO_H
+#include "sys-queue.h"
+
typedef void (*audio_callback_fn_t) (void *opaque, int avail);
typedef enum {
- AUD_FMT_U8,
- AUD_FMT_S8,
- AUD_FMT_U16,
- AUD_FMT_S16
+ AUD_FMT_U8,
+ AUD_FMT_S8,
+ AUD_FMT_U16,
+ AUD_FMT_S16
} audfmt_e;
+typedef struct {
+ int freq;
+ int nchannels;
+ audfmt_e fmt;
+} audsettings_t;
+
+typedef struct AudioState AudioState;
typedef struct SWVoiceOut SWVoiceOut;
typedef struct SWVoiceIn SWVoiceIn;
+typedef struct QEMUSoundCard {
+ AudioState *audio;
+ char *name;
+ LIST_ENTRY (QEMUSoundCard) entries;
+} QEMUSoundCard;
+
typedef struct QEMUAudioTimeStamp {
uint64_t old_ts;
} QEMUAudioTimeStamp;
@@ -47,46 +62,45 @@ void AUD_log (const char *cap, const char *fmt, ...)
#endif
;
-void AUD_init (void);
+AudioState *AUD_init (void);
void AUD_help (void);
+void AUD_register_card (AudioState *s, const char *name, QEMUSoundCard *card);
+void AUD_remove_card (QEMUSoundCard *card);
-SWVoiceOut *AUD_open_out (
+SWVoiceOut *AUD_open_out (
+ QEMUSoundCard *card,
SWVoiceOut *sw,
const char *name,
void *callback_opaque,
audio_callback_fn_t callback_fn,
- int freq,
- int nchannels,
- audfmt_e fmt
+ audsettings_t *settings
);
-void AUD_close_out (SWVoiceOut *sw);
-int AUD_write (SWVoiceOut *sw, void *pcm_buf, int size);
-int AUD_get_buffer_size_out (SWVoiceOut *sw);
-void AUD_set_active_out (SWVoiceOut *sw, int on);
-int AUD_is_active_out (SWVoiceOut *sw);
-void AUD_init_time_stamp_out (SWVoiceOut *sw,
- QEMUAudioTimeStamp *ts);
-uint64_t AUD_time_stamp_get_elapsed_usec_out (SWVoiceOut *sw,
- QEMUAudioTimeStamp *ts);
-
-SWVoiceIn *AUD_open_in (
+
+void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw);
+int AUD_write (SWVoiceOut *sw, void *pcm_buf, int size);
+int AUD_get_buffer_size_out (SWVoiceOut *sw);
+void AUD_set_active_out (SWVoiceOut *sw, int on);
+int AUD_is_active_out (SWVoiceOut *sw);
+
+void AUD_init_time_stamp_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts);
+uint64_t AUD_get_elapsed_usec_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts);
+
+SWVoiceIn *AUD_open_in (
+ QEMUSoundCard *card,
SWVoiceIn *sw,
const char *name,
void *callback_opaque,
audio_callback_fn_t callback_fn,
- int freq,
- int nchannels,
- audfmt_e fmt
+ audsettings_t *settings
);
-void AUD_close_in (SWVoiceIn *sw);
-int AUD_read (SWVoiceIn *sw, void *pcm_buf, int size);
-void AUD_adjust_in (SWVoiceIn *sw, int leftover);
-void AUD_set_active_in (SWVoiceIn *sw, int on);
-int AUD_is_active_in (SWVoiceIn *sw);
-void AUD_init_time_stamp_in (SWVoiceIn *sw,
- QEMUAudioTimeStamp *ts);
-uint64_t AUD_time_stamp_get_elapsed_usec_in (SWVoiceIn *sw,
- QEMUAudioTimeStamp *ts);
+
+void AUD_close_in (QEMUSoundCard *card, SWVoiceIn *sw);
+int AUD_read (SWVoiceIn *sw, void *pcm_buf, int size);
+void AUD_set_active_in (SWVoiceIn *sw, int on);
+int AUD_is_active_in (SWVoiceIn *sw);
+
+void AUD_init_time_stamp_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts);
+uint64_t AUD_get_elapsed_usec_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts);
static inline void *advance (void *p, int incr)
{