aboutsummaryrefslogtreecommitdiff
path: root/audio/audio_int.h
diff options
context:
space:
mode:
authorKővágó, Zoltán <dirty.ice.hu@gmail.com>2019-08-19 01:06:46 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-08-21 09:13:37 +0200
commit526fb0581e1164ccf5e6d1a81b5da538594ae4d6 (patch)
tree9933245bf61b13f027e6d0766ab6040594a50670 /audio/audio_int.h
parente4634941457022b284664bacae9a3320481b1756 (diff)
audio: reduce glob_audio_state usage
Remove glob_audio_state from functions, where possible without breaking the API. This means that most static functions in audio.c now take an AudioState pointer instead of implicitly using glob_audio_state. Also included a pointer in SWVoice*, HWVoice* structs, so that functions dealing them can know the audio state without having to pass it around separately. This is required in order to support multiple simultaneous audio backends (added in a later commit). Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: b5e241f24e795267b145bcde7c6a72dd5e6037ea.1566168923.git.DirtY.iCE.hu@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio/audio_int.h')
-rw-r--r--audio/audio_int.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/audio/audio_int.h b/audio/audio_int.h
index 3f14842709..8164696b2c 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -49,9 +49,11 @@ struct audio_pcm_info {
int swap_endianness;
};
+typedef struct AudioState AudioState;
typedef struct SWVoiceCap SWVoiceCap;
typedef struct HWVoiceOut {
+ AudioState *s;
int enabled;
int poll_mode;
int pending_disable;
@@ -73,6 +75,7 @@ typedef struct HWVoiceOut {
} HWVoiceOut;
typedef struct HWVoiceIn {
+ AudioState *s;
int enabled;
int poll_mode;
struct audio_pcm_info info;
@@ -94,6 +97,7 @@ typedef struct HWVoiceIn {
struct SWVoiceOut {
QEMUSoundCard *card;
+ AudioState *s;
struct audio_pcm_info info;
t_sample *conv;
int64_t ratio;
@@ -111,6 +115,7 @@ struct SWVoiceOut {
struct SWVoiceIn {
QEMUSoundCard *card;
+ AudioState *s;
int active;
struct audio_pcm_info info;
int64_t ratio;
@@ -188,6 +193,9 @@ typedef struct AudioState {
int nb_hw_voices_in;
int vm_running;
int64_t period_ticks;
+
+ bool timer_running;
+ uint64_t timer_last;
} AudioState;
extern const struct mixeng_volume nominal_volume;