diff options
| author | Volker Rümelin <vr_qemu@t-online.de> | 2023-02-24 20:05:55 +0100 |
|---|---|---|
| committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-03-06 10:30:24 +0400 |
| commit | 2f886a34bb7e6f6fcf39d64829f4499476f26dba (patch) | |
| tree | 7add7e00fc5cf48724683fd2fbccdd30bbebcb05 /audio/audio.c | |
| parent | 148392abef4ed3591675fc8b07cc3063a3369a7b (diff) | |
| download | focaccia-qemu-2f886a34bb7e6f6fcf39d64829f4499476f26dba.tar.gz focaccia-qemu-2f886a34bb7e6f6fcf39d64829f4499476f26dba.zip | |
audio: remove sw->ratio
Simplify the resample buffer size calculation. For audio playback we have sw->ratio = ((int64_t)sw->hw->info.freq << 32) / sw->info.freq; samples = ((int64_t)sw->HWBUF.size << 32) / sw->ratio; This can be simplified to samples = muldiv64(sw->HWBUF.size, sw->info.freq, sw->hw->info.freq); For audio recording we have sw->ratio = ((int64_t)sw->info.freq << 32) / sw->hw->info.freq; samples = (int64_t)sw->HWBUF.size * sw->ratio >> 32; This can be simplified to samples = muldiv64(sw->HWBUF.size, sw->info.freq, sw->hw->info.freq); With hw = sw->hw this becomes in both cases samples = muldiv64(HWBUF.size, sw->info.freq, hw->info.freq); Now that sw->ratio is no longer needed, remove sw->ratio. Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20230224190555.7409-15-vr_qemu@t-online.de>
Diffstat (limited to 'audio/audio.c')
| -rw-r--r-- | audio/audio.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/audio/audio.c b/audio/audio.c index 4836ab8ca8..70b096713c 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -478,7 +478,6 @@ static int audio_attach_capture (HWVoiceOut *hw) sw->info = hw->info; sw->empty = 1; sw->active = hw->enabled; - sw->ratio = ((int64_t) hw_cap->info.freq << 32) / sw->info.freq; sw->vol = nominal_volume; sw->rate = st_rate_start (sw->info.freq, hw_cap->info.freq); QLIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries); |