예제 #1
0
        /// <summary>
        /// Adds a single sample to the sampler of the specified name, if the sampler does
        /// not exists it will be created. This function is intended to be used with sampler that
        /// are not bound to a function.
        /// </summary>
        public void AddSample(String name, float value)
        {
            DataSampler sampler;

            if (!samplers.TryGetValue(name, out sampler))
            {
                sampler = new DataSampler(name);
                InsertSampler(name, sampler);
            }
            sampler.InsertSample(value);
        }
예제 #2
0
        /// <summary>
        /// Adds a single sample to the sampler of the specified name, if the sampler does
        /// not exists it will be created with the specified historyLength.
        /// This function is intended to be used with sampler that are not bound to a function.
        /// </summary>
        public void AddSample(string name, float value, int historyLength)
        {
            DataSampler sampler;

            if (!samplers.TryGetValue(name, out sampler))
            {
                sampler = new DataSampler(name, historyLength, 0, default(Func <float>));
                InsertSampler(name, sampler);
            }
            else
            {
                sampler.Values.Capacity = historyLength;
            }
            sampler.InsertSample(value);
        }
예제 #3
0
 private void InsertSampler(String name, DataSampler sampler)
 {
     samplers.Add(name, sampler);
     observableSamplers.Add(sampler);
 }
예제 #4
0
        /// <summary>
        /// Adds an sampler which is bound to a <c>function</c> that will be sampled
        /// every <c>sampleRate</c> frames. <c>historyLength</c> values will be kept.
        /// </summary>
        public void AddSampler(String name, int historyLength, int sampleRate, Func <float, float> function)
        {
            DataSampler sampler = new DataSampler(name, historyLength, sampleRate, function);

            InsertSampler(name, sampler);
        }
예제 #5
0
 void InsertSampler(String name, DataSampler sampler)
 {
     _samplers.Add(name, sampler);
     ObservableSamplers.Add(sampler);
 }