aboutsummaryrefslogtreecommitdiff
path: root/audio/audio.h
diff options
context:
space:
mode:
Diffstat (limited to 'audio/audio.h')
-rw-r--r--audio/audio.h37
1 files changed, 15 insertions, 22 deletions
diff --git a/audio/audio.h b/audio/audio.h
index 64b0f761bc..c74abb8c47 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -27,6 +27,7 @@
#include "qemu/queue.h"
#include "qapi/qapi-types-audio.h"
+#include "hw/qdev-properties.h"
typedef void (*audio_callback_fn) (void *opaque, int avail);
@@ -78,8 +79,10 @@ typedef struct SWVoiceOut SWVoiceOut;
typedef struct CaptureVoiceOut CaptureVoiceOut;
typedef struct SWVoiceIn SWVoiceIn;
+typedef struct AudioState AudioState;
typedef struct QEMUSoundCard {
char *name;
+ AudioState *state;
QLIST_ENTRY (QEMUSoundCard) entries;
} QEMUSoundCard;
@@ -92,7 +95,8 @@ void AUD_log (const char *cap, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
void AUD_register_card (const char *name, QEMUSoundCard *card);
void AUD_remove_card (QEMUSoundCard *card);
-CaptureVoiceOut *AUD_add_capture (
+CaptureVoiceOut *AUD_add_capture(
+ AudioState *s,
struct audsettings *as,
struct audio_capture_ops *ops,
void *opaque
@@ -109,7 +113,7 @@ SWVoiceOut *AUD_open_out (
);
void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw);
-int AUD_write (SWVoiceOut *sw, void *pcm_buf, int size);
+size_t AUD_write (SWVoiceOut *sw, void *pcm_buf, size_t 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);
@@ -130,7 +134,7 @@ SWVoiceIn *AUD_open_in (
);
void AUD_close_in (QEMUSoundCard *card, SWVoiceIn *sw);
-int AUD_read (SWVoiceIn *sw, void *pcm_buf, int size);
+size_t AUD_read (SWVoiceIn *sw, void *pcm_buf, size_t size);
void AUD_set_active_in (SWVoiceIn *sw, int on);
int AUD_is_active_in (SWVoiceIn *sw);
@@ -143,25 +147,8 @@ static inline void *advance (void *p, int incr)
return (d + incr);
}
-#ifdef __GNUC__
-#define audio_MIN(a, b) ( __extension__ ({ \
- __typeof (a) ta = a; \
- __typeof (b) tb = b; \
- ((ta)>(tb)?(tb):(ta)); \
-}))
-
-#define audio_MAX(a, b) ( __extension__ ({ \
- __typeof (a) ta = a; \
- __typeof (b) tb = b; \
- ((ta)<(tb)?(tb):(ta)); \
-}))
-#else
-#define audio_MIN(a, b) ((a)>(b)?(b):(a))
-#define audio_MAX(a, b) ((a)<(b)?(b):(a))
-#endif
-
-int wav_start_capture (CaptureState *s, const char *path, int freq,
- int bits, int nchannels);
+int wav_start_capture(AudioState *state, CaptureState *s, const char *path,
+ int freq, int bits, int nchannels);
bool audio_is_cleaning_up(void);
void audio_cleanup(void);
@@ -175,4 +162,10 @@ void audio_parse_option(const char *opt);
void audio_init_audiodevs(void);
void audio_legacy_help(void);
+AudioState *audio_state_by_name(const char *name);
+const char *audio_get_id(QEMUSoundCard *card);
+
+#define DEFINE_AUDIO_PROPERTIES(_s, _f) \
+ DEFINE_PROP_AUDIODEV("audiodev", _s, _f)
+
#endif /* QEMU_AUDIO_H */