audio/loop.go
func (i *InfiniteLoop) Seek(offset int64, whence int) (int64, error) {
	if err := i.ensurePos(); err != nil {
		return 0, err
	}

	next := int64(0)
	switch whence {
	case io.SeekStart:
		next = offset
	case io.SeekCurrent:
		next = i.pos + offset
	case io.SeekEnd:
		return 0, fmt.Errorf("audio: whence must be io.SeekStart or io.SeekCurrent for InfiniteLoop")
	}
	if next < 0 {
		return 0, fmt.Errorf("audio: position must >= 0")
	}
	if next >= i.lstart {
		next = ((next - i.lstart) % i.llength) + i.lstart
	}
	// Ignore the new position returned by Seek since the source position might not be match with the position
	// managed by this.
	if _, err := i.src.Seek(next, io.SeekStart); err != nil {
		return 0, err
	}
	i.pos = next
	return i.pos, nil
}
func (i *InfiniteLoop) Seek(offset int64, whence int) (int64, error) {
	if err := i.ensurePos(); err != nil {
		return 0, err
	}

	next := int64(0)
	switch whence {
	case io.SeekStart:
		next = offset
	case io.SeekCurrent:
		next = i.pos + offset
	case io.SeekEnd:
		return 0, fmt.Errorf("audio: whence must be io.SeekStart or io.SeekCurrent for InfiniteLoop")
	}
	if next < 0 {
		return 0, fmt.Errorf("audio: position must >= 0")
	}
	if next >= i.lstart {
		next = ((next - i.lstart) % i.llength) + i.lstart
	}
	// Ignore the new position returned by Seek since the source position might not be match with the position
	// managed by this.
	if _, err := i.src.Seek(next, io.SeekStart); err != nil {
		return 0, err
	}
	i.pos = next
	return i.pos, nil
}
// Seek is implementation of ReadSeekCloser's Seek.