private IEnumerator AnalyzeRoutine() { UnityEngine.Debug.Log("Built in analyze start"); sw = new Stopwatch(); allTicks = new List <long>(); if (silence != null) { silence.Unload(); } //This "" is a special path to load a silence. silence = NativeAudio.Load(""); //To warm up the audio circuit we will discard half of the test. for (int i = 0; i < framesOfPlay / 2; i++) { silence.Play(); yield return(null); } //Ok this is the real thing. for (int i = 0; i < framesOfPlay / 2; i++) { sw.Start(); silence.Play(); yield return(null); sw.Stop(); allTicks.Add(sw.ElapsedTicks); sw.Reset(); } analysisResult = new NativeAudioAnalyzerResult() { averageFps = 1000 / TicksToMs(allTicks.Average()) }; analyzeRoutine = null; UnityEngine.Debug.Log("Built in analyze end"); }