audio: improve documentation about io.Seeker

This commit is contained in:
Hajime Hoshi 2025-02-11 17:57:37 +09:00
parent 33d30d8914
commit e33b9cf20e

View File

@ -559,6 +559,10 @@ func (h *hookerImpl) AppendHookOnBeforeUpdate(f func() error) {
// to is the target sample rate. // to is the target sample rate.
// //
// If the original sample rate equals to the new one, ResampleReader returns source as it is. // 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 { func ResampleReader(source io.Reader, size int64, from, to int) io.Reader {
if from == to { if from == to {
return source return source
@ -572,6 +576,10 @@ func ResampleReader(source io.Reader, size int64, from, to int) io.Reader {
// to is the target sample rate. // to is the target sample rate.
// //
// If the original sample rate equals to the new one, ResampleReaderF32 returns source as it is. // 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 { func ResampleReaderF32(source io.Reader, size int64, from, to int) io.Reader {
if from == to { if from == to {
return source return source