// SampleRate returns the metrics sampling rate.
645
func (mc *MetricsConfiguration) SampleRate() float64 {
	if mc.SamplingRate > 0.0 && mc.SamplingRate <= 1.0 {
		return mc.SamplingRate
	}
	return defaultSamplingRate
}
778732
func (sweep Sweep) Rate(rate int8) Input {
	CheckRate(rate)
	(&sweep).defaults()
	return NewInput("Sweep", rate, 0, 1, sweep.Trig, sweep.RaiseRate)
}
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...)
}
585159
func (sg *SampleGroup) MaxRate() int64 {
	m := int64(0)
	for i, s := range sg.Samples {
		if i == 0 {
			m = s.Rate()
		}
		m = max(m, s.Rate())
	}
	return m
}
221330
func (gb GrainBuf) Rate(rate int8) Input {
	CheckRate(rate)
	if gb.BufNum == nil {
		panic("GrainBuf requires a buffer number")
	}
	(&gb).defaults()
	return NewInput("GrainBuf", rate, 0, gb.NumChannels, gb.Trigger, gb.Dur, gb.BufNum, gb.Speed, gb.Pos, gb.Interp, gb.Pan, gb.EnvBuf, gb.MaxGrains)
}
35450
func (g GrainIn) Rate(rate int8) Input {
	CheckRate(rate)
	if g.In == nil {
		panic("GrainIn requires an input signal")
	}
	(&g).defaults()

	in := NewInput("GrainIn", rate, 0, 1, g.Trigger, g.Dur, g.In, 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...)
}
1057081
func (p *PerKeyThroughput) GetSampleRate(key string) int {
	p.lock.Lock()
	defer p.lock.Unlock()
	p.currentCounts[key]++
	if rate, found := p.savedSampleRates[key]; found {
		return rate
	}
	return 1
}
153654
func (comb Comb) Rate(rate int8) Input {
	CheckRate(rate)
	if comb.In == nil {
		panic("Comb expects In to not be nil")
	}
	if comb.MaxDelayTime == nil {
		comb.MaxDelayTime = C(0.2)
	}
	if comb.DelayTime == nil {
		comb.DelayTime = C(0.2)
	}
	if comb.DecayTime == nil {
		comb.DecayTime = C(1)
	}
	switch comb.Interpolation {
	case InterpolationNone:
		return NewInput("CombN", rate, 0, 1, comb.In, comb.MaxDelayTime, comb.DelayTime, comb.DecayTime)
	case InterpolationLinear:
		return NewInput("CombL", rate, 0, 1, comb.In, comb.MaxDelayTime, comb.DelayTime, comb.DecayTime)
	case InterpolationCubic:
		return NewInput("CombC", rate, 0, 1, comb.In, comb.MaxDelayTime, comb.DelayTime, comb.DecayTime)
	default:
		panic(fmt.Errorf("invalid interpolation: %d", comb.Interpolation))
	}
}
831449
func (blip Blip) Rate(rate int8) Input {
	CheckRate(rate)
	(&blip).defaults()
	return NewInput("Blip", rate, 0, 1, blip.Freq, blip.Harm)
}
77892
func (xline XLine) Rate(rate int8) Input {
	CheckRate(rate)
	(&xline).defaults()
	return NewInput("XLine", rate, 0, 1, xline.Start, xline.End, xline.Dur, C(float32(xline.Done)))
}
694422
func (s *StringCodeGenerator) Feedrate(feedrate float64) {
	s.put(fmt.Sprintf("F%s", floatToString(feedrate, s.Precision)))
}
707083
func (h FrameHeader) SampleRate() FrameSampleRate {
	if len(h) < 4 {
		return 0
	}
	sri := (h[2] >> 2) & 0x03
	if sri == 0x03 {
		return ErrInvalidSampleRate
	}
	return FrameSampleRate(sampleRates[h.Version()][sri])
}
208279
func (dust2 Dust2) Rate(rate int8) Input {
	CheckRate(rate)
	(&dust2).defaults()
	return NewInput("Dust2", rate, 0, 1, dust2.Density)
}
1246380
func (sel Select) Rate(rate int8) Input {
	CheckRate(rate)
	inputs := append([]Input{sel.Which}, sel.Inputs...)
	return NewInput("Select", rate, 0, 1, inputs...)
}
1298127
func (s *StatusCheck) Sample(sample float64, sampleRate float32, message string, hostname string) {
	s.Value = sample
	s.Message = message
	s.HostName = hostname
}
1202891
func MaxSamplingRate(r int) TracerOption {
	if r <= 0 {
		panic("max sampling rate must be greater than 0")
	}
	return func(o *tracerOptions) *tracerOptions {
		o.maxSamplingRate = r
		return o
	}
}
1168085
func (vs VarSaw) Rate(rate int8) Input {
	CheckRate(rate)
	(&vs).defaults()
	return NewInput("VarSaw", rate, 0, 1, vs.Freq, vs.IPhase, vs.Width)
}