Commit 1ea879e5580f63414693655fcf0328559cdce138

Authored by malc
1 parent 8b0de438

Make audio violate POSIX less

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5864 c046a42c-6fe2-441c-8c8c-71466251a162
audio/alsaaudio.c
... ... @@ -527,7 +527,7 @@ static int alsa_run_out (HWVoiceOut *hw)
527 527 int rpos, live, decr;
528 528 int samples;
529 529 uint8_t *dst;
530   - st_sample_t *src;
  530 + struct st_sample *src;
531 531 snd_pcm_sframes_t avail;
532 532  
533 533 live = audio_pcm_hw_get_live_out (hw);
... ... @@ -612,13 +612,13 @@ static void alsa_fini_out (HWVoiceOut *hw)
612 612 }
613 613 }
614 614  
615   -static int alsa_init_out (HWVoiceOut *hw, audsettings_t *as)
  615 +static int alsa_init_out (HWVoiceOut *hw, struct audsettings *as)
616 616 {
617 617 ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw;
618 618 struct alsa_params_req req;
619 619 struct alsa_params_obt obt;
620 620 snd_pcm_t *handle;
621   - audsettings_t obt_as;
  621 + struct audsettings obt_as;
622 622  
623 623 req.fmt = aud_to_alsafmt (as->fmt);
624 624 req.freq = as->freq;
... ... @@ -692,13 +692,13 @@ static int alsa_ctl_out (HWVoiceOut *hw, int cmd, ...)
692 692 return -1;
693 693 }
694 694  
695   -static int alsa_init_in (HWVoiceIn *hw, audsettings_t *as)
  695 +static int alsa_init_in (HWVoiceIn *hw, struct audsettings *as)
696 696 {
697 697 ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;
698 698 struct alsa_params_req req;
699 699 struct alsa_params_obt obt;
700 700 snd_pcm_t *handle;
701   - audsettings_t obt_as;
  701 + struct audsettings obt_as;
702 702  
703 703 req.fmt = aud_to_alsafmt (as->fmt);
704 704 req.freq = as->freq;
... ... @@ -792,7 +792,7 @@ static int alsa_run_in (HWVoiceIn *hw)
792 792  
793 793 for (i = 0; i < 2; ++i) {
794 794 void *src;
795   - st_sample_t *dst;
  795 + struct st_sample *dst;
796 796 snd_pcm_sframes_t nread;
797 797 snd_pcm_uframes_t len;
798 798  
... ...
audio/audio.c
... ... @@ -47,7 +47,7 @@ struct fixed_settings {
47 47 int enabled;
48 48 int nb_voices;
49 49 int greedy;
50   - audsettings_t settings;
  50 + struct audsettings settings;
51 51 };
52 52  
53 53 static struct {
... ... @@ -91,7 +91,7 @@ static struct {
91 91  
92 92 static AudioState glob_audio_state;
93 93  
94   -volume_t nominal_volume = {
  94 +struct mixeng_volume nominal_volume = {
95 95 0,
96 96 #ifdef FLOAT_MIXENG
97 97 1.0,
... ... @@ -513,7 +513,7 @@ static void audio_process_options (const char *prefix,
513 513 }
514 514 }
515 515  
516   -static void audio_print_settings (audsettings_t *as)
  516 +static void audio_print_settings (struct audsettings *as)
517 517 {
518 518 dolog ("frequency=%d nchannels=%d fmt=", as->freq, as->nchannels);
519 519  
... ... @@ -556,7 +556,7 @@ static void audio_print_settings (audsettings_t *as)
556 556 AUD_log (NULL, "\n");
557 557 }
558 558  
559   -static int audio_validate_settings (audsettings_t *as)
  559 +static int audio_validate_settings (struct audsettings *as)
560 560 {
561 561 int invalid;
562 562  
... ... @@ -580,7 +580,7 @@ static int audio_validate_settings (audsettings_t *as)
580 580 return invalid ? -1 : 0;
581 581 }
582 582  
583   -static int audio_pcm_info_eq (struct audio_pcm_info *info, audsettings_t *as)
  583 +static int audio_pcm_info_eq (struct audio_pcm_info *info, struct audsettings *as)
584 584 {
585 585 int bits = 8, sign = 0;
586 586  
... ... @@ -609,7 +609,7 @@ static int audio_pcm_info_eq (struct audio_pcm_info *info, audsettings_t *as)
609 609 && info->swap_endianness == (as->endianness != AUDIO_HOST_ENDIANNESS);
610 610 }
611 611  
612   -void audio_pcm_init_info (struct audio_pcm_info *info, audsettings_t *as)
  612 +void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
613 613 {
614 614 int bits = 8, sign = 0, shift = 0;
615 615  
... ... @@ -704,8 +704,8 @@ void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len)
704 704 /*
705 705 * Capture
706 706 */
707   -static void noop_conv (st_sample_t *dst, const void *src,
708   - int samples, volume_t *vol)
  707 +static void noop_conv (struct st_sample *dst, const void *src,
  708 + int samples, struct mixeng_volume *vol)
709 709 {
710 710 (void) src;
711 711 (void) dst;
... ... @@ -715,7 +715,7 @@ static void noop_conv (st_sample_t *dst, const void *src,
715 715  
716 716 static CaptureVoiceOut *audio_pcm_capture_find_specific (
717 717 AudioState *s,
718   - audsettings_t *as
  718 + struct audsettings *as
719 719 )
720 720 {
721 721 CaptureVoiceOut *cap;
... ... @@ -891,7 +891,7 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size)
891 891 {
892 892 HWVoiceIn *hw = sw->hw;
893 893 int samples, live, ret = 0, swlim, isamp, osamp, rpos, total = 0;
894   - st_sample_t *src, *dst = sw->buf;
  894 + struct st_sample *src, *dst = sw->buf;
895 895  
896 896 rpos = audio_pcm_sw_get_rpos_in (sw) % hw->samples;
897 897  
... ... @@ -1442,7 +1442,7 @@ static void audio_run_capture (AudioState *s)
1442 1442 while (live) {
1443 1443 int left = hw->samples - rpos;
1444 1444 int to_capture = audio_MIN (live, left);
1445   - st_sample_t *src;
  1445 + struct st_sample *src;
1446 1446 struct capture_callback *cb;
1447 1447  
1448 1448 src = hw->mix_buf + rpos;
... ... @@ -1812,7 +1812,7 @@ AudioState *AUD_init (void)
1812 1812  
1813 1813 CaptureVoiceOut *AUD_add_capture (
1814 1814 AudioState *s,
1815   - audsettings_t *as,
  1815 + struct audsettings *as,
1816 1816 struct audio_capture_ops *ops,
1817 1817 void *cb_opaque
1818 1818 )
... ... @@ -1863,7 +1863,7 @@ CaptureVoiceOut *AUD_add_capture (
1863 1863 /* XXX find a more elegant way */
1864 1864 hw->samples = 4096 * 4;
1865 1865 hw->mix_buf = audio_calloc (AUDIO_FUNC, hw->samples,
1866   - sizeof (st_sample_t));
  1866 + sizeof (struct st_sample));
1867 1867 if (!hw->mix_buf) {
1868 1868 dolog ("Could not allocate capture mix buffer (%d samples)\n",
1869 1869 hw->samples);
... ...
audio/audio.h
... ... @@ -44,12 +44,12 @@ typedef enum {
44 44 #define AUDIO_HOST_ENDIANNESS 0
45 45 #endif
46 46  
47   -typedef struct {
  47 +struct audsettings {
48 48 int freq;
49 49 int nchannels;
50 50 audfmt_e fmt;
51 51 int endianness;
52   -} audsettings_t;
  52 +};
53 53  
54 54 typedef enum {
55 55 AUD_CNOTIFY_ENABLE,
... ... @@ -100,7 +100,7 @@ void AUD_register_card (AudioState *s, const char *name, QEMUSoundCard *card);
100 100 void AUD_remove_card (QEMUSoundCard *card);
101 101 CaptureVoiceOut *AUD_add_capture (
102 102 AudioState *s,
103   - audsettings_t *as,
  103 + struct audsettings *as,
104 104 struct audio_capture_ops *ops,
105 105 void *opaque
106 106 );
... ... @@ -112,7 +112,7 @@ SWVoiceOut *AUD_open_out (
112 112 const char *name,
113 113 void *callback_opaque,
114 114 audio_callback_fn_t callback_fn,
115   - audsettings_t *settings
  115 + struct audsettings *settings
116 116 );
117 117  
118 118 void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw);
... ... @@ -133,7 +133,7 @@ SWVoiceIn *AUD_open_in (
133 133 const char *name,
134 134 void *callback_opaque,
135 135 audio_callback_fn_t callback_fn,
136   - audsettings_t *settings
  136 + struct audsettings *settings
137 137 );
138 138  
139 139 void AUD_close_in (QEMUSoundCard *card, SWVoiceIn *sw);
... ...
audio/audio_int.h
... ... @@ -76,7 +76,7 @@ typedef struct HWVoiceOut {
76 76 int rpos;
77 77 uint64_t ts_helper;
78 78  
79   - st_sample_t *mix_buf;
  79 + struct st_sample *mix_buf;
80 80  
81 81 int samples;
82 82 LIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head;
... ... @@ -95,7 +95,7 @@ typedef struct HWVoiceIn {
95 95 int total_samples_captured;
96 96 uint64_t ts_helper;
97 97  
98   - st_sample_t *conv_buf;
  98 + struct st_sample *conv_buf;
99 99  
100 100 int samples;
101 101 LIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head;
... ... @@ -107,14 +107,14 @@ struct SWVoiceOut {
107 107 struct audio_pcm_info info;
108 108 t_sample *conv;
109 109 int64_t ratio;
110   - st_sample_t *buf;
  110 + struct st_sample *buf;
111 111 void *rate;
112 112 int total_hw_samples_mixed;
113 113 int active;
114 114 int empty;
115 115 HWVoiceOut *hw;
116 116 char *name;
117   - volume_t vol;
  117 + struct mixeng_volume vol;
118 118 struct audio_callback callback;
119 119 LIST_ENTRY (SWVoiceOut) entries;
120 120 };
... ... @@ -125,11 +125,11 @@ struct SWVoiceIn {
125 125 int64_t ratio;
126 126 void *rate;
127 127 int total_hw_samples_acquired;
128   - st_sample_t *buf;
  128 + struct st_sample *buf;
129 129 f_sample *clip;
130 130 HWVoiceIn *hw;
131 131 char *name;
132   - volume_t vol;
  132 + struct mixeng_volume vol;
133 133 struct audio_callback callback;
134 134 LIST_ENTRY (SWVoiceIn) entries;
135 135 };
... ... @@ -149,13 +149,13 @@ struct audio_driver {
149 149 };
150 150  
151 151 struct audio_pcm_ops {
152   - int (*init_out)(HWVoiceOut *hw, audsettings_t *as);
  152 + int (*init_out)(HWVoiceOut *hw, struct audsettings *as);
153 153 void (*fini_out)(HWVoiceOut *hw);
154 154 int (*run_out) (HWVoiceOut *hw);
155 155 int (*write) (SWVoiceOut *sw, void *buf, int size);
156 156 int (*ctl_out) (HWVoiceOut *hw, int cmd, ...);
157 157  
158   - int (*init_in) (HWVoiceIn *hw, audsettings_t *as);
  158 + int (*init_in) (HWVoiceIn *hw, struct audsettings *as);
159 159 void (*fini_in) (HWVoiceIn *hw);
160 160 int (*run_in) (HWVoiceIn *hw);
161 161 int (*read) (SWVoiceIn *sw, void *buf, int size);
... ... @@ -204,9 +204,9 @@ extern struct audio_driver coreaudio_audio_driver;
204 204 extern struct audio_driver dsound_audio_driver;
205 205 extern struct audio_driver esd_audio_driver;
206 206 extern struct audio_driver pa_audio_driver;
207   -extern volume_t nominal_volume;
  207 +extern struct mixeng_volume nominal_volume;
208 208  
209   -void audio_pcm_init_info (struct audio_pcm_info *info, audsettings_t *as);
  209 +void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as);
210 210 void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len);
211 211  
212 212 int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int len);
... ...
audio/audio_template.h
... ... @@ -82,7 +82,7 @@ static void glue (audio_pcm_hw_free_resources_, TYPE) (HW *hw)
82 82  
83 83 static int glue (audio_pcm_hw_alloc_resources_, TYPE) (HW *hw)
84 84 {
85   - HWBUF = audio_calloc (AUDIO_FUNC, hw->samples, sizeof (st_sample_t));
  85 + HWBUF = audio_calloc (AUDIO_FUNC, hw->samples, sizeof (struct st_sample));
86 86 if (!HWBUF) {
87 87 dolog ("Could not allocate " NAME " buffer (%d samples)\n",
88 88 hw->samples);
... ... @@ -116,7 +116,7 @@ static int glue (audio_pcm_sw_alloc_resources_, TYPE) (SW *sw)
116 116 samples = ((int64_t) sw->hw->samples << 32) / sw->ratio;
117 117 #endif
118 118  
119   - sw->buf = audio_calloc (AUDIO_FUNC, samples, sizeof (st_sample_t));
  119 + sw->buf = audio_calloc (AUDIO_FUNC, samples, sizeof (struct st_sample));
120 120 if (!sw->buf) {
121 121 dolog ("Could not allocate buffer for `%s' (%d samples)\n",
122 122 SW_NAME (sw), samples);
... ... @@ -140,7 +140,7 @@ static int glue (audio_pcm_sw_init_, TYPE) (
140 140 SW *sw,
141 141 HW *hw,
142 142 const char *name,
143   - audsettings_t *as
  143 + struct audsettings *as
144 144 )
145 145 {
146 146 int err;
... ... @@ -229,7 +229,7 @@ static HW *glue (audio_pcm_hw_find_any_enabled_, TYPE) (AudioState *s, HW *hw)
229 229 static HW *glue (audio_pcm_hw_find_specific_, TYPE) (
230 230 AudioState *s,
231 231 HW *hw,
232   - audsettings_t *as
  232 + struct audsettings *as
233 233 )
234 234 {
235 235 while ((hw = glue (audio_pcm_hw_find_any_, TYPE) (s, hw))) {
... ... @@ -240,7 +240,8 @@ static HW *glue (audio_pcm_hw_find_specific_, TYPE) (
240 240 return NULL;
241 241 }
242 242  
243   -static HW *glue (audio_pcm_hw_add_new_, TYPE) (AudioState *s, audsettings_t *as)
  243 +static HW *glue (audio_pcm_hw_add_new_, TYPE) (AudioState *s,
  244 + struct audsettings *as)
244 245 {
245 246 HW *hw;
246 247 struct audio_driver *drv = s->drv;
... ... @@ -308,7 +309,8 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (AudioState *s, audsettings_t *as)
308 309 return NULL;
309 310 }
310 311  
311   -static HW *glue (audio_pcm_hw_add_, TYPE) (AudioState *s, audsettings_t *as)
  312 +static HW *glue (audio_pcm_hw_add_, TYPE) (AudioState *s,
  313 + struct audsettings *as)
312 314 {
313 315 HW *hw;
314 316  
... ... @@ -335,12 +337,12 @@ static HW *glue (audio_pcm_hw_add_, TYPE) (AudioState *s, audsettings_t *as)
335 337 static SW *glue (audio_pcm_create_voice_pair_, TYPE) (
336 338 AudioState *s,
337 339 const char *sw_name,
338   - audsettings_t *as
  340 + struct audsettings *as
339 341 )
340 342 {
341 343 SW *sw;
342 344 HW *hw;
343   - audsettings_t hw_as;
  345 + struct audsettings hw_as;
344 346  
345 347 if (glue (conf.fixed_, TYPE).enabled) {
346 348 hw_as = glue (conf.fixed_, TYPE).settings;
... ... @@ -405,7 +407,7 @@ SW *glue (AUD_open_, TYPE) (
405 407 const char *name,
406 408 void *callback_opaque ,
407 409 audio_callback_fn_t callback_fn,
408   - audsettings_t *as
  410 + struct audsettings *as
409 411 )
410 412 {
411 413 AudioState *s;
... ...
audio/coreaudio.c
... ... @@ -233,7 +233,7 @@ static OSStatus audioDeviceIOProc(
233 233 HWVoiceOut *hw = hwptr;
234 234 coreaudioVoiceOut *core = (coreaudioVoiceOut *) hwptr;
235 235 int rpos, live;
236   - st_sample_t *src;
  236 + struct st_sample *src;
237 237 #ifndef FLOAT_MIXENG
238 238 #ifdef RECIPROCAL
239 239 const float scale = 1.f / UINT_MAX;
... ... @@ -289,7 +289,7 @@ static int coreaudio_write (SWVoiceOut *sw, void *buf, int len)
289 289 return audio_pcm_sw_write (sw, buf, len);
290 290 }
291 291  
292   -static int coreaudio_init_out (HWVoiceOut *hw, audsettings_t *as)
  292 +static int coreaudio_init_out (HWVoiceOut *hw, struct audsettings *as)
293 293 {
294 294 OSStatus status;
295 295 coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw;
... ...
audio/dsound_template.h
... ... @@ -174,16 +174,16 @@ static void dsound_fini_out (HWVoiceOut *hw)
174 174 }
175 175  
176 176 #ifdef DSBTYPE_IN
177   -static int dsound_init_in (HWVoiceIn *hw, audsettings_t *as)
  177 +static int dsound_init_in (HWVoiceIn *hw, struct audsettings *as)
178 178 #else
179   -static int dsound_init_out (HWVoiceOut *hw, audsettings_t *as)
  179 +static int dsound_init_out (HWVoiceOut *hw, struct audsettings *as)
180 180 #endif
181 181 {
182 182 int err;
183 183 HRESULT hr;
184 184 dsound *s = &glob_dsound;
185 185 WAVEFORMATEX wfx;
186   - audsettings_t obt_as;
  186 + struct audsettings obt_as;
187 187 #ifdef DSBTYPE_IN
188 188 const char *typ = "ADC";
189 189 DSoundVoiceIn *ds = (DSoundVoiceIn *) hw;
... ...
audio/dsoundaudio.c
... ... @@ -47,7 +47,7 @@ static struct {
47 47 int set_primary;
48 48 int bufsize_in;
49 49 int bufsize_out;
50   - audsettings_t settings;
  50 + struct audsettings settings;
51 51 int latency_millis;
52 52 } conf = {
53 53 1,
... ... @@ -68,7 +68,7 @@ typedef struct {
68 68 LPDIRECTSOUND dsound;
69 69 LPDIRECTSOUNDCAPTURE dsound_capture;
70 70 LPDIRECTSOUNDBUFFER dsound_primary_buffer;
71   - audsettings_t settings;
  71 + struct audsettings settings;
72 72 } dsound;
73 73  
74 74 static dsound glob_dsound;
... ... @@ -307,7 +307,8 @@ static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb)
307 307 return -1;
308 308 }
309 309  
310   -static int waveformat_from_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as)
  310 +static int waveformat_from_audio_settings (WAVEFORMATEX *wfx,
  311 + struct audsettings *as)
311 312 {
312 313 memset (wfx, 0, sizeof (*wfx));
313 314  
... ... @@ -346,7 +347,8 @@ static int waveformat_from_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as)
346 347 return 0;
347 348 }
348 349  
349   -static int waveformat_to_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as)
  350 +static int waveformat_to_audio_settings (WAVEFORMATEX *wfx,
  351 + struct audsettings *as)
350 352 {
351 353 if (wfx->wFormatTag != WAVE_FORMAT_PCM) {
352 354 dolog ("Invalid wave format, tag is not PCM, but %d\n",
... ... @@ -448,8 +450,8 @@ static void dsound_write_sample (HWVoiceOut *hw, uint8_t *dst, int dst_len)
448 450 int src_len1 = dst_len;
449 451 int src_len2 = 0;
450 452 int pos = hw->rpos + dst_len;
451   - st_sample_t *src1 = hw->mix_buf + hw->rpos;
452   - st_sample_t *src2 = NULL;
  453 + struct st_sample *src1 = hw->mix_buf + hw->rpos;
  454 + struct st_sample *src2 = NULL;
453 455  
454 456 if (pos > hw->samples) {
455 457 src_len1 = hw->samples - hw->rpos;
... ...
audio/esdaudio.c
... ... @@ -115,7 +115,7 @@ static void *qesd_thread_out (void *arg)
115 115 while (to_mix) {
116 116 ssize_t written;
117 117 int chunk = audio_MIN (to_mix, hw->samples - rpos);
118   - st_sample_t *src = hw->mix_buf + rpos;
  118 + struct st_sample *src = hw->mix_buf + rpos;
119 119  
120 120 hw->clip (esd->pcm_buf, src, chunk);
121 121  
... ... @@ -188,10 +188,10 @@ static int qesd_write (SWVoiceOut *sw, void *buf, int len)
188 188 return audio_pcm_sw_write (sw, buf, len);
189 189 }
190 190  
191   -static int qesd_init_out (HWVoiceOut *hw, audsettings_t *as)
  191 +static int qesd_init_out (HWVoiceOut *hw, struct audsettings *as)
192 192 {
193 193 ESDVoiceOut *esd = (ESDVoiceOut *) hw;
194   - audsettings_t obt_as = *as;
  194 + struct audsettings obt_as = *as;
195 195 int esdfmt = ESD_STREAM | ESD_PLAY;
196 196 int err;
197 197 sigset_t set, old_set;
... ... @@ -421,10 +421,10 @@ static int qesd_read (SWVoiceIn *sw, void *buf, int len)
421 421 return audio_pcm_sw_read (sw, buf, len);
422 422 }
423 423  
424   -static int qesd_init_in (HWVoiceIn *hw, audsettings_t *as)
  424 +static int qesd_init_in (HWVoiceIn *hw, struct audsettings *as)
425 425 {
426 426 ESDVoiceIn *esd = (ESDVoiceIn *) hw;
427   - audsettings_t obt_as = *as;
  427 + struct audsettings obt_as = *as;
428 428 int esdfmt = ESD_STREAM | ESD_RECORD;
429 429 int err;
430 430 sigset_t set, old_set;
... ...
audio/fmodaudio.c
... ... @@ -142,8 +142,8 @@ static void fmod_write_sample (HWVoiceOut *hw, uint8_t *dst, int dst_len)
142 142 int src_len1 = dst_len;
143 143 int src_len2 = 0;
144 144 int pos = hw->rpos + dst_len;
145   - st_sample_t *src1 = hw->mix_buf + hw->rpos;
146   - st_sample_t *src2 = NULL;
  145 + struct st_sample *src1 = hw->mix_buf + hw->rpos;
  146 + struct st_sample *src2 = NULL;
147 147  
148 148 if (pos > hw->samples) {
149 149 src_len1 = hw->samples - hw->rpos;
... ... @@ -355,11 +355,11 @@ static void fmod_fini_out (HWVoiceOut *hw)
355 355 }
356 356 }
357 357  
358   -static int fmod_init_out (HWVoiceOut *hw, audsettings_t *as)
  358 +static int fmod_init_out (HWVoiceOut *hw, struct audsettings *as)
359 359 {
360 360 int bits16, mode, channel;
361 361 FMODVoiceOut *fmd = (FMODVoiceOut *) hw;
362   - audsettings_t obt_as = *as;
  362 + struct audsettings obt_as = *as;
363 363  
364 364 mode = aud_to_fmodfmt (as->fmt, as->nchannels == 2 ? 1 : 0);
365 365 fmd->fmod_sample = FSOUND_Sample_Alloc (
... ... @@ -417,11 +417,11 @@ static int fmod_ctl_out (HWVoiceOut *hw, int cmd, ...)
417 417 return 0;
418 418 }
419 419  
420   -static int fmod_init_in (HWVoiceIn *hw, audsettings_t *as)
  420 +static int fmod_init_in (HWVoiceIn *hw, struct audsettings *as)
421 421 {
422 422 int bits16, mode;
423 423 FMODVoiceIn *fmd = (FMODVoiceIn *) hw;
424   - audsettings_t obt_as = *as;
  424 + struct audsettings obt_as = *as;
425 425  
426 426 if (conf.broken_adc) {
427 427 return -1;
... ...
audio/mixeng.c
... ... @@ -290,7 +290,7 @@ struct rate {
290 290 uint64_t opos;
291 291 uint64_t opos_inc;
292 292 uint32_t ipos; /* position in the input stream (integer) */
293   - st_sample_t ilast; /* last sample in the input stream */
  293 + struct st_sample ilast; /* last sample in the input stream */
294 294 };
295 295  
296 296 /*
... ... @@ -329,7 +329,7 @@ void st_rate_stop (void *opaque)
329 329 qemu_free (opaque);
330 330 }
331 331  
332   -void mixeng_clear (st_sample_t *buf, int len)
  332 +void mixeng_clear (struct st_sample *buf, int len)
333 333 {
334   - memset (buf, 0, len * sizeof (st_sample_t));
  334 + memset (buf, 0, len * sizeof (struct st_sample));
335 335 }
... ...
audio/mixeng.h
... ... @@ -25,27 +25,27 @@
25 25 #define QEMU_MIXENG_H
26 26  
27 27 #ifdef FLOAT_MIXENG
28   -typedef float real_t;
29   -typedef struct { int mute; real_t r; real_t l; } volume_t;
30   -typedef struct { real_t l; real_t r; } st_sample_t;
  28 +typedef float mixeng_real;
  29 +struct mixeng_volume { int mute; mixeng_real r; mixeng_real l; };
  30 +struct mixeng_sample { mixeng_real l; mixeng_real r; };
31 31 #else
32   -typedef struct { int mute; int64_t r; int64_t l; } volume_t;
33   -typedef struct { int64_t l; int64_t r; } st_sample_t;
  32 +struct mixeng_volume { int mute; int64_t r; int64_t l; };
  33 +struct st_sample { int64_t l; int64_t r; };
34 34 #endif
35 35  
36   -typedef void (t_sample) (st_sample_t *dst, const void *src,
37   - int samples, volume_t *vol);
38   -typedef void (f_sample) (void *dst, const st_sample_t *src, int samples);
  36 +typedef void (t_sample) (struct st_sample *dst, const void *src,
  37 + int samples, struct mixeng_volume *vol);
  38 +typedef void (f_sample) (void *dst, const struct st_sample *src, int samples);
39 39  
40 40 extern t_sample *mixeng_conv[2][2][2][3];
41 41 extern f_sample *mixeng_clip[2][2][2][3];
42 42  
43 43 void *st_rate_start (int inrate, int outrate);
44   -void st_rate_flow (void *opaque, st_sample_t *ibuf, st_sample_t *obuf,
  44 +void st_rate_flow (void *opaque, struct st_sample *ibuf, struct st_sample *obuf,
45 45 int *isamp, int *osamp);
46   -void st_rate_flow_mix (void *opaque, st_sample_t *ibuf, st_sample_t *obuf,
  46 +void st_rate_flow_mix (void *opaque, struct st_sample *ibuf, struct st_sample *obuf,
47 47 int *isamp, int *osamp);
48 48 void st_rate_stop (void *opaque);
49   -void mixeng_clear (st_sample_t *buf, int len);
  49 +void mixeng_clear (struct st_sample *buf, int len);
50 50  
51 51 #endif /* mixeng.h */
... ...
audio/mixeng_template.h
... ... @@ -44,26 +44,26 @@
44 44 #define ET glue (ENDIAN_CONVERSION, glue (_, IN_T))
45 45  
46 46 #ifdef FLOAT_MIXENG
47   -static real_t inline glue (conv_, ET) (IN_T v)
  47 +static mixeng_real inline glue (conv_, ET) (IN_T v)
48 48 {
49 49 IN_T nv = ENDIAN_CONVERT (v);
50 50  
51 51 #ifdef RECIPROCAL
52 52 #ifdef SIGNED
53   - return nv * (1.f / (real_t) (IN_MAX - IN_MIN));
  53 + return nv * (1.f / (mixeng_real) (IN_MAX - IN_MIN));
54 54 #else
55   - return (nv - HALF) * (1.f / (real_t) IN_MAX);
  55 + return (nv - HALF) * (1.f / (mixeng_real) IN_MAX);
56 56 #endif
57 57 #else /* !RECIPROCAL */
58 58 #ifdef SIGNED
59   - return nv / (real_t) (IN_MAX - IN_MIN);
  59 + return nv / (mixeng_real) (IN_MAX - IN_MIN);
60 60 #else
61   - return (nv - HALF) / (real_t) IN_MAX;
  61 + return (nv - HALF) / (mixeng_real) IN_MAX;
62 62 #endif
63 63 #endif
64 64 }
65 65  
66   -static IN_T inline glue (clip_, ET) (real_t v)
  66 +static IN_T inline glue (clip_, ET) (mixeng_real v)
67 67 {
68 68 if (v >= 0.5) {
69 69 return IN_MAX;
... ... @@ -109,9 +109,9 @@ static inline IN_T glue (clip_, ET) (int64_t v)
109 109 #endif
110 110  
111 111 static void glue (glue (conv_, ET), _to_stereo)
112   - (st_sample_t *dst, const void *src, int samples, volume_t *vol)
  112 + (struct st_sample *dst, const void *src, int samples, struct mixeng_volume *vol)
113 113 {
114   - st_sample_t *out = dst;
  114 + struct st_sample *out = dst;
115 115 IN_T *in = (IN_T *) src;
116 116 #ifdef CONFIG_MIXEMU
117 117 if (vol->mute) {
... ... @@ -129,9 +129,9 @@ static void glue (glue (conv_, ET), _to_stereo)
129 129 }
130 130  
131 131 static void glue (glue (conv_, ET), _to_mono)
132   - (st_sample_t *dst, const void *src, int samples, volume_t *vol)
  132 + (struct st_sample *dst, const void *src, int samples, struct mixeng_volume *vol)
133 133 {
134   - st_sample_t *out = dst;
  134 + struct st_sample *out = dst;
135 135 IN_T *in = (IN_T *) src;
136 136 #ifdef CONFIG_MIXEMU
137 137 if (vol->mute) {
... ... @@ -150,9 +150,9 @@ static void glue (glue (conv_, ET), _to_mono)
150 150 }
151 151  
152 152 static void glue (glue (clip_, ET), _from_stereo)
153   - (void *dst, const st_sample_t *src, int samples)
  153 + (void *dst, const struct st_sample *src, int samples)
154 154 {
155   - const st_sample_t *in = src;
  155 + const struct st_sample *in = src;
156 156 IN_T *out = (IN_T *) dst;
157 157 while (samples--) {
158 158 *out++ = glue (clip_, ET) (in->l);
... ... @@ -162,9 +162,9 @@ static void glue (glue (clip_, ET), _from_stereo)
162 162 }
163 163  
164 164 static void glue (glue (clip_, ET), _from_mono)
165   - (void *dst, const st_sample_t *src, int samples)
  165 + (void *dst, const struct st_sample *src, int samples)
166 166 {
167   - const st_sample_t *in = src;
  167 + const struct st_sample *in = src;
168 168 IN_T *out = (IN_T *) dst;
169 169 while (samples--) {
170 170 *out++ = glue (clip_, ET) (in->l + in->r);
... ...
audio/noaudio.c
... ... @@ -68,7 +68,7 @@ static int no_write (SWVoiceOut *sw, void *buf, int len)
68 68 return audio_pcm_sw_write (sw, buf, len);
69 69 }
70 70  
71   -static int no_init_out (HWVoiceOut *hw, audsettings_t *as)
  71 +static int no_init_out (HWVoiceOut *hw, struct audsettings *as)
72 72 {
73 73 audio_pcm_init_info (&hw->info, as);
74 74 hw->samples = 1024;
... ... @@ -87,7 +87,7 @@ static int no_ctl_out (HWVoiceOut *hw, int cmd, ...)
87 87 return 0;
88 88 }
89 89  
90   -static int no_init_in (HWVoiceIn *hw, audsettings_t *as)
  90 +static int no_init_in (HWVoiceIn *hw, struct audsettings *as)
91 91 {
92 92 audio_pcm_init_info (&hw->info, as);
93 93 hw->samples = 1024;
... ...
audio/ossaudio.c
... ... @@ -294,7 +294,7 @@ static int oss_run_out (HWVoiceOut *hw)
294 294 int err, rpos, live, decr;
295 295 int samples;
296 296 uint8_t *dst;
297   - st_sample_t *src;
  297 + struct st_sample *src;
298 298 struct audio_buf_info abinfo;
299 299 struct count_info cntinfo;
300 300 int bufsize;
... ... @@ -434,7 +434,7 @@ static void oss_fini_out (HWVoiceOut *hw)
434 434 }
435 435 }
436 436  
437   -static int oss_init_out (HWVoiceOut *hw, audsettings_t *as)
  437 +static int oss_init_out (HWVoiceOut *hw, struct audsettings *as)
438 438 {
439 439 OSSVoiceOut *oss = (OSSVoiceOut *) hw;
440 440 struct oss_params req, obt;
... ... @@ -442,7 +442,7 @@ static int oss_init_out (HWVoiceOut *hw, audsettings_t *as)
442 442 int err;
443 443 int fd;
444 444 audfmt_e effective_fmt;
445   - audsettings_t obt_as;
  445 + struct audsettings obt_as;
446 446  
447 447 oss->fd = -1;
448 448  
... ... @@ -576,7 +576,7 @@ static int oss_ctl_out (HWVoiceOut *hw, int cmd, ...)
576 576 return 0;
577 577 }
578 578  
579   -static int oss_init_in (HWVoiceIn *hw, audsettings_t *as)
  579 +static int oss_init_in (HWVoiceIn *hw, struct audsettings *as)
580 580 {
581 581 OSSVoiceIn *oss = (OSSVoiceIn *) hw;
582 582 struct oss_params req, obt;
... ... @@ -584,7 +584,7 @@ static int oss_init_in (HWVoiceIn *hw, audsettings_t *as)
584 584 int err;
585 585 int fd;
586 586 audfmt_e effective_fmt;
587   - audsettings_t obt_as;
  587 + struct audsettings obt_as;
588 588  
589 589 oss->fd = -1;
590 590  
... ...
audio/paaudio.c
... ... @@ -95,7 +95,7 @@ static void *qpa_thread_out (void *arg)
95 95 while (to_mix) {
96 96 int error;
97 97 int chunk = audio_MIN (to_mix, hw->samples - rpos);
98   - st_sample_t *src = hw->mix_buf + rpos;
  98 + struct st_sample *src = hw->mix_buf + rpos;
99 99  
100 100 hw->clip (pa->pcm_buf, src, chunk);
101 101  
... ... @@ -295,11 +295,11 @@ static audfmt_e pa_to_audfmt (pa_sample_format_t fmt, int *endianness)
295 295 }
296 296 }
297 297  
298   -static int qpa_init_out (HWVoiceOut *hw, audsettings_t *as)
  298 +static int qpa_init_out (HWVoiceOut *hw, struct audsettings *as)
299 299 {
300 300 int error;
301 301 static pa_sample_spec ss;
302   - audsettings_t obt_as = *as;
  302 + struct audsettings obt_as = *as;
303 303 PAVoiceOut *pa = (PAVoiceOut *) hw;
304 304  
305 305 ss.format = audfmt_to_pa (as->fmt, as->endianness);
... ... @@ -349,11 +349,11 @@ static int qpa_init_out (HWVoiceOut *hw, audsettings_t *as)
349 349 return -1;
350 350 }
351 351  
352   -static int qpa_init_in (HWVoiceIn *hw, audsettings_t *as)
  352 +static int qpa_init_in (HWVoiceIn *hw, struct audsettings *as)
353 353 {
354 354 int error;
355 355 static pa_sample_spec ss;
356   - audsettings_t obt_as = *as;
  356 + struct audsettings obt_as = *as;
357 357 PAVoiceIn *pa = (PAVoiceIn *) hw;
358 358  
359 359 ss.format = audfmt_to_pa (as->fmt, as->endianness);
... ...
audio/rate_template.h
... ... @@ -27,15 +27,15 @@
27 27 * Processed signed long samples from ibuf to obuf.
28 28 * Return number of samples processed.
29 29 */
30   -void NAME (void *opaque, st_sample_t *ibuf, st_sample_t *obuf,
  30 +void NAME (void *opaque, struct st_sample *ibuf, struct st_sample *obuf,
31 31 int *isamp, int *osamp)
32 32 {
33 33 struct rate *rate = opaque;
34   - st_sample_t *istart, *iend;
35   - st_sample_t *ostart, *oend;
36   - st_sample_t ilast, icur, out;
  34 + struct st_sample *istart, *iend;
  35 + struct st_sample *ostart, *oend;
  36 + struct st_sample ilast, icur, out;
37 37 #ifdef FLOAT_MIXENG
38   - real_t t;
  38 + mixeng_real t;
39 39 #else
40 40 int64_t t;
41 41 #endif
... ... @@ -84,7 +84,7 @@ void NAME (void *opaque, st_sample_t *ibuf, st_sample_t *obuf,
84 84 #ifdef RECIPROCAL
85 85 t = (rate->opos & UINT_MAX) * (1.f / UINT_MAX);
86 86 #else
87   - t = (rate->opos & UINT_MAX) / (real_t) UINT_MAX;
  87 + t = (rate->opos & UINT_MAX) / (mixeng_real) UINT_MAX;
88 88 #endif
89 89 out.l = (ilast.l * (1.0 - t)) + icur.l * t;
90 90 out.r = (ilast.r * (1.0 - t)) + icur.r * t;
... ...
audio/sdlaudio.c
... ... @@ -257,7 +257,7 @@ static void sdl_callback (void *opaque, Uint8 *buf, int len)
257 257 decr = to_mix;
258 258 while (to_mix) {
259 259 int chunk = audio_MIN (to_mix, hw->samples - hw->rpos);
260   - st_sample_t *src = hw->mix_buf + hw->rpos;
  260 + struct st_sample *src = hw->mix_buf + hw->rpos;
261 261  
262 262 /* dolog ("in callback to_mix %d, chunk %d\n", to_mix, chunk); */
263 263 hw->clip (buf, src, chunk);
... ... @@ -323,7 +323,7 @@ static void sdl_fini_out (HWVoiceOut *hw)
323 323 sdl_close (&glob_sdl);
324 324 }
325 325  
326   -static int sdl_init_out (HWVoiceOut *hw, audsettings_t *as)
  326 +static int sdl_init_out (HWVoiceOut *hw, struct audsettings *as)
327 327 {
328 328 SDLVoiceOut *sdl = (SDLVoiceOut *) hw;
329 329 SDLAudioState *s = &glob_sdl;
... ... @@ -332,7 +332,7 @@ static int sdl_init_out (HWVoiceOut *hw, audsettings_t *as)
332 332 int endianess;
333 333 int err;
334 334 audfmt_e effective_fmt;
335   - audsettings_t obt_as;
  335 + struct audsettings obt_as;
336 336  
337 337 shift <<= as->nchannels == 2;
338 338  
... ...
audio/wavaudio.c
... ... @@ -37,7 +37,7 @@ typedef struct WAVVoiceOut {
37 37 } WAVVoiceOut;
38 38  
39 39 static struct {
40   - audsettings_t settings;
  40 + struct audsettings settings;
41 41 const char *wav_path;
42 42 } conf = {
43 43 {
... ... @@ -54,7 +54,7 @@ static int wav_run_out (HWVoiceOut *hw)
54 54 WAVVoiceOut *wav = (WAVVoiceOut *) hw;
55 55 int rpos, live, decr, samples;
56 56 uint8_t *dst;
57   - st_sample_t *src;
  57 + struct st_sample *src;
58 58 int64_t now = qemu_get_clock (vm_clock);
59 59 int64_t ticks = now - wav->old_ticks;
60 60 int64_t bytes = (ticks * hw->info.bytes_per_second) / ticks_per_sec;
... ... @@ -109,7 +109,7 @@ static void le_store (uint8_t *buf, uint32_t val, int len)
109 109 }
110 110 }
111 111  
112   -static int wav_init_out (HWVoiceOut *hw, audsettings_t *as)
  112 +static int wav_init_out (HWVoiceOut *hw, struct audsettings *as)
113 113 {
114 114 WAVVoiceOut *wav = (WAVVoiceOut *) hw;
115 115 int bits16 = 0, stereo = 0;
... ... @@ -119,7 +119,7 @@ static int wav_init_out (HWVoiceOut *hw, audsettings_t *as)
119 119 0x02, 0x00, 0x44, 0xac, 0x00, 0x00, 0x10, 0xb1, 0x02, 0x00, 0x04,
120 120 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00
121 121 };
122   - audsettings_t wav_as = conf.settings;
  122 + struct audsettings wav_as = conf.settings;
123 123  
124 124 (void) as;
125 125  
... ...
audio/wavcapture.c
... ... @@ -91,7 +91,7 @@ int wav_start_capture (CaptureState *s, const char *path, int freq,
91 91 0x02, 0x00, 0x44, 0xac, 0x00, 0x00, 0x10, 0xb1, 0x02, 0x00, 0x04,
92 92 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00
93 93 };
94   - audsettings_t as;
  94 + struct audsettings as;
95 95 struct audio_capture_ops ops;
96 96 int stereo, bits16, shift;
97 97 CaptureVoiceOut *cap;
... ...
hw/ac97.c
... ... @@ -354,7 +354,7 @@ static uint16_t mixer_load (AC97LinkState *s, uint32_t i)
354 354  
355 355 static void open_voice (AC97LinkState *s, int index, int freq)
356 356 {
357   - audsettings_t as;
  357 + struct audsettings as;
358 358  
359 359 as.freq = freq;
360 360 as.nchannels = 2;
... ...
hw/adlib.c
... ... @@ -280,7 +280,7 @@ static void Adlib_fini (AdlibState *s)
280 280 int Adlib_init (AudioState *audio, qemu_irq *pic)
281 281 {
282 282 AdlibState *s = &glob_adlib;
283   - audsettings_t as;
  283 + struct audsettings as;
284 284  
285 285 if (!audio) {
286 286 dolog ("No audio state\n");
... ...
hw/cs4231a.c
... ... @@ -268,7 +268,7 @@ static void cs_audio_callback (void *opaque, int free)
268 268 static void cs_reset_voices (CSState *s, uint32_t val)
269 269 {
270 270 int xtal;
271   - audsettings_t as;
  271 + struct audsettings as;
272 272  
273 273 #ifdef DEBUG_XLAW
274 274 if (val == 0 || val == 32)
... ...
hw/es1370.c
... ... @@ -421,7 +421,7 @@ static void es1370_update_voices (ES1370State *s, uint32_t ctl, uint32_t sctl)
421 421 (new_fmt & 2) ? AUD_FMT_S16 : AUD_FMT_U8,
422 422 d->shift);
423 423 if (new_freq) {
424   - audsettings_t as;
  424 + struct audsettings as;
425 425  
426 426 as.freq = new_freq;
427 427 as.nchannels = 1 << (new_fmt & 1);
... ...
hw/gus.c
... ... @@ -253,7 +253,7 @@ static int GUS_load (QEMUFile *f, void *opaque, int version_id)
253 253 int GUS_init (AudioState *audio, qemu_irq *pic)
254 254 {
255 255 GUSState *s;
256   - audsettings_t as;
  256 + struct audsettings as;
257 257  
258 258 if (!audio) {
259 259 dolog ("No audio state\n");
... ...
hw/omap2.c
... ... @@ -1610,7 +1610,7 @@ static void omap_eac_volume_update(struct omap_eac_s *s)
1610 1610  
1611 1611 static void omap_eac_format_update(struct omap_eac_s *s)
1612 1612 {
1613   - audsettings_t fmt;
  1613 + struct audsettings fmt;
1614 1614  
1615 1615 /* The hardware buffers at most one sample */
1616 1616 if (s->codec.rxlen)
... ...
hw/pcspk.c
... ... @@ -99,7 +99,7 @@ static void pcspk_callback(void *opaque, int free)
99 99 int pcspk_audio_init(AudioState *audio, qemu_irq *pic)
100 100 {
101 101 PCSpkState *s = &pcspk_state;
102   - audsettings_t as = {PCSPK_SAMPLE_RATE, 1, AUD_FMT_U8, 0};
  102 + struct audsettings as = {PCSPK_SAMPLE_RATE, 1, AUD_FMT_U8, 0};
103 103  
104 104 if (!audio) {
105 105 AUD_log(s_spk, "No audio state\n");
... ...
hw/sb16.c
... ... @@ -201,7 +201,7 @@ static void aux_timer (void *opaque)
201 201 static void continue_dma8 (SB16State *s)
202 202 {
203 203 if (s->freq > 0) {
204   - audsettings_t as;
  204 + struct audsettings as;
205 205  
206 206 s->audio_free = 0;
207 207  
... ... @@ -346,7 +346,7 @@ static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t d0, int dma_len)
346 346 }
347 347  
348 348 if (s->freq) {
349   - audsettings_t as;
  349 + struct audsettings as;
350 350  
351 351 s->audio_free = 0;
352 352  
... ... @@ -833,7 +833,7 @@ static void complete (SB16State *s)
833 833  
834 834 static void legacy_reset (SB16State *s)
835 835 {
836   - audsettings_t as;
  836 + struct audsettings as;
837 837  
838 838 s->freq = 11025;
839 839 s->fmt_signed = 0;
... ... @@ -1375,7 +1375,7 @@ static int SB_load (QEMUFile *f, void *opaque, int version_id)
1375 1375  
1376 1376 if (s->dma_running) {
1377 1377 if (s->freq) {
1378   - audsettings_t as;
  1378 + struct audsettings as;
1379 1379  
1380 1380 s->audio_free = 0;
1381 1381  
... ...
hw/tsc210x.c
... ... @@ -327,7 +327,7 @@ static void tsc2102_audio_rate_update(struct tsc210x_state_s *s)
327 327 static void tsc2102_audio_output_update(struct tsc210x_state_s *s)
328 328 {
329 329 int enable;
330   - audsettings_t fmt;
  330 + struct audsettings fmt;
331 331  
332 332 if (s->dac_voice[0]) {
333 333 tsc210x_out_flush(s, s->codec.out.len);
... ...
hw/wm8750.c
... ... @@ -170,9 +170,9 @@ static void wm8750_vol_update(struct wm8750_s *s)
170 170 static void wm8750_set_format(struct wm8750_s *s)
171 171 {
172 172 int i;
173   - audsettings_t in_fmt;
174   - audsettings_t out_fmt;
175   - audsettings_t monoout_fmt;
  173 + struct audsettings in_fmt;
  174 + struct audsettings out_fmt;
  175 + struct audsettings monoout_fmt;
176 176  
177 177 wm8750_out_flush(s);
178 178  
... ...
... ... @@ -171,7 +171,7 @@ struct VncState
171 171 int client_blue_shift, client_blue_max, server_blue_shift, server_blue_max;
172 172  
173 173 CaptureVoiceOut *audio_cap;
174   - audsettings_t as;
  174 + struct audsettings as;
175 175  
176 176 VncReadEvent *read_handler;
177 177 size_t read_handler_expect;
... ...