Revision c0fe3827 audio/audio_int.h

b/audio/audio_int.h
24 24
#ifndef QEMU_AUDIO_INT_H
25 25
#define QEMU_AUDIO_INT_H
26 26

  
27
#include "sys-queue.h"
28

  
29 27
#ifdef CONFIG_COREAUDIO
30 28
#define FLOAT_MIXENG
31 29
/* #define RECIPROCAL */
32 30
#endif
33 31
#include "mixeng.h"
34 32

  
35
int audio_bug (const char *funcname, int cond);
36

  
37 33
struct audio_pcm_ops;
38 34

  
39 35
typedef enum {
......
69 65
};
70 66

  
71 67
typedef struct HWVoiceOut {
72
    int active;
73 68
    int enabled;
74 69
    int pending_disable;
75 70
    int valid;
......
78 73
    f_sample *clip;
79 74

  
80 75
    int rpos;
81
    int bufsize;
82 76
    uint64_t ts_helper;
83 77

  
84 78
    st_sample_t *mix_buf;
......
91 85

  
92 86
typedef struct HWVoiceIn {
93 87
    int enabled;
94
    int active;
95 88
    struct audio_pcm_info info;
96 89

  
97 90
    t_sample *conv;
98 91

  
99 92
    int wpos;
100
    int bufsize;
101 93
    int total_samples_captured;
102 94
    uint64_t ts_helper;
103 95

  
......
109 101
    LIST_ENTRY (HWVoiceIn) entries;
110 102
} HWVoiceIn;
111 103

  
112
extern struct audio_driver no_audio_driver;
113
extern struct audio_driver oss_audio_driver;
114
extern struct audio_driver sdl_audio_driver;
115
extern struct audio_driver wav_audio_driver;
116
extern struct audio_driver fmod_audio_driver;
117
extern struct audio_driver alsa_audio_driver;
118
extern struct audio_driver coreaudio_audio_driver;
119
extern struct audio_driver dsound_audio_driver;
120
extern volume_t nominal_volume;
121

  
122
struct audio_driver {
123
    const char *name;
124
    const char *descr;
125
    struct audio_option *options;
126
    void *(*init) (void);
127
    void (*fini) (void *);
128
    struct audio_pcm_ops *pcm_ops;
129
    int can_be_default;
130
    int max_voices_out;
131
    int max_voices_in;
132
    int voice_size_out;
133
    int voice_size_in;
134
};
135

  
136
typedef struct AudioState {
137
    int fixed_settings_out;
138
    int fixed_freq_out;
139
    int fixed_channels_out;
140
    int fixed_fmt_out;
141
    int nb_hw_voices_out;
142
    int greedy_out;
143

  
144
    int fixed_settings_in;
145
    int fixed_freq_in;
146
    int fixed_channels_in;
147
    int fixed_fmt_in;
148
    int nb_hw_voices_in;
149
    int greedy_in;
150

  
151
    void *opaque;
152
    struct audio_driver *drv;
153

  
154
    QEMUTimer *ts;
155
    union {
156
        int usec;
157
        int64_t ticks;
158
    } period;
159

  
160
    int plive;
161
} AudioState;
162
extern AudioState audio_state;
163

  
164 104
struct SWVoiceOut {
165 105
    struct audio_pcm_info info;
166 106
    t_sample *conv;
......
192 132
    LIST_ENTRY (SWVoiceIn) entries;
193 133
};
194 134

  
135
struct audio_driver {
136
    const char *name;
137
    const char *descr;
138
    struct audio_option *options;
139
    void *(*init) (void);
140
    void (*fini) (void *);
141
    struct audio_pcm_ops *pcm_ops;
142
    int can_be_default;
143
    int max_voices_out;
144
    int max_voices_in;
145
    int voice_size_out;
146
    int voice_size_in;
147
};
148

  
195 149
struct audio_pcm_ops {
196
    int  (*init_out)(HWVoiceOut *hw, int freq, int nchannels, audfmt_e fmt);
150
    int  (*init_out)(HWVoiceOut *hw, audsettings_t *as);
197 151
    void (*fini_out)(HWVoiceOut *hw);
198 152
    int  (*run_out) (HWVoiceOut *hw);
199 153
    int  (*write)   (SWVoiceOut *sw, void *buf, int size);
200 154
    int  (*ctl_out) (HWVoiceOut *hw, int cmd, ...);
201 155

  
202
    int  (*init_in) (HWVoiceIn *hw, int freq, int nchannels, audfmt_e fmt);
156
    int  (*init_in) (HWVoiceIn *hw, audsettings_t *as);
203 157
    void (*fini_in) (HWVoiceIn *hw);
204 158
    int  (*run_in)  (HWVoiceIn *hw);
205 159
    int  (*read)    (SWVoiceIn *sw, void *buf, int size);
206 160
    int  (*ctl_in)  (HWVoiceIn *hw, int cmd, ...);
207 161
};
208 162

  
209
void audio_pcm_init_info (struct audio_pcm_info *info, int freq,
210
                          int nchannels, audfmt_e fmt, int swap_endian);
163
struct AudioState {
164
    struct audio_driver *drv;
165
    void *drv_opaque;
166

  
167
    QEMUTimer *ts;
168
    LIST_HEAD (card_head, QEMUSoundCard) card_head;
169
    LIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in;
170
    LIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out;
171
    int nb_hw_voices_out;
172
    int nb_hw_voices_in;
173
};
174

  
175
extern struct audio_driver no_audio_driver;
176
extern struct audio_driver oss_audio_driver;
177
extern struct audio_driver sdl_audio_driver;
178
extern struct audio_driver wav_audio_driver;
179
extern struct audio_driver fmod_audio_driver;
180
extern struct audio_driver alsa_audio_driver;
181
extern struct audio_driver coreaudio_audio_driver;
182
extern struct audio_driver dsound_audio_driver;
183
extern volume_t nominal_volume;
184

  
185
void audio_pcm_init_info (struct audio_pcm_info *info, audsettings_t *as,
186
                          int swap_endian);
211 187
void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len);
212 188

  
213 189
int  audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int len);
......
217 193
int  audio_pcm_hw_get_live_out (HWVoiceOut *hw);
218 194
int  audio_pcm_hw_get_live_out2 (HWVoiceOut *hw, int *nb_live);
219 195

  
196
int audio_bug (const char *funcname, int cond);
197
void *audio_calloc (const char *funcname, int nmemb, size_t size);
198

  
220 199
#define VOICE_ENABLE 1
221 200
#define VOICE_DISABLE 2
222 201

  

Also available in: Unified diff