Exemplo n.º 1
0
 public HistoricalRange(float weight)
 {
     this.Weight = weight;
     // We initialize these to MaxValue / MinValue respectively so that they snap to the first value observed.
     this.min = new HistoricalBoundaryValue(float.MaxValue, HistoricalBoundaryValue.BoundaryDirection.Min, weight);
     this.max = new HistoricalBoundaryValue(float.MinValue, HistoricalBoundaryValue.BoundaryDirection.Max, weight);
 }
Exemplo n.º 2
0
        public ColorGeneratorBucket(int minFreqBin, int maxFreqBin, int iterationsPerSeconds, ushort hueShift)
        {
            if (this.minFreqBin < 0 || this.maxFreqBin < this.minFreqBin)
            {
                throw new ArgumentOutOfRangeException();
            }

            this.minFreqBin = minFreqBin;
            this.maxFreqBin = maxFreqBin;
            this.hueShift = hueShift;

            float amplitudeBoundaryWeight = 1.0f / (iterationsPerSeconds * ApproximateAmplitudeBoundaryConvergenceInSeconds);
            float smoothedPeakAmplitudeWeight = 1.0f / (iterationsPerSeconds * ApproximatePeakAmplitudeConvergenceInSeconds);

            float peakFrequencyBoundaryWeight = 1.0f / (iterationsPerSeconds * ApproximatePeakFrequencyBoundaryConvergenceInSeconds);
            float smoothedPeakFrequencyWeight = 1.0f / (iterationsPerSeconds * ApproximatePeakFrequencyConvergenceInSeconds);

            this.historicalAmplitudeRange = new HistoricalRange(weight: amplitudeBoundaryWeight);
            this.smoothedPeakAmplitude = new HistoricalBoundaryValue(float.MinValue, HistoricalBoundaryValue.BoundaryDirection.Max, weight: smoothedPeakAmplitudeWeight);

            this.historicalFrequencyRange = new HistoricalRange(weight: peakFrequencyBoundaryWeight);
            this.smoothedPeakFrequency = new HistoricalValue(0, weight: smoothedPeakFrequencyWeight);
        }