mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00:00
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>
This commit is contained in:
committed by
Marc-André Lureau
parent
148392abef
commit
2f886a34bb
@ -108,7 +108,6 @@ struct SWVoiceOut {
|
||||
AudioState *s;
|
||||
struct audio_pcm_info info;
|
||||
t_sample *conv;
|
||||
int64_t ratio;
|
||||
STSampleBuffer resample_buf;
|
||||
void *rate;
|
||||
size_t total_hw_samples_mixed;
|
||||
@ -126,7 +125,6 @@ struct SWVoiceIn {
|
||||
AudioState *s;
|
||||
int active;
|
||||
struct audio_pcm_info info;
|
||||
int64_t ratio;
|
||||
void *rate;
|
||||
size_t total_hw_samples_acquired;
|
||||
STSampleBuffer resample_buf;
|
||||
|
Reference in New Issue
Block a user