From e33b9cf20ef8aa1bbfe8602fc8925956dd645c73 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 11 Feb 2025 17:57:37 +0900 Subject: [PATCH] audio: improve documentation about io.Seeker --- audio/audio.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/audio/audio.go b/audio/audio.go index 2864a0169..827db179f 100644 --- a/audio/audio.go +++ b/audio/audio.go @@ -559,6 +559,10 @@ func (h *hookerImpl) AppendHookOnBeforeUpdate(f func() error) { // to is the target sample rate. // // If the original sample rate equals to the new one, ResampleReader returns source as it is. +// +// The returned value implements io.Seeker when the source implements io.Seeker. +// The returned value might implement io.Seeker even when the source doesn't implement io.Seeker, but +// there is no guarantee that the Seek function works correctly. func ResampleReader(source io.Reader, size int64, from, to int) io.Reader { if from == to { return source @@ -572,6 +576,10 @@ func ResampleReader(source io.Reader, size int64, from, to int) io.Reader { // to is the target sample rate. // // If the original sample rate equals to the new one, ResampleReaderF32 returns source as it is. +// +// The returned value implements io.Seeker when the source implements io.Seeker. +// The returned value might implement io.Seeker even when the source doesn't implement io.Seeker, but +// there is no guarantee that the Seek function works correctly. func ResampleReaderF32(source io.Reader, size int64, from, to int) io.Reader { if from == to { return source