Avoid (expensive) audio interpolation when sample rates already match
This commit is contained in:
parent
d6f17bdcc9
commit
4c83e5cd1e
2 changed files with 8 additions and 4 deletions
|
@ -285,8 +285,11 @@ void AudioRenderer::VoiceState::RefreshBuffer() {
|
|||
break;
|
||||
}
|
||||
|
||||
samples =
|
||||
Interpolate(interp_state, std::move(samples), GetInfo().sample_rate, STREAM_SAMPLE_RATE);
|
||||
// Only interpolate when necessary, expensive.
|
||||
if (GetInfo().sample_rate != STREAM_SAMPLE_RATE) {
|
||||
samples = Interpolate(interp_state, std::move(samples), GetInfo().sample_rate,
|
||||
STREAM_SAMPLE_RATE);
|
||||
}
|
||||
|
||||
is_refresh_pending = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue