You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: doppler.go
    path of file: ./repos/beep/effects
    
    the code of the file until where you have to start completion: package effects

import "github.com/faiface/beep"

// Doppler simulates a "sound at a distance". If the sound starts at a far distance,
// it'll take some time to reach the ears of the listener.
//
// The distance of the sound can change dynamically. Doppler adjusts the density of
// the sound (affecting its speed) to remain consistent with the distance. This is called
// the Doppler effect.
//
// The arguments are:
//
//   quality:         the quality of the underlying resampler (1 or 2 is usually okay)
//   samplesPerMeter: sample rate / speed of sound
//   s:               the source streamer
//   distance: 
    
func (d *doppler) Stream(samples [][2]float64) (n int, ok bool) {
	distance := d.distance(len(samples))
	currentSpaceLen := int(distance * d.samplesPerMeter)
	difference := currentSpaceLen - len(d.space)

	d.r.SetRatio(float64(len(samples)) / float64(len(samples)+difference))

	d.space = append(d.space, make([][2]float64, len(samples)+difference)...)
	rn, _ := d.r.Stream(d.space[len(d.space)-len(samples)-difference:])
	d.space = d.space[:len(d.space)-len(samples)-difference+rn]
	for i := len(d.space) - rn; i < len(d.space); i++ {
		d.space[i][0] /= distance * distance
		d.space[i][1] /= distance * distance
	}

	if len(d.space) == 0 {
		return 0, false
	}
	n = copy(samples, d.space)
	d.space = d.space[n:]
	return n, true
}