/// <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); }
/// <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); }
private void InsertSampler(String name, DataSampler sampler) { samplers.Add(name, sampler); observableSamplers.Add(sampler); }
/// <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); }
void InsertSampler(String name, DataSampler sampler) { _samplers.Add(name, sampler); ObservableSamplers.Add(sampler); }