mirror of
https://github.com/faiface/beep.git
synced 2025-12-23 23:38:45 -05:00
Resampler: add Ratio() method
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user