From 1ea879e5580f63414693655fcf0328559cdce138 Mon Sep 17 00:00:00 2001 From: malc Date: Wed, 3 Dec 2008 22:48:44 +0000 Subject: [PATCH] Make audio violate POSIX less git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5864 c046a42c-6fe2-441c-8c8c-71466251a162 --- audio/alsaaudio.c | 12 ++++++------ audio/audio.c | 26 +++++++++++++------------- audio/audio.h | 10 +++++----- audio/audio_int.h | 20 ++++++++++---------- audio/audio_template.h | 20 +++++++++++--------- audio/coreaudio.c | 4 ++-- audio/dsound_template.h | 6 +++--- audio/dsoundaudio.c | 14 ++++++++------ audio/esdaudio.c | 10 +++++----- audio/fmodaudio.c | 12 ++++++------ audio/mixeng.c | 6 +++--- audio/mixeng.h | 22 +++++++++++----------- audio/mixeng_template.h | 28 ++++++++++++++-------------- audio/noaudio.c | 4 ++-- audio/ossaudio.c | 10 +++++----- audio/paaudio.c | 10 +++++----- audio/rate_template.h | 12 ++++++------ audio/sdlaudio.c | 6 +++--- audio/wavaudio.c | 8 ++++---- audio/wavcapture.c | 2 +- hw/ac97.c | 2 +- hw/adlib.c | 2 +- hw/cs4231a.c | 2 +- hw/es1370.c | 2 +- hw/gus.c | 2 +- hw/omap2.c | 2 +- hw/pcspk.c | 2 +- hw/sb16.c | 8 ++++---- hw/tsc210x.c | 2 +- hw/wm8750.c | 6 +++--- vnc.c | 2 +- 31 files changed, 139 insertions(+), 135 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index a79cc403cb..2f6c764dca 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -527,7 +527,7 @@ static int alsa_run_out (HWVoiceOut *hw) int rpos, live, decr; int samples; uint8_t *dst; - st_sample_t *src; + struct st_sample *src; snd_pcm_sframes_t avail; live = audio_pcm_hw_get_live_out (hw); @@ -612,13 +612,13 @@ static void alsa_fini_out (HWVoiceOut *hw) } } -static int alsa_init_out (HWVoiceOut *hw, audsettings_t *as) +static int alsa_init_out (HWVoiceOut *hw, struct audsettings *as) { ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw; struct alsa_params_req req; struct alsa_params_obt obt; snd_pcm_t *handle; - audsettings_t obt_as; + struct audsettings obt_as; req.fmt = aud_to_alsafmt (as->fmt); req.freq = as->freq; @@ -692,13 +692,13 @@ static int alsa_ctl_out (HWVoiceOut *hw, int cmd, ...) return -1; } -static int alsa_init_in (HWVoiceIn *hw, audsettings_t *as) +static int alsa_init_in (HWVoiceIn *hw, struct audsettings *as) { ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw; struct alsa_params_req req; struct alsa_params_obt obt; snd_pcm_t *handle; - audsettings_t obt_as; + struct audsettings obt_as; req.fmt = aud_to_alsafmt (as->fmt); req.freq = as->freq; @@ -792,7 +792,7 @@ static int alsa_run_in (HWVoiceIn *hw) for (i = 0; i < 2; ++i) { void *src; - st_sample_t *dst; + struct st_sample *dst; snd_pcm_sframes_t nread; snd_pcm_uframes_t len; diff --git a/audio/audio.c b/audio/audio.c index 3a30103abc..a449609bb2 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -47,7 +47,7 @@ struct fixed_settings { int enabled; int nb_voices; int greedy; - audsettings_t settings; + struct audsettings settings; }; static struct { @@ -91,7 +91,7 @@ static struct { static AudioState glob_audio_state; -volume_t nominal_volume = { +struct mixeng_volume nominal_volume = { 0, #ifdef FLOAT_MIXENG 1.0, @@ -513,7 +513,7 @@ static void audio_process_options (const char *prefix, } } -static void audio_print_settings (audsettings_t *as) +static void audio_print_settings (struct audsettings *as) { dolog ("frequency=%d nchannels=%d fmt=", as->freq, as->nchannels); @@ -556,7 +556,7 @@ static void audio_print_settings (audsettings_t *as) AUD_log (NULL, "\n"); } -static int audio_validate_settings (audsettings_t *as) +static int audio_validate_settings (struct audsettings *as) { int invalid; @@ -580,7 +580,7 @@ static int audio_validate_settings (audsettings_t *as) return invalid ? -1 : 0; } -static int audio_pcm_info_eq (struct audio_pcm_info *info, audsettings_t *as) +static int audio_pcm_info_eq (struct audio_pcm_info *info, struct audsettings *as) { int bits = 8, sign = 0; @@ -609,7 +609,7 @@ static int audio_pcm_info_eq (struct audio_pcm_info *info, audsettings_t *as) && info->swap_endianness == (as->endianness != AUDIO_HOST_ENDIANNESS); } -void audio_pcm_init_info (struct audio_pcm_info *info, audsettings_t *as) +void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as) { int bits = 8, sign = 0, shift = 0; @@ -704,8 +704,8 @@ void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len) /* * Capture */ -static void noop_conv (st_sample_t *dst, const void *src, - int samples, volume_t *vol) +static void noop_conv (struct st_sample *dst, const void *src, + int samples, struct mixeng_volume *vol) { (void) src; (void) dst; @@ -715,7 +715,7 @@ static void noop_conv (st_sample_t *dst, const void *src, static CaptureVoiceOut *audio_pcm_capture_find_specific ( AudioState *s, - audsettings_t *as + struct audsettings *as ) { CaptureVoiceOut *cap; @@ -891,7 +891,7 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size) { HWVoiceIn *hw = sw->hw; int samples, live, ret = 0, swlim, isamp, osamp, rpos, total = 0; - st_sample_t *src, *dst = sw->buf; + struct st_sample *src, *dst = sw->buf; rpos = audio_pcm_sw_get_rpos_in (sw) % hw->samples; @@ -1442,7 +1442,7 @@ static void audio_run_capture (AudioState *s) while (live) { int left = hw->samples - rpos; int to_capture = audio_MIN (live, left); - st_sample_t *src; + struct st_sample *src; struct capture_callback *cb; src = hw->mix_buf + rpos; @@ -1812,7 +1812,7 @@ AudioState *AUD_init (void) CaptureVoiceOut *AUD_add_capture ( AudioState *s, - audsettings_t *as, + struct audsettings *as, struct audio_capture_ops *ops, void *cb_opaque ) @@ -1863,7 +1863,7 @@ CaptureVoiceOut *AUD_add_capture ( /* XXX find a more elegant way */ hw->samples = 4096 * 4; hw->mix_buf = audio_calloc (AUDIO_FUNC, hw->samples, - sizeof (st_sample_t)); + sizeof (struct st_sample)); if (!hw->mix_buf) { dolog ("Could not allocate capture mix buffer (%d samples)\n", hw->samples); diff --git a/audio/audio.h b/audio/audio.h index 4b0e7a3a88..4aaeb965e3 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -44,12 +44,12 @@ typedef enum { #define AUDIO_HOST_ENDIANNESS 0 #endif -typedef struct { +struct audsettings { int freq; int nchannels; audfmt_e fmt; int endianness; -} audsettings_t; +}; typedef enum { AUD_CNOTIFY_ENABLE, @@ -100,7 +100,7 @@ void AUD_register_card (AudioState *s, const char *name, QEMUSoundCard *card); void AUD_remove_card (QEMUSoundCard *card); CaptureVoiceOut *AUD_add_capture ( AudioState *s, - audsettings_t *as, + struct audsettings *as, struct audio_capture_ops *ops, void *opaque ); @@ -112,7 +112,7 @@ SWVoiceOut *AUD_open_out ( const char *name, void *callback_opaque, audio_callback_fn_t callback_fn, - audsettings_t *settings + struct audsettings *settings ); void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw); @@ -133,7 +133,7 @@ SWVoiceIn *AUD_open_in ( const char *name, void *callback_opaque, audio_callback_fn_t callback_fn, - audsettings_t *settings + struct audsettings *settings ); void AUD_close_in (QEMUSoundCard *card, SWVoiceIn *sw); diff --git a/audio/audio_int.h b/audio/audio_int.h index d4cefb34a6..c1da710d06 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -76,7 +76,7 @@ typedef struct HWVoiceOut { int rpos; uint64_t ts_helper; - st_sample_t *mix_buf; + struct st_sample *mix_buf; int samples; LIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head; @@ -95,7 +95,7 @@ typedef struct HWVoiceIn { int total_samples_captured; uint64_t ts_helper; - st_sample_t *conv_buf; + struct st_sample *conv_buf; int samples; LIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head; @@ -107,14 +107,14 @@ struct SWVoiceOut { struct audio_pcm_info info; t_sample *conv; int64_t ratio; - st_sample_t *buf; + struct st_sample *buf; void *rate; int total_hw_samples_mixed; int active; int empty; HWVoiceOut *hw; char *name; - volume_t vol; + struct mixeng_volume vol; struct audio_callback callback; LIST_ENTRY (SWVoiceOut) entries; }; @@ -125,11 +125,11 @@ struct SWVoiceIn { int64_t ratio; void *rate; int total_hw_samples_acquired; - st_sample_t *buf; + struct st_sample *buf; f_sample *clip; HWVoiceIn *hw; char *name; - volume_t vol; + struct mixeng_volume vol; struct audio_callback callback; LIST_ENTRY (SWVoiceIn) entries; }; @@ -149,13 +149,13 @@ struct audio_driver { }; struct audio_pcm_ops { - int (*init_out)(HWVoiceOut *hw, audsettings_t *as); + int (*init_out)(HWVoiceOut *hw, struct audsettings *as); void (*fini_out)(HWVoiceOut *hw); int (*run_out) (HWVoiceOut *hw); int (*write) (SWVoiceOut *sw, void *buf, int size); int (*ctl_out) (HWVoiceOut *hw, int cmd, ...); - int (*init_in) (HWVoiceIn *hw, audsettings_t *as); + int (*init_in) (HWVoiceIn *hw, struct audsettings *as); void (*fini_in) (HWVoiceIn *hw); int (*run_in) (HWVoiceIn *hw); int (*read) (SWVoiceIn *sw, void *buf, int size); @@ -204,9 +204,9 @@ extern struct audio_driver coreaudio_audio_driver; extern struct audio_driver dsound_audio_driver; extern struct audio_driver esd_audio_driver; extern struct audio_driver pa_audio_driver; -extern volume_t nominal_volume; +extern struct mixeng_volume nominal_volume; -void audio_pcm_init_info (struct audio_pcm_info *info, audsettings_t *as); +void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as); void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len); int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int len); diff --git a/audio/audio_template.h b/audio/audio_template.h index 850e101d72..369ed3b9e5 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -82,7 +82,7 @@ static void glue (audio_pcm_hw_free_resources_, TYPE) (HW *hw) static int glue (audio_pcm_hw_alloc_resources_, TYPE) (HW *hw) { - HWBUF = audio_calloc (AUDIO_FUNC, hw->samples, sizeof (st_sample_t)); + HWBUF = audio_calloc (AUDIO_FUNC, hw->samples, sizeof (struct st_sample)); if (!HWBUF) { dolog ("Could not allocate " NAME " buffer (%d samples)\n", hw->samples); @@ -116,7 +116,7 @@ static int glue (audio_pcm_sw_alloc_resources_, TYPE) (SW *sw) samples = ((int64_t) sw->hw->samples << 32) / sw->ratio; #endif - sw->buf = audio_calloc (AUDIO_FUNC, samples, sizeof (st_sample_t)); + sw->buf = audio_calloc (AUDIO_FUNC, samples, sizeof (struct st_sample)); if (!sw->buf) { dolog ("Could not allocate buffer for `%s' (%d samples)\n", SW_NAME (sw), samples); @@ -140,7 +140,7 @@ static int glue (audio_pcm_sw_init_, TYPE) ( SW *sw, HW *hw, const char *name, - audsettings_t *as + struct audsettings *as ) { int err; @@ -229,7 +229,7 @@ static HW *glue (audio_pcm_hw_find_any_enabled_, TYPE) (AudioState *s, HW *hw) static HW *glue (audio_pcm_hw_find_specific_, TYPE) ( AudioState *s, HW *hw, - audsettings_t *as + struct audsettings *as ) { while ((hw = glue (audio_pcm_hw_find_any_, TYPE) (s, hw))) { @@ -240,7 +240,8 @@ static HW *glue (audio_pcm_hw_find_specific_, TYPE) ( return NULL; } -static HW *glue (audio_pcm_hw_add_new_, TYPE) (AudioState *s, audsettings_t *as) +static HW *glue (audio_pcm_hw_add_new_, TYPE) (AudioState *s, + struct audsettings *as) { HW *hw; struct audio_driver *drv = s->drv; @@ -308,7 +309,8 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (AudioState *s, audsettings_t *as) return NULL; } -static HW *glue (audio_pcm_hw_add_, TYPE) (AudioState *s, audsettings_t *as) +static HW *glue (audio_pcm_hw_add_, TYPE) (AudioState *s, + struct audsettings *as) { HW *hw; @@ -335,12 +337,12 @@ static HW *glue (audio_pcm_hw_add_, TYPE) (AudioState *s, audsettings_t *as) static SW *glue (audio_pcm_create_voice_pair_, TYPE) ( AudioState *s, const char *sw_name, - audsettings_t *as + struct audsettings *as ) { SW *sw; HW *hw; - audsettings_t hw_as; + struct audsettings hw_as; if (glue (conf.fixed_, TYPE).enabled) { hw_as = glue (conf.fixed_, TYPE).settings; @@ -405,7 +407,7 @@ SW *glue (AUD_open_, TYPE) ( const char *name, void *callback_opaque , audio_callback_fn_t callback_fn, - audsettings_t *as + struct audsettings *as ) { AudioState *s; diff --git a/audio/coreaudio.c b/audio/coreaudio.c index 516bb3fad6..96714297e5 100644 --- a/audio/coreaudio.c +++ b/audio/coreaudio.c @@ -233,7 +233,7 @@ static OSStatus audioDeviceIOProc( HWVoiceOut *hw = hwptr; coreaudioVoiceOut *core = (coreaudioVoiceOut *) hwptr; int rpos, live; - st_sample_t *src; + struct st_sample *src; #ifndef FLOAT_MIXENG #ifdef RECIPROCAL const float scale = 1.f / UINT_MAX; @@ -289,7 +289,7 @@ static int coreaudio_write (SWVoiceOut *sw, void *buf, int len) return audio_pcm_sw_write (sw, buf, len); } -static int coreaudio_init_out (HWVoiceOut *hw, audsettings_t *as) +static int coreaudio_init_out (HWVoiceOut *hw, struct audsettings *as) { OSStatus status; coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; diff --git a/audio/dsound_template.h b/audio/dsound_template.h index 9cc0b9d519..a594f080a7 100644 --- a/audio/dsound_template.h +++ b/audio/dsound_template.h @@ -174,16 +174,16 @@ static void dsound_fini_out (HWVoiceOut *hw) } #ifdef DSBTYPE_IN -static int dsound_init_in (HWVoiceIn *hw, audsettings_t *as) +static int dsound_init_in (HWVoiceIn *hw, struct audsettings *as) #else -static int dsound_init_out (HWVoiceOut *hw, audsettings_t *as) +static int dsound_init_out (HWVoiceOut *hw, struct audsettings *as) #endif { int err; HRESULT hr; dsound *s = &glob_dsound; WAVEFORMATEX wfx; - audsettings_t obt_as; + struct audsettings obt_as; #ifdef DSBTYPE_IN const char *typ = "ADC"; DSoundVoiceIn *ds = (DSoundVoiceIn *) hw; diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index cba8c80030..df4b2f04d9 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -47,7 +47,7 @@ static struct { int set_primary; int bufsize_in; int bufsize_out; - audsettings_t settings; + struct audsettings settings; int latency_millis; } conf = { 1, @@ -68,7 +68,7 @@ typedef struct { LPDIRECTSOUND dsound; LPDIRECTSOUNDCAPTURE dsound_capture; LPDIRECTSOUNDBUFFER dsound_primary_buffer; - audsettings_t settings; + struct audsettings settings; } dsound; static dsound glob_dsound; @@ -307,7 +307,8 @@ static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb) return -1; } -static int waveformat_from_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as) +static int waveformat_from_audio_settings (WAVEFORMATEX *wfx, + struct audsettings *as) { memset (wfx, 0, sizeof (*wfx)); @@ -346,7 +347,8 @@ static int waveformat_from_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as) return 0; } -static int waveformat_to_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as) +static int waveformat_to_audio_settings (WAVEFORMATEX *wfx, + struct audsettings *as) { if (wfx->wFormatTag != WAVE_FORMAT_PCM) { 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) int src_len1 = dst_len; int src_len2 = 0; int pos = hw->rpos + dst_len; - st_sample_t *src1 = hw->mix_buf + hw->rpos; - st_sample_t *src2 = NULL; + struct st_sample *src1 = hw->mix_buf + hw->rpos; + struct st_sample *src2 = NULL; if (pos > hw->samples) { src_len1 = hw->samples - hw->rpos; diff --git a/audio/esdaudio.c b/audio/esdaudio.c index f5dc1be1dc..0102c5ade0 100644 --- a/audio/esdaudio.c +++ b/audio/esdaudio.c @@ -115,7 +115,7 @@ static void *qesd_thread_out (void *arg) while (to_mix) { ssize_t written; int chunk = audio_MIN (to_mix, hw->samples - rpos); - st_sample_t *src = hw->mix_buf + rpos; + struct st_sample *src = hw->mix_buf + rpos; hw->clip (esd->pcm_buf, src, chunk); @@ -188,10 +188,10 @@ static int qesd_write (SWVoiceOut *sw, void *buf, int len) return audio_pcm_sw_write (sw, buf, len); } -static int qesd_init_out (HWVoiceOut *hw, audsettings_t *as) +static int qesd_init_out (HWVoiceOut *hw, struct audsettings *as) { ESDVoiceOut *esd = (ESDVoiceOut *) hw; - audsettings_t obt_as = *as; + struct audsettings obt_as = *as; int esdfmt = ESD_STREAM | ESD_PLAY; int err; sigset_t set, old_set; @@ -421,10 +421,10 @@ static int qesd_read (SWVoiceIn *sw, void *buf, int len) return audio_pcm_sw_read (sw, buf, len); } -static int qesd_init_in (HWVoiceIn *hw, audsettings_t *as) +static int qesd_init_in (HWVoiceIn *hw, struct audsettings *as) { ESDVoiceIn *esd = (ESDVoiceIn *) hw; - audsettings_t obt_as = *as; + struct audsettings obt_as = *as; int esdfmt = ESD_STREAM | ESD_RECORD; int err; sigset_t set, old_set; diff --git a/audio/fmodaudio.c b/audio/fmodaudio.c index 04f4e40b3a..4be4ab658f 100644 --- a/audio/fmodaudio.c +++ b/audio/fmodaudio.c @@ -142,8 +142,8 @@ static void fmod_write_sample (HWVoiceOut *hw, uint8_t *dst, int dst_len) int src_len1 = dst_len; int src_len2 = 0; int pos = hw->rpos + dst_len; - st_sample_t *src1 = hw->mix_buf + hw->rpos; - st_sample_t *src2 = NULL; + struct st_sample *src1 = hw->mix_buf + hw->rpos; + struct st_sample *src2 = NULL; if (pos > hw->samples) { src_len1 = hw->samples - hw->rpos; @@ -355,11 +355,11 @@ static void fmod_fini_out (HWVoiceOut *hw) } } -static int fmod_init_out (HWVoiceOut *hw, audsettings_t *as) +static int fmod_init_out (HWVoiceOut *hw, struct audsettings *as) { int bits16, mode, channel; FMODVoiceOut *fmd = (FMODVoiceOut *) hw; - audsettings_t obt_as = *as; + struct audsettings obt_as = *as; mode = aud_to_fmodfmt (as->fmt, as->nchannels == 2 ? 1 : 0); fmd->fmod_sample = FSOUND_Sample_Alloc ( @@ -417,11 +417,11 @@ static int fmod_ctl_out (HWVoiceOut *hw, int cmd, ...) return 0; } -static int fmod_init_in (HWVoiceIn *hw, audsettings_t *as) +static int fmod_init_in (HWVoiceIn *hw, struct audsettings *as) { int bits16, mode; FMODVoiceIn *fmd = (FMODVoiceIn *) hw; - audsettings_t obt_as = *as; + struct audsettings obt_as = *as; if (conf.broken_adc) { return -1; diff --git a/audio/mixeng.c b/audio/mixeng.c index 5e0426cb6d..8ce942e49b 100644 --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -290,7 +290,7 @@ struct rate { uint64_t opos; uint64_t opos_inc; uint32_t ipos; /* position in the input stream (integer) */ - st_sample_t ilast; /* last sample in the input stream */ + struct st_sample ilast; /* last sample in the input stream */ }; /* @@ -329,7 +329,7 @@ void st_rate_stop (void *opaque) qemu_free (opaque); } -void mixeng_clear (st_sample_t *buf, int len) +void mixeng_clear (struct st_sample *buf, int len) { - memset (buf, 0, len * sizeof (st_sample_t)); + memset (buf, 0, len * sizeof (struct st_sample)); } diff --git a/audio/mixeng.h b/audio/mixeng.h index 95b68df6ac..cac0569ac4 100644 --- a/audio/mixeng.h +++ b/audio/mixeng.h @@ -25,27 +25,27 @@ #define QEMU_MIXENG_H #ifdef FLOAT_MIXENG -typedef float real_t; -typedef struct { int mute; real_t r; real_t l; } volume_t; -typedef struct { real_t l; real_t r; } st_sample_t; +typedef float mixeng_real; +struct mixeng_volume { int mute; mixeng_real r; mixeng_real l; }; +struct mixeng_sample { mixeng_real l; mixeng_real r; }; #else -typedef struct { int mute; int64_t r; int64_t l; } volume_t; -typedef struct { int64_t l; int64_t r; } st_sample_t; +struct mixeng_volume { int mute; int64_t r; int64_t l; }; +struct st_sample { int64_t l; int64_t r; }; #endif -typedef void (t_sample) (st_sample_t *dst, const void *src, - int samples, volume_t *vol); -typedef void (f_sample) (void *dst, const st_sample_t *src, int samples); +typedef void (t_sample) (struct st_sample *dst, const void *src, + int samples, struct mixeng_volume *vol); +typedef void (f_sample) (void *dst, const struct st_sample *src, int samples); extern t_sample *mixeng_conv[2][2][2][3]; extern f_sample *mixeng_clip[2][2][2][3]; void *st_rate_start (int inrate, int outrate); -void st_rate_flow (void *opaque, st_sample_t *ibuf, st_sample_t *obuf, +void st_rate_flow (void *opaque, struct st_sample *ibuf, struct st_sample *obuf, int *isamp, int *osamp); -void st_rate_flow_mix (void *opaque, st_sample_t *ibuf, st_sample_t *obuf, +void st_rate_flow_mix (void *opaque, struct st_sample *ibuf, struct st_sample *obuf, int *isamp, int *osamp); void st_rate_stop (void *opaque); -void mixeng_clear (st_sample_t *buf, int len); +void mixeng_clear (struct st_sample *buf, int len); #endif /* mixeng.h */ diff --git a/audio/mixeng_template.h b/audio/mixeng_template.h index 21eef58bf6..56177056ce 100644 --- a/audio/mixeng_template.h +++ b/audio/mixeng_template.h @@ -44,26 +44,26 @@ #define ET glue (ENDIAN_CONVERSION, glue (_, IN_T)) #ifdef FLOAT_MIXENG -static real_t inline glue (conv_, ET) (IN_T v) +static mixeng_real inline glue (conv_, ET) (IN_T v) { IN_T nv = ENDIAN_CONVERT (v); #ifdef RECIPROCAL #ifdef SIGNED - return nv * (1.f / (real_t) (IN_MAX - IN_MIN)); + return nv * (1.f / (mixeng_real) (IN_MAX - IN_MIN)); #else - return (nv - HALF) * (1.f / (real_t) IN_MAX); + return (nv - HALF) * (1.f / (mixeng_real) IN_MAX); #endif #else /* !RECIPROCAL */ #ifdef SIGNED - return nv / (real_t) (IN_MAX - IN_MIN); + return nv / (mixeng_real) (IN_MAX - IN_MIN); #else - return (nv - HALF) / (real_t) IN_MAX; + return (nv - HALF) / (mixeng_real) IN_MAX; #endif #endif } -static IN_T inline glue (clip_, ET) (real_t v) +static IN_T inline glue (clip_, ET) (mixeng_real v) { if (v >= 0.5) { return IN_MAX; @@ -109,9 +109,9 @@ static inline IN_T glue (clip_, ET) (int64_t v) #endif static void glue (glue (conv_, ET), _to_stereo) - (st_sample_t *dst, const void *src, int samples, volume_t *vol) + (struct st_sample *dst, const void *src, int samples, struct mixeng_volume *vol) { - st_sample_t *out = dst; + struct st_sample *out = dst; IN_T *in = (IN_T *) src; #ifdef CONFIG_MIXEMU if (vol->mute) { @@ -129,9 +129,9 @@ static void glue (glue (conv_, ET), _to_stereo) } static void glue (glue (conv_, ET), _to_mono) - (st_sample_t *dst, const void *src, int samples, volume_t *vol) + (struct st_sample *dst, const void *src, int samples, struct mixeng_volume *vol) { - st_sample_t *out = dst; + struct st_sample *out = dst; IN_T *in = (IN_T *) src; #ifdef CONFIG_MIXEMU if (vol->mute) { @@ -150,9 +150,9 @@ static void glue (glue (conv_, ET), _to_mono) } static void glue (glue (clip_, ET), _from_stereo) - (void *dst, const st_sample_t *src, int samples) + (void *dst, const struct st_sample *src, int samples) { - const st_sample_t *in = src; + const struct st_sample *in = src; IN_T *out = (IN_T *) dst; while (samples--) { *out++ = glue (clip_, ET) (in->l); @@ -162,9 +162,9 @@ static void glue (glue (clip_, ET), _from_stereo) } static void glue (glue (clip_, ET), _from_mono) - (void *dst, const st_sample_t *src, int samples) + (void *dst, const struct st_sample *src, int samples) { - const st_sample_t *in = src; + const struct st_sample *in = src; IN_T *out = (IN_T *) dst; while (samples--) { *out++ = glue (clip_, ET) (in->l + in->r); diff --git a/audio/noaudio.c b/audio/noaudio.c index 64695e6af9..943241382e 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -68,7 +68,7 @@ static int no_write (SWVoiceOut *sw, void *buf, int len) return audio_pcm_sw_write (sw, buf, len); } -static int no_init_out (HWVoiceOut *hw, audsettings_t *as) +static int no_init_out (HWVoiceOut *hw, struct audsettings *as) { audio_pcm_init_info (&hw->info, as); hw->samples = 1024; @@ -87,7 +87,7 @@ static int no_ctl_out (HWVoiceOut *hw, int cmd, ...) return 0; } -static int no_init_in (HWVoiceIn *hw, audsettings_t *as) +static int no_init_in (HWVoiceIn *hw, struct audsettings *as) { audio_pcm_init_info (&hw->info, as); hw->samples = 1024; diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 613e189db1..0236c2efaf 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -294,7 +294,7 @@ static int oss_run_out (HWVoiceOut *hw) int err, rpos, live, decr; int samples; uint8_t *dst; - st_sample_t *src; + struct st_sample *src; struct audio_buf_info abinfo; struct count_info cntinfo; int bufsize; @@ -434,7 +434,7 @@ static void oss_fini_out (HWVoiceOut *hw) } } -static int oss_init_out (HWVoiceOut *hw, audsettings_t *as) +static int oss_init_out (HWVoiceOut *hw, struct audsettings *as) { OSSVoiceOut *oss = (OSSVoiceOut *) hw; struct oss_params req, obt; @@ -442,7 +442,7 @@ static int oss_init_out (HWVoiceOut *hw, audsettings_t *as) int err; int fd; audfmt_e effective_fmt; - audsettings_t obt_as; + struct audsettings obt_as; oss->fd = -1; @@ -576,7 +576,7 @@ static int oss_ctl_out (HWVoiceOut *hw, int cmd, ...) return 0; } -static int oss_init_in (HWVoiceIn *hw, audsettings_t *as) +static int oss_init_in (HWVoiceIn *hw, struct audsettings *as) { OSSVoiceIn *oss = (OSSVoiceIn *) hw; struct oss_params req, obt; @@ -584,7 +584,7 @@ static int oss_init_in (HWVoiceIn *hw, audsettings_t *as) int err; int fd; audfmt_e effective_fmt; - audsettings_t obt_as; + struct audsettings obt_as; oss->fd = -1; diff --git a/audio/paaudio.c b/audio/paaudio.c index 8190cde92f..ff43bdd1f1 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -95,7 +95,7 @@ static void *qpa_thread_out (void *arg) while (to_mix) { int error; int chunk = audio_MIN (to_mix, hw->samples - rpos); - st_sample_t *src = hw->mix_buf + rpos; + struct st_sample *src = hw->mix_buf + rpos; hw->clip (pa->pcm_buf, src, chunk); @@ -295,11 +295,11 @@ static audfmt_e pa_to_audfmt (pa_sample_format_t fmt, int *endianness) } } -static int qpa_init_out (HWVoiceOut *hw, audsettings_t *as) +static int qpa_init_out (HWVoiceOut *hw, struct audsettings *as) { int error; static pa_sample_spec ss; - audsettings_t obt_as = *as; + struct audsettings obt_as = *as; PAVoiceOut *pa = (PAVoiceOut *) hw; ss.format = audfmt_to_pa (as->fmt, as->endianness); @@ -349,11 +349,11 @@ static int qpa_init_out (HWVoiceOut *hw, audsettings_t *as) return -1; } -static int qpa_init_in (HWVoiceIn *hw, audsettings_t *as) +static int qpa_init_in (HWVoiceIn *hw, struct audsettings *as) { int error; static pa_sample_spec ss; - audsettings_t obt_as = *as; + struct audsettings obt_as = *as; PAVoiceIn *pa = (PAVoiceIn *) hw; ss.format = audfmt_to_pa (as->fmt, as->endianness); diff --git a/audio/rate_template.h b/audio/rate_template.h index 398d305e92..bd4b1c7685 100644 --- a/audio/rate_template.h +++ b/audio/rate_template.h @@ -27,15 +27,15 @@ * Processed signed long samples from ibuf to obuf. * Return number of samples processed. */ -void NAME (void *opaque, st_sample_t *ibuf, st_sample_t *obuf, +void NAME (void *opaque, struct st_sample *ibuf, struct st_sample *obuf, int *isamp, int *osamp) { struct rate *rate = opaque; - st_sample_t *istart, *iend; - st_sample_t *ostart, *oend; - st_sample_t ilast, icur, out; + struct st_sample *istart, *iend; + struct st_sample *ostart, *oend; + struct st_sample ilast, icur, out; #ifdef FLOAT_MIXENG - real_t t; + mixeng_real t; #else int64_t t; #endif @@ -84,7 +84,7 @@ void NAME (void *opaque, st_sample_t *ibuf, st_sample_t *obuf, #ifdef RECIPROCAL t = (rate->opos & UINT_MAX) * (1.f / UINT_MAX); #else - t = (rate->opos & UINT_MAX) / (real_t) UINT_MAX; + t = (rate->opos & UINT_MAX) / (mixeng_real) UINT_MAX; #endif out.l = (ilast.l * (1.0 - t)) + icur.l * t; out.r = (ilast.r * (1.0 - t)) + icur.r * t; diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 8bd6b56539..dd85e98322 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -257,7 +257,7 @@ static void sdl_callback (void *opaque, Uint8 *buf, int len) decr = to_mix; while (to_mix) { int chunk = audio_MIN (to_mix, hw->samples - hw->rpos); - st_sample_t *src = hw->mix_buf + hw->rpos; + struct st_sample *src = hw->mix_buf + hw->rpos; /* dolog ("in callback to_mix %d, chunk %d\n", to_mix, chunk); */ hw->clip (buf, src, chunk); @@ -323,7 +323,7 @@ static void sdl_fini_out (HWVoiceOut *hw) sdl_close (&glob_sdl); } -static int sdl_init_out (HWVoiceOut *hw, audsettings_t *as) +static int sdl_init_out (HWVoiceOut *hw, struct audsettings *as) { SDLVoiceOut *sdl = (SDLVoiceOut *) hw; SDLAudioState *s = &glob_sdl; @@ -332,7 +332,7 @@ static int sdl_init_out (HWVoiceOut *hw, audsettings_t *as) int endianess; int err; audfmt_e effective_fmt; - audsettings_t obt_as; + struct audsettings obt_as; shift <<= as->nchannels == 2; diff --git a/audio/wavaudio.c b/audio/wavaudio.c index b7a36f2c78..e50dac2926 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -37,7 +37,7 @@ typedef struct WAVVoiceOut { } WAVVoiceOut; static struct { - audsettings_t settings; + struct audsettings settings; const char *wav_path; } conf = { { @@ -54,7 +54,7 @@ static int wav_run_out (HWVoiceOut *hw) WAVVoiceOut *wav = (WAVVoiceOut *) hw; int rpos, live, decr, samples; uint8_t *dst; - st_sample_t *src; + struct st_sample *src; int64_t now = qemu_get_clock (vm_clock); int64_t ticks = now - wav->old_ticks; 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) } } -static int wav_init_out (HWVoiceOut *hw, audsettings_t *as) +static int wav_init_out (HWVoiceOut *hw, struct audsettings *as) { WAVVoiceOut *wav = (WAVVoiceOut *) hw; int bits16 = 0, stereo = 0; @@ -119,7 +119,7 @@ static int wav_init_out (HWVoiceOut *hw, audsettings_t *as) 0x02, 0x00, 0x44, 0xac, 0x00, 0x00, 0x10, 0xb1, 0x02, 0x00, 0x04, 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00 }; - audsettings_t wav_as = conf.settings; + struct audsettings wav_as = conf.settings; (void) as; diff --git a/audio/wavcapture.c b/audio/wavcapture.c index 3281c3110d..9919171e40 100644 --- a/audio/wavcapture.c +++ b/audio/wavcapture.c @@ -91,7 +91,7 @@ int wav_start_capture (CaptureState *s, const char *path, int freq, 0x02, 0x00, 0x44, 0xac, 0x00, 0x00, 0x10, 0xb1, 0x02, 0x00, 0x04, 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00 }; - audsettings_t as; + struct audsettings as; struct audio_capture_ops ops; int stereo, bits16, shift; CaptureVoiceOut *cap; diff --git a/hw/ac97.c b/hw/ac97.c index 55c65df4fc..c30e894074 100644 --- a/hw/ac97.c +++ b/hw/ac97.c @@ -354,7 +354,7 @@ static uint16_t mixer_load (AC97LinkState *s, uint32_t i) static void open_voice (AC97LinkState *s, int index, int freq) { - audsettings_t as; + struct audsettings as; as.freq = freq; as.nchannels = 2; diff --git a/hw/adlib.c b/hw/adlib.c index 7a9c2e7f5c..3c1436032d 100644 --- a/hw/adlib.c +++ b/hw/adlib.c @@ -280,7 +280,7 @@ static void Adlib_fini (AdlibState *s) int Adlib_init (AudioState *audio, qemu_irq *pic) { AdlibState *s = &glob_adlib; - audsettings_t as; + struct audsettings as; if (!audio) { dolog ("No audio state\n"); diff --git a/hw/cs4231a.c b/hw/cs4231a.c index 75529089f6..6d04d367b1 100644 --- a/hw/cs4231a.c +++ b/hw/cs4231a.c @@ -268,7 +268,7 @@ static void cs_audio_callback (void *opaque, int free) static void cs_reset_voices (CSState *s, uint32_t val) { int xtal; - audsettings_t as; + struct audsettings as; #ifdef DEBUG_XLAW if (val == 0 || val == 32) diff --git a/hw/es1370.c b/hw/es1370.c index a2a017bd5f..bad237d21f 100644 --- a/hw/es1370.c +++ b/hw/es1370.c @@ -421,7 +421,7 @@ static void es1370_update_voices (ES1370State *s, uint32_t ctl, uint32_t sctl) (new_fmt & 2) ? AUD_FMT_S16 : AUD_FMT_U8, d->shift); if (new_freq) { - audsettings_t as; + struct audsettings as; as.freq = new_freq; as.nchannels = 1 << (new_fmt & 1); diff --git a/hw/gus.c b/hw/gus.c index 0ab55a63b5..fb129cd49d 100644 --- a/hw/gus.c +++ b/hw/gus.c @@ -253,7 +253,7 @@ static int GUS_load (QEMUFile *f, void *opaque, int version_id) int GUS_init (AudioState *audio, qemu_irq *pic) { GUSState *s; - audsettings_t as; + struct audsettings as; if (!audio) { dolog ("No audio state\n"); diff --git a/hw/omap2.c b/hw/omap2.c index aee26a0296..58debaf552 100644 --- a/hw/omap2.c +++ b/hw/omap2.c @@ -1610,7 +1610,7 @@ static void omap_eac_volume_update(struct omap_eac_s *s) static void omap_eac_format_update(struct omap_eac_s *s) { - audsettings_t fmt; + struct audsettings fmt; /* The hardware buffers at most one sample */ if (s->codec.rxlen) diff --git a/hw/pcspk.c b/hw/pcspk.c index 9bb248b807..ec1d0c687c 100644 --- a/hw/pcspk.c +++ b/hw/pcspk.c @@ -99,7 +99,7 @@ static void pcspk_callback(void *opaque, int free) int pcspk_audio_init(AudioState *audio, qemu_irq *pic) { PCSpkState *s = &pcspk_state; - audsettings_t as = {PCSPK_SAMPLE_RATE, 1, AUD_FMT_U8, 0}; + struct audsettings as = {PCSPK_SAMPLE_RATE, 1, AUD_FMT_U8, 0}; if (!audio) { AUD_log(s_spk, "No audio state\n"); diff --git a/hw/sb16.c b/hw/sb16.c index c22de7a715..8a0fafe63f 100644 --- a/hw/sb16.c +++ b/hw/sb16.c @@ -201,7 +201,7 @@ static void aux_timer (void *opaque) static void continue_dma8 (SB16State *s) { if (s->freq > 0) { - audsettings_t as; + struct audsettings as; s->audio_free = 0; @@ -346,7 +346,7 @@ static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t d0, int dma_len) } if (s->freq) { - audsettings_t as; + struct audsettings as; s->audio_free = 0; @@ -833,7 +833,7 @@ static void complete (SB16State *s) static void legacy_reset (SB16State *s) { - audsettings_t as; + struct audsettings as; s->freq = 11025; s->fmt_signed = 0; @@ -1375,7 +1375,7 @@ static int SB_load (QEMUFile *f, void *opaque, int version_id) if (s->dma_running) { if (s->freq) { - audsettings_t as; + struct audsettings as; s->audio_free = 0; diff --git a/hw/tsc210x.c b/hw/tsc210x.c index 0ae48f73b0..2d31c65398 100644 --- a/hw/tsc210x.c +++ b/hw/tsc210x.c @@ -327,7 +327,7 @@ static void tsc2102_audio_rate_update(struct tsc210x_state_s *s) static void tsc2102_audio_output_update(struct tsc210x_state_s *s) { int enable; - audsettings_t fmt; + struct audsettings fmt; if (s->dac_voice[0]) { tsc210x_out_flush(s, s->codec.out.len); diff --git a/hw/wm8750.c b/hw/wm8750.c index e35492408c..93fa6d7ff6 100644 --- a/hw/wm8750.c +++ b/hw/wm8750.c @@ -170,9 +170,9 @@ static void wm8750_vol_update(struct wm8750_s *s) static void wm8750_set_format(struct wm8750_s *s) { int i; - audsettings_t in_fmt; - audsettings_t out_fmt; - audsettings_t monoout_fmt; + struct audsettings in_fmt; + struct audsettings out_fmt; + struct audsettings monoout_fmt; wm8750_out_flush(s); diff --git a/vnc.c b/vnc.c index bd75854de9..538658a774 100644 --- a/vnc.c +++ b/vnc.c @@ -171,7 +171,7 @@ struct VncState int client_blue_shift, client_blue_max, server_blue_shift, server_blue_max; CaptureVoiceOut *audio_cap; - audsettings_t as; + struct audsettings as; VncReadEvent *read_handler; size_t read_handler_expect; -- 2.11.4.GIT