Skip to content

Commit

Permalink
audio: improve documentation about io.Seeker
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimehoshi committed Feb 11, 2025
1 parent 33d30d8 commit e33b9cf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions audio/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e33b9cf

Please sign in to comment.