// Midiratio converts an interval in MIDI notes into a frequency ratio.
974424
func (u *Ugen) Midiratio() Input {
	return unaryOpMidiratio(u.Rate, u, u.NumOutputs)
}
856613
func (u *Ugen) Midicps() Input {
	return unaryOpMidicps(u.Rate, u, u.NumOutputs)
}
1328590
func (e *RoundTripStats) AppErrorRatio() float64 {
	return e.ResponseCodeRatio(http.StatusInternalServerError, http.StatusInternalServerError+1, 200, 300)
}
843020
func (b *BloomFilter) EstimatedFillRatio() float64 {
	return 1 - math.Exp((-float64(b.count)*float64(b.k))/float64(b.m))
}
564024
func (a ScmpCompareOp) toNative() C.int {
	switch a {
	case CompareNotEqual:
		return C.C_CMP_NE
	case CompareLess:
		return C.C_CMP_LT
	case CompareLessOrEqual:
		return C.C_CMP_LE
	case CompareEqual:
		return C.C_CMP_EQ
	case CompareGreaterEqual:
		return C.C_CMP_GE
	case CompareGreater:
		return C.C_CMP_GT
	case CompareMaskedEqual:
		return C.C_CMP_MASKED_EQ
	default:
		return 0x0
	}
}
897046
func (a *StartSamplingArgs) SetSamplingInterval(samplingInterval int) *StartSamplingArgs {
	a.SamplingInterval = &samplingInterval
	return a
}
780008
func RatioInt(x1, y1, x2, y2 int) (int, int) {
	if x2 > 0 && y2 > 0 {
		return x2, y2
	} else if x2 <= 0 && y2 <= 0 {
		return x1, y1
	} else if x2 <= 0 {
		return int((float64(x1) / float64(y1)) * float64(y2)), y2
	} else if y2 <= 0 {
		return x2, int((float64(y1) / float64(x1)) * float64(x2))
	}
	return x2, y2
}
1092182
func (mp *MergePolicyImpl) SetNoCFSRatio(noCFSRatio float64) {
	assert2(noCFSRatio >= 0 && noCFSRatio <= 1, fmt.Sprintf(
		"noCFSRatio must be 0.0 to 1.0 inclusive; got %v", noCFSRatio))
	mp.noCFSRatio = noCFSRatio
}
551668
func (m *StrictQuad_Ref) ToNative() (qv quad.Value) {
	if m == nil {
		return nil
	}
	switch v := m.Value.(type) {
	case *StrictQuad_Ref_Iri:
		return quad.IRI(v.Iri)
	case *StrictQuad_Ref_BnodeLabel:
		return quad.BNode(v.BnodeLabel)
	default:
		panic(fmt.Errorf("unsupported type: %T", m.Value))
	}
}
1005716
func KeyInt(n string, octave int) int {
	key := notesToInt[strings.ToUpper(n)]
	// octave starts at -2 but first note is at 0
	return key + (octave+2)*12
}
1375012
func Mfi(high, low, close, volume []float64, timePeriod int32) []float64 {
	var outBegIdx C.int
	var outNBElement C.int
	outReal := make([]float64, len(high))
	C.TA_MFI(0, C.int(len(high)-1), (*C.double)(unsafe.Pointer(&high[0])), (*C.double)(unsafe.Pointer(&low[0])), (*C.double)(unsafe.Pointer(&close[0])), (*C.double)(unsafe.Pointer(&volume[0])), C.int(timePeriod), &outBegIdx, &outNBElement, (*C.double)(unsafe.Pointer(&outReal[0])))
	return outReal[:outNBElement]
}
645
func (mc *MetricsConfiguration) SampleRate() float64 {
	if mc.SamplingRate > 0.0 && mc.SamplingRate <= 1.0 {
		return mc.SamplingRate
	}
	return defaultSamplingRate
}
1143139
func NewScale(root Pitch, intervals []Interval, octaves int) Scale {
	var (
		scale        = Scale{}
		originalRoot = root
		descending   = (octaves < 0)
	)

	// Begin at the base of our octave shift
	if descending {
		root = root.Transpose(Octave(octaves))
	}

	for i := 0; i < abs(octaves); i++ {
		for j, v := range intervals {
			// Ignore the tonic which will become the *last* item in the slice
			// once reversed. This is to maintain consistency with ascending
			// scales: they don't include the final octave of the tonic.
			if descending && i == 0 && j == 0 {
				continue
			}
			scale = append(scale, root.Transpose(v))
		}
		root = root.Transpose(Octave(1))
	}

	// Add the original tonic to the end. It's about to become the beginning of
	// the slice once it's reversed. Reversing the list produces our descending
	// scale.
	if descending {
		scale = append(scale, originalRoot)
		for i := len(scale)/2 - 1; i >= 0; i-- {
			opp := len(scale) - 1 - i
			scale[i], scale[opp] = scale[opp], scale[i]
		}
	}

	return scale
}
946891
func Instrument(yes bool) func(r *Rego) {
	return func(r *Rego) {
		r.instrument = yes
	}
}
1343843
func (m *RTMetrics) NetworkErrorRatio() float64 {
	if m.total.Count() == 0 {
		return 0
	}
	return float64(m.netErrors.Count()) / float64(m.total.Count())
}
1234622
func (ctr *rowConstructor) SpaceBeginRatio(widget_count int) {
	layout := ctr.win.layout
	panelLayout(ctr.win.ctx, ctr.win, ctr.height, widget_count, 0)
	layout.Row.Type = layoutDynamicFree

	layout.Row.Ratio = nil
	layout.Row.ItemWidth = 0
	layout.Row.ItemRatio = 0.0
	layout.Row.ItemOffset = 0
	layout.Row.Filled = 0
}
285356
func (v *Vibrato) defaults() {
	if v.Freq == nil {
		v.Freq = C(440)
	}
	if v.Speed == nil {
		v.Speed = C(6)
	}
	if v.Depth == nil {
		v.Depth = C(0.02)
	}
	if v.Delay == nil {
		v.Delay = C(0)
	}
	if v.Onset == nil {
		v.Onset = C(0)
	}
	if v.RateVariation == nil {
		v.RateVariation = C(0.04)
	}
	if v.DepthVariation == nil {
		v.DepthVariation = C(0.1)
	}
	if v.IPhase == nil {
		v.IPhase = C(0)
	}
}