Resampler: add Ratio() method

This commit is contained in:
faiface
2019-02-28 16:59:01 +01:00
parent fc2da0b5e0
commit 71ce6ecc6f

View File

@@ -141,6 +141,11 @@ func (r *Resampler) Err() error {
return r.s.Err()
}
// Ratio returns the current resampling ratio.
func (r *Resampler) Ratio() float64 {
return r.ratio
}
// SetRatio sets the resampling ratio. This does not cause any glitches in the stream.
func (r *Resampler) SetRatio(ratio float64) {
r.pos = int(float64(r.pos) * r.ratio / ratio)