// Rate creates a new ugen at a specific rate.
// If rate is an unsupported value this method will cause
// a runtime panic.
503663
func (white WhiteNoise) Rate(rate int8) Input {
	CheckRate(rate)
	return NewInput("WhiteNoise", rate, 0, 1)
}
620136
func (l Latch) Rate(rate int8) Input {
	CheckRate(rate)
	if l.In == nil {
		panic("Latch requires an input signal")
	}
	if l.Trig == nil {
		panic("Latch requires an trig signal")
	}
	return NewInput("Latch", rate, 0, 1, l.In, l.Trig)
}
1246990
func (fv FreeVerb) Rate(rate int8) Input {
	CheckRate(rate)
	if fv.In == nil {
		panic("FreeVerb expects In to not be nil")
	}
	(&fv).defaults()
	return NewInput("FreeVerb", rate, 0, 1, fv.In, fv.Mix, fv.Room, fv.Damp)
}
760709
func (r RunningSum) Rate(rate int8) Input {
	CheckRate(rate)
	if r.In == nil {
		panic("RunningSum requires an input signal")
	}
	(&r).defaults()
	return NewInput("RunningSum", rate, 0, 1, r.In, r.NumSamp)
}
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)))
}
704040
func (c CoinGate) Rate(rate int8) Input {
	CheckRate(rate)
	(&c).defaults()
	return NewInput("CoinGate", rate, 0, 1, c.Prob, c.In)
}
103526
func (pulse Pulse) Rate(rate int8) Input {
	CheckRate(rate)
	(&pulse).defaults()
	return NewInput("Pulse", rate, 0, 1, pulse.Freq, pulse.Width)
}
755252
func (s Silent) Rate(rate int8) Input {
	CheckRate(rate)
	(&s).defaults()
	return NewInput("DC", rate, 0, s.NumChannels, C(0))
}
137628
func (pc PulseCount) Rate(rate int8) Input {
	CheckRate(rate)
	(&pc).defaults()
	return NewInput("PulseCount", rate, 0, 1, pc.Trig, pc.Reset)
}
740721
func (bpf BPF) Rate(rate int8) Input {
	if bpf.In == nil {
		panic("BPF expects In to not be nil")
	}
	CheckRate(rate)
	(&bpf).defaults()
	return NewInput("BPF", rate, 0, 1, bpf.In, bpf.Freq, bpf.RQ)
}
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)
}
126528
func (b Ball) Rate(rate int8) Input {
	CheckRate(rate)
	(&b).defaults()
	return NewInput("Ball", rate, 0, 1, b.In, b.Gravity, b.Damp, b.Friction)
}
182594
func (rand Rand) Rate(rate int8) Input {
	CheckRate(rate)
	(&rand).defaults()
	return NewInput("Rand", rate, 0, 1, rand.Lo, rand.Hi)
}
363132
func (x LinXFade2) Rate(rate int8) Input {
	CheckRate(rate)
	(&x).defaults()
	// Not sure why Level doesn't show up in sclang's synthdefs that use LinXFade2
	return NewInput("LinXFade2", rate, 0, 1, x.A, x.B, x.Pan)
}
1098108
func (hpf HPF) Rate(rate int8) Input {
	if hpf.In == nil {
		panic("HPF expects In to not be nil")
	}
	CheckRate(rate)
	(&hpf).defaults()
	return NewInput("HPF", rate, 0, 1, hpf.In, hpf.Freq)
}
515019
func (t Trig) Rate(rate int8) Input {
	CheckRate(rate)
	(&t).defaults()
	return NewInput("Trig", rate, 0, 1, t.In, t.Dur)
}
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...)
}