Skip to content

Commit

Permalink
audio: remove read and write pcm_ops
Browse files Browse the repository at this point in the history
They just called audio_pcm_sw_read/write anyway, so it makes no sense
to have them too.  (The noaudio's read is the only exception, but it
should work with the generic code too.)

Signed-off-by: Kővágó, Zoltán <[email protected]>
Message-id: 92ddc98133bc4b687c6e4608b9321e7b64c0e496.1566168923.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <[email protected]>
  • Loading branch information
DirtYiCE authored and kraxel committed Aug 21, 2019
1 parent 10d5e75 commit 1d793fe
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 106 deletions.
12 changes: 0 additions & 12 deletions audio/alsaaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,6 @@ static int alsa_poll_in (HWVoiceIn *hw)
return alsa_poll_helper (alsa->handle, &alsa->pollhlp, POLLIN);
}

static int alsa_write (SWVoiceOut *sw, void *buf, int len)
{
return audio_pcm_sw_write (sw, buf, len);
}

static snd_pcm_format_t aud_to_alsafmt (AudioFormat fmt, int endianness)
{
switch (fmt) {
Expand Down Expand Up @@ -988,11 +983,6 @@ static int alsa_run_in (HWVoiceIn *hw)
return read_samples;
}

static int alsa_read (SWVoiceIn *sw, void *buf, int size)
{
return audio_pcm_sw_read (sw, buf, size);
}

static int alsa_ctl_in (HWVoiceIn *hw, int cmd, ...)
{
ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;
Expand Down Expand Up @@ -1076,13 +1066,11 @@ static struct audio_pcm_ops alsa_pcm_ops = {
.init_out = alsa_init_out,
.fini_out = alsa_fini_out,
.run_out = alsa_run_out,
.write = alsa_write,
.ctl_out = alsa_ctl_out,

.init_in = alsa_init_in,
.fini_in = alsa_fini_in,
.run_in = alsa_run_in,
.read = alsa_read,
.ctl_in = alsa_ctl_in,
};

Expand Down
8 changes: 4 additions & 4 deletions audio/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ static int audio_pcm_sw_get_rpos_in (SWVoiceIn *sw)
}
}

int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size)
static 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;
Expand Down Expand Up @@ -698,7 +698,7 @@ static int audio_pcm_hw_get_live_out (HWVoiceOut *hw, int *nb_live)
/*
* Soft voice (playback)
*/
int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int size)
static int audio_pcm_sw_write(SWVoiceOut *sw, void *buf, int size)
{
int hwsamples, samples, isamp, osamp, wpos, live, dead, left, swlim, blck;
int ret = 0, pos = 0, total = 0;
Expand Down Expand Up @@ -856,7 +856,7 @@ int AUD_write (SWVoiceOut *sw, void *buf, int size)
return 0;
}

return sw->hw->pcm_ops->write(sw, buf, size);
return audio_pcm_sw_write(sw, buf, size);
}

int AUD_read (SWVoiceIn *sw, void *buf, int size)
Expand All @@ -871,7 +871,7 @@ int AUD_read (SWVoiceIn *sw, void *buf, int size)
return 0;
}

return sw->hw->pcm_ops->read(sw, buf, size);
return audio_pcm_sw_read(sw, buf, size);
}

int AUD_get_buffer_size_out (SWVoiceOut *sw)
Expand Down
5 changes: 0 additions & 5 deletions audio/audio_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,11 @@ struct audio_pcm_ops {
int (*init_out)(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque);
void (*fini_out)(HWVoiceOut *hw);
int (*run_out) (HWVoiceOut *hw, int live);
int (*write) (SWVoiceOut *sw, void *buf, int size);
int (*ctl_out) (HWVoiceOut *hw, int cmd, ...);

int (*init_in) (HWVoiceIn *hw, struct audsettings *as, void *drv_opaque);
void (*fini_in) (HWVoiceIn *hw);
int (*run_in) (HWVoiceIn *hw);
int (*read) (SWVoiceIn *sw, void *buf, int size);
int (*ctl_in) (HWVoiceIn *hw, int cmd, ...);
};

Expand Down Expand Up @@ -210,11 +208,8 @@ audio_driver *audio_driver_lookup(const char *name);
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);
int audio_pcm_hw_get_live_in (HWVoiceIn *hw);

int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int len);

int audio_pcm_hw_clip_out (HWVoiceOut *hw, void *pcm_buf,
int live, int pending);

Expand Down
6 changes: 0 additions & 6 deletions audio/coreaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,6 @@ static OSStatus audioDeviceIOProc(
return 0;
}

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, struct audsettings *as,
void *drv_opaque)
{
Expand Down Expand Up @@ -692,7 +687,6 @@ static struct audio_pcm_ops coreaudio_pcm_ops = {
.init_out = coreaudio_init_out,
.fini_out = coreaudio_fini_out,
.run_out = coreaudio_run_out,
.write = coreaudio_write,
.ctl_out = coreaudio_ctl_out
};

Expand Down
12 changes: 0 additions & 12 deletions audio/dsoundaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,6 @@ static int dsound_ctl_out (HWVoiceOut *hw, int cmd, ...)
return 0;
}

static int dsound_write (SWVoiceOut *sw, void *buf, int len)
{
return audio_pcm_sw_write (sw, buf, len);
}

static int dsound_run_out (HWVoiceOut *hw, int live)
{
int err;
Expand Down Expand Up @@ -645,11 +640,6 @@ static int dsound_ctl_in (HWVoiceIn *hw, int cmd, ...)
return 0;
}

static int dsound_read (SWVoiceIn *sw, void *buf, int len)
{
return audio_pcm_sw_read (sw, buf, len);
}

static int dsound_run_in (HWVoiceIn *hw)
{
int err;
Expand Down Expand Up @@ -856,13 +846,11 @@ static struct audio_pcm_ops dsound_pcm_ops = {
.init_out = dsound_init_out,
.fini_out = dsound_fini_out,
.run_out = dsound_run_out,
.write = dsound_write,
.ctl_out = dsound_ctl_out,

.init_in = dsound_init_in,
.fini_in = dsound_fini_in,
.run_in = dsound_run_in,
.read = dsound_read,
.ctl_in = dsound_ctl_in
};

Expand Down
19 changes: 0 additions & 19 deletions audio/noaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ static int no_run_out (HWVoiceOut *hw, int live)
return decr;
}

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, struct audsettings *as, void *drv_opaque)
{
audio_pcm_init_info (&hw->info, as);
Expand Down Expand Up @@ -118,18 +113,6 @@ static int no_run_in (HWVoiceIn *hw)
return samples;
}

static int no_read (SWVoiceIn *sw, void *buf, int size)
{
/* use custom code here instead of audio_pcm_sw_read() to avoid
* useless resampling/mixing */
int samples = size >> sw->info.shift;
int total = sw->hw->total_samples_captured - sw->total_hw_samples_acquired;
int to_clear = MIN (samples, total);
sw->total_hw_samples_acquired += total;
audio_pcm_info_clear_buf (&sw->info, buf, to_clear);
return to_clear << sw->info.shift;
}

static int no_ctl_in (HWVoiceIn *hw, int cmd, ...)
{
(void) hw;
Expand All @@ -151,13 +134,11 @@ static struct audio_pcm_ops no_pcm_ops = {
.init_out = no_init_out,
.fini_out = no_fini_out,
.run_out = no_run_out,
.write = no_write,
.ctl_out = no_ctl_out,

.init_in = no_init_in,
.fini_in = no_fini_in,
.run_in = no_run_in,
.read = no_read,
.ctl_in = no_ctl_in
};

Expand Down
12 changes: 0 additions & 12 deletions audio/ossaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ static void oss_poll_in (HWVoiceIn *hw)
qemu_set_fd_handler(oss->fd, oss_helper_poll_in, NULL, hw->s);
}

static int oss_write (SWVoiceOut *sw, void *buf, int len)
{
return audio_pcm_sw_write (sw, buf, len);
}

static int aud_to_ossfmt (AudioFormat fmt, int endianness)
{
switch (fmt) {
Expand Down Expand Up @@ -788,11 +783,6 @@ static int oss_run_in (HWVoiceIn *hw)
return read_samples;
}

static int oss_read (SWVoiceIn *sw, void *buf, int size)
{
return audio_pcm_sw_read (sw, buf, size);
}

static int oss_ctl_in (HWVoiceIn *hw, int cmd, ...)
{
OSSVoiceIn *oss = (OSSVoiceIn *) hw;
Expand Down Expand Up @@ -855,13 +845,11 @@ static struct audio_pcm_ops oss_pcm_ops = {
.init_out = oss_init_out,
.fini_out = oss_fini_out,
.run_out = oss_run_out,
.write = oss_write,
.ctl_out = oss_ctl_out,

.init_in = oss_init_in,
.fini_in = oss_fini_in,
.run_in = oss_run_in,
.read = oss_read,
.ctl_in = oss_ctl_in
};

Expand Down
12 changes: 0 additions & 12 deletions audio/paaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,6 @@ static int qpa_run_out (HWVoiceOut *hw, int live)
return decr;
}

static int qpa_write (SWVoiceOut *sw, void *buf, int len)
{
return audio_pcm_sw_write (sw, buf, len);
}

/* capture */
static void *qpa_thread_in (void *arg)
{
Expand Down Expand Up @@ -388,11 +383,6 @@ static int qpa_run_in (HWVoiceIn *hw)
return incr;
}

static int qpa_read (SWVoiceIn *sw, void *buf, int len)
{
return audio_pcm_sw_read (sw, buf, len);
}

static pa_sample_format_t audfmt_to_pa (AudioFormat afmt, int endianness)
{
int format;
Expand Down Expand Up @@ -1016,13 +1006,11 @@ static struct audio_pcm_ops qpa_pcm_ops = {
.init_out = qpa_init_out,
.fini_out = qpa_fini_out,
.run_out = qpa_run_out,
.write = qpa_write,
.ctl_out = qpa_ctl_out,

.init_in = qpa_init_in,
.fini_in = qpa_fini_in,
.run_in = qpa_run_in,
.read = qpa_read,
.ctl_in = qpa_ctl_in
};

Expand Down
6 changes: 0 additions & 6 deletions audio/sdlaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@ static void sdl_callback (void *opaque, Uint8 *buf, int len)
}
}

static int sdl_write_out (SWVoiceOut *sw, void *buf, int len)
{
return audio_pcm_sw_write (sw, buf, len);
}

static int sdl_run_out (HWVoiceOut *hw, int live)
{
int decr;
Expand Down Expand Up @@ -342,7 +337,6 @@ static struct audio_pcm_ops sdl_pcm_ops = {
.init_out = sdl_init_out,
.fini_out = sdl_fini_out,
.run_out = sdl_run_out,
.write = sdl_write_out,
.ctl_out = sdl_ctl_out,
};

Expand Down
12 changes: 0 additions & 12 deletions audio/spiceaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,6 @@ static int line_out_run (HWVoiceOut *hw, int live)
return decr;
}

static int line_out_write (SWVoiceOut *sw, void *buf, int len)
{
return audio_pcm_sw_write (sw, buf, len);
}

static int line_out_ctl (HWVoiceOut *hw, int cmd, ...)
{
SpiceVoiceOut *out = container_of (hw, SpiceVoiceOut, hw);
Expand Down Expand Up @@ -325,11 +320,6 @@ static int line_in_run (HWVoiceIn *hw)
return num_samples;
}

static int line_in_read (SWVoiceIn *sw, void *buf, int size)
{
return audio_pcm_sw_read (sw, buf, size);
}

static int line_in_ctl (HWVoiceIn *hw, int cmd, ...)
{
SpiceVoiceIn *in = container_of (hw, SpiceVoiceIn, hw);
Expand Down Expand Up @@ -377,13 +367,11 @@ static struct audio_pcm_ops audio_callbacks = {
.init_out = line_out_init,
.fini_out = line_out_fini,
.run_out = line_out_run,
.write = line_out_write,
.ctl_out = line_out_ctl,

.init_in = line_in_init,
.fini_in = line_in_fini,
.run_in = line_in_run,
.read = line_in_read,
.ctl_in = line_in_ctl,
};

Expand Down
6 changes: 0 additions & 6 deletions audio/wavaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ static int wav_run_out (HWVoiceOut *hw, int live)
return decr;
}

static int wav_write_out (SWVoiceOut *sw, void *buf, int len)
{
return audio_pcm_sw_write (sw, buf, len);
}

/* VICE code: Store number as little endian. */
static void le_store (uint8_t *buf, uint32_t val, int len)
{
Expand Down Expand Up @@ -240,7 +235,6 @@ static struct audio_pcm_ops wav_pcm_ops = {
.init_out = wav_init_out,
.fini_out = wav_fini_out,
.run_out = wav_run_out,
.write = wav_write_out,
.ctl_out = wav_ctl_out,
};

Expand Down

0 comments on commit 1d793fe

Please sign in to comment.