// Rate creates a new ugen at a specific rate.
// If rate is an unsupported value this method will cause
// a runtime panic.
180200
func (lftri LFTri) Rate(rate int8) Input {
	CheckRate(rate)
	(&lftri).defaults()
	return NewInput("LFTri", rate, 0, 1, lftri.Freq, lftri.Iphase)
}
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)
}
630937
func (m MouseY) Rate(rate int8) Input {
	CheckRate(rate)
	(&m).defaults()
	return NewInput("MouseY", rate, 0, 1, m.Min, m.Max, m.Warp, m.Lag)
}
1005216
func (envgen EnvGen) Rate(rate int8) Input {
	CheckRate(rate)
	(&envgen).defaults()
	ins := []Input{
		envgen.Gate,
		envgen.LevelScale,
		envgen.LevelBias,
		envgen.TimeScale,
		C(float32(envgen.Done)),
	}
	ins = append(ins, envgen.Env.Inputs()...)
	return NewInput("EnvGen", rate, 0, 1, ins...)
}
503663
func (white WhiteNoise) Rate(rate int8) Input {
	CheckRate(rate)
	return NewInput("WhiteNoise", rate, 0, 1)
}
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)
}
208279
func (dust2 Dust2) Rate(rate int8) Input {
	CheckRate(rate)
	(&dust2).defaults()
	return NewInput("Dust2", rate, 0, 1, dust2.Density)
}
326276
func (lfnoise LFNoise) Rate(rate int8) Input {
	CheckRate(rate)
	(&lfnoise).defaults()
	switch lfnoise.Interpolation {
	case NoiseStep:
		return NewInput("LFNoise0", rate, 0, 1, lfnoise.Freq)
	case NoiseLinear:
		return NewInput("LFNoise1", rate, 0, 1, lfnoise.Freq)
	case NoiseQuadratic:
		return NewInput("LFNoise2", rate, 0, 1, lfnoise.Freq)
	default:
		panic(fmt.Sprintf("Unknown Interpolation value for LFNoise: %d", lfnoise.Interpolation))
	}
}
1071256
func (line Line) Rate(rate int8) Input {
	CheckRate(rate)
	(&line).defaults()
	return NewInput("Line", rate, 0, 1, line.Start, line.End, line.Dur, C(float32(line.Done)))
}
204367
func (s SyncSaw) Rate(rate int8) Input {
	CheckRate(rate)
	(&s).defaults()
	return NewInput("SyncSaw", rate, 0, 1, s.SyncFreq, s.SawFreq)
}
405646
func (s *Sample) Rate() int64 {
	return int64(float64(s.JobMsgCnt) / s.Duration().Seconds())
}
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)
}
1320119
func (pan Pan4) Rate(rate int8) Input {
	CheckRate(rate)
	if pan.In == nil {
		panic("Pan4 requires an input")
	}
	(&pan).defaults()
	in := NewInput("Pan4", rate, 0, 1, pan.In, pan.XPos, pan.YPos, pan.Level)
	return Multi(in, in, in, in)

}
507441
func (a *StandardEWMA) Rate() float64 {
	a.mutex.Lock()
	defer a.mutex.Unlock()
	return a.rate * float64(1e9)
}
1299188
func (brown BrownNoise) Rate(rate int8) Input {
	CheckRate(rate)
	return NewInput("BrownNoise", rate, 0, 1)
}
49184
func (maxLocalBufs) Rate(rate int8) Input {
	CheckRate(rate)
	return NewInput("MaxLocalBufs", rate, 0, 1, C(1))
}
112866
func (delay Delay) Rate(rate int8) Input {
	CheckRate(rate)
	if delay.In == nil {
		panic("Delay expects In to not be nil")
	}
	if delay.MaxDelayTime == nil {
		delay.MaxDelayTime = C(0.2)
	}
	if delay.DelayTime == nil {
		delay.DelayTime = C(0.2)
	}
	switch delay.Interpolation {
	case InterpolationNone:
		return NewInput("DelayN", rate, 0, 1, delay.In, delay.MaxDelayTime, delay.DelayTime)
	case InterpolationLinear:
		return NewInput("DelayL", rate, 0, 1, delay.In, delay.MaxDelayTime, delay.DelayTime)
	case InterpolationCubic:
		return NewInput("DelayC", rate, 0, 1, delay.In, delay.MaxDelayTime, delay.DelayTime)
	default:
		panic(fmt.Errorf("invalid interpolation %d", delay.Interpolation))
	}
}