mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
srb2::audio::Resampler: add ratio method to change resample rate on the fly
This commit is contained in:
parent
f93e925a4a
commit
2064dda3aa
2 changed files with 8 additions and 0 deletions
|
|
@ -84,5 +84,11 @@ size_t Resampler<C>::generate(tcb::span<Sample<C>> buffer)
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <size_t C>
|
||||||
|
void Resampler<C>::ratio(float new_ratio)
|
||||||
|
{
|
||||||
|
ratio_ = std::max(new_ratio, 0.f);
|
||||||
|
}
|
||||||
|
|
||||||
template class srb2::audio::Resampler<1>;
|
template class srb2::audio::Resampler<1>;
|
||||||
template class srb2::audio::Resampler<2>;
|
template class srb2::audio::Resampler<2>;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ public:
|
||||||
|
|
||||||
virtual std::size_t generate(tcb::span<Sample<C>> buffer);
|
virtual std::size_t generate(tcb::span<Sample<C>> buffer);
|
||||||
|
|
||||||
|
void ratio(float new_ratio);
|
||||||
|
|
||||||
Resampler& operator=(const Resampler<C>& r) = delete;
|
Resampler& operator=(const Resampler<C>& r) = delete;
|
||||||
Resampler& operator=(Resampler<C>&& r);
|
Resampler& operator=(Resampler<C>&& r);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue