// Rate returns the moving average rate of events per second.
507441
func (a *StandardEWMA) Rate() float64 {
	a.mutex.Lock()
	defer a.mutex.Unlock()
	return a.rate * float64(1e9)
}
996805
func (playbuf PlayBuf) Rate(rate int8) Input {
	CheckRate(rate)
	if playbuf.BufNum == nil {
		panic(fmt.Errorf("BufNum can not be nil"))
	}
	(&playbuf).defaults()
	done := C(float32(playbuf.Done))
	return NewInput("PlayBuf", rate, 0, playbuf.NumChannels, playbuf.BufNum, playbuf.Speed, playbuf.Trigger, playbuf.Start, playbuf.Loop, done)
}
726508
func (l LFGauss) Rate(rate int8) Input {
	CheckRate(rate)
	(&l).defaults()
	done := C(float32(l.Done))
	return NewInput("LFGauss", rate, 0, 1, l.Duration, l.Width, l.IPhase, l.Loop, done)
}
720532
func (g GrainSin) Rate(rate int8) Input {
	CheckRate(rate)
	(&g).defaults()

	in := NewInput("GrainSin", rate, 0, 1, g.Trigger, g.Dur, g.Freq, g.Pan, g.EnvBuf, g.MaxGrains)
	if g.NumChannels == 1 {
		return in
	}
	mult := make([]Input, g.NumChannels)
	for i := range mult {
		mult[i] = in
	}
	return Multi(mult...)
}
732799
func (gate Gate) Rate(rate int8) Input {
	CheckRate(rate)
	if gate.In == nil {
		panic("Gate expects In to not be nil")
	}
	(&gate).defaults()
	return NewInput("Gate", rate, 0, 1, gate.In, gate.Trig)
}
103526
func (pulse Pulse) Rate(rate int8) Input {
	CheckRate(rate)
	(&pulse).defaults()
	return NewInput("Pulse", rate, 0, 1, pulse.Freq, pulse.Width)
}
1168085
func (vs VarSaw) Rate(rate int8) Input {
	CheckRate(rate)
	(&vs).defaults()
	return NewInput("VarSaw", rate, 0, 1, vs.Freq, vs.IPhase, vs.Width)
}
180200
func (lftri LFTri) Rate(rate int8) Input {
	CheckRate(rate)
	(&lftri).defaults()
	return NewInput("LFTri", rate, 0, 1, lftri.Freq, lftri.Iphase)
}
949715
func (o OneZero) Rate(rate int8) Input {
	CheckRate(rate)
	(&o).defaults()
	return NewInput("OneZero", rate, 0, 1, o.In, o.Coeff)
}
838968
func (s SinOscFB) Rate(rate int8) Input {
	CheckRate(rate)
	(&s).defaults()
	return NewInput("SinOscFB", rate, 0, 1, s.Freq, s.Feedback)
}
60416
func (p PSinGrain) Rate(rate int8) Input {
	CheckRate(rate)
	(&p).defaults()
	return NewInput("PSinGrain", rate, 0, 1, p.Freq, p.Dur, p.Amp)
}
282517
func (decay Decay) Rate(rate int8) Input {
	CheckRate(rate)
	if decay.In == nil {
		panic("Decay expects In to not be nil")
	}
	(&decay).defaults()
	return NewInput("Decay", rate, 0, 1, decay.In, decay.Decay)
}
515019
func (t Trig) Rate(rate int8) Input {
	CheckRate(rate)
	(&t).defaults()
	return NewInput("Trig", rate, 0, 1, t.In, t.Dur)
}
627169
func (a *AvgRateCounter) Rate() float64 {
	hits, value := a.hits.Rate(), a.counter.Rate()

	if hits == 0 {
		return 0 // Avoid division by zero
	}

	return float64(value) / float64(hits)
}
296121
func (crackle Crackle) Rate(rate int8) Input {
	CheckRate(rate)
	(&crackle).defaults()
	return NewInput("Crackle", rate, 0, 1, crackle.Chaos)
}
718453
func (ds DetectSilence) Rate(rate int8) Input {
	if ds.In == nil {
		panic("DetectSilence expects In to not be nil")
	}
	CheckRate(rate)
	(&ds).defaults()
	return NewInput("DetectSilence", rate, 0, 1, ds.In, ds.Amp, ds.Time, C(float32(ds.Done)))
}
831449
func (blip Blip) Rate(rate int8) Input {
	CheckRate(rate)
	(&blip).defaults()
	return NewInput("Blip", rate, 0, 1, blip.Freq, blip.Harm)
}