Пример #1
0
        private void _TestSpeed()
        {
            const int samplesPerBuffer = 512;

            byte[]    data;
            byte[]    data2   = new byte[samplesPerBuffer * 2];
            double    angle   = 0;
            const int repeats = 100;

            _GetSineWave(_BaseToneFreq * Math.Pow(_HalftoneBase, 5), 44100, samplesPerBuffer * repeats, ref angle, out data);
            for (int i = 0; i < _Analyzers.Count; i++)
            {
                CPitchTracker analyzer = _Analyzers[i];
                Stopwatch     sw       = new Stopwatch();
                sw.Start();
                for (int j = 0; j < repeats; j++)
                {
                    Buffer.BlockCopy(data, 0, data2, 0, samplesPerBuffer * 2);
                    analyzer.Input(data2);
                    analyzer.GetNote(out _MaxVolume, _Weights[i]);
                }
                sw.Stop();
                _SamplesPerSec[i] = (int)Math.Round(samplesPerBuffer * repeats / (sw.ElapsedMilliseconds / 1000.0));
            }
        }
Пример #2
0
 public void AddAnalyzer(CPitchTracker analyzer)
 {
     _Analyzers.Add(analyzer);
 }