/// <summary> /// Scans channel to find damaged samples /// </summary> /// <param name="audioData"></param> /// <param name="progress"></param> /// <param name="status"></param> /// <returns></returns> private static async Task ProcessChannelAsync( AudioData audioData, IProgress <double> progress, IProgress <string> status) { var historyLengthSamples = audioData.AudioProcessingSettings.HistoryLengthSamples; SetStatus(audioData, status, "preprocessing"); if (audioData.CurrentChannelIsPreprocessed()) { // if prediction errors were previously calculated audioData.RestoreCurrentChannelPredErrors(); } else { CalculateBurgPredictionErrCpu(audioData, progress); audioData.SetCurrentChannelIsPreprocessed(); audioData.BackupCurrentChannelPredErrors(); } for (var index = 0; index < historyLengthSamples + 16; index++) { audioData.SetErrorAverage(index, 0.001F); } HelperCalculator.CalculateErrorAverageCpu( audioData, historyLengthSamples, audioData.LengthSamples(), historyLengthSamples); status.Report(""); // copies input samples to output before scanning for (var index = 0; index < audioData.LengthSamples(); index++) { audioData.SetOutputSample(index, audioData.GetInputSample(index)); } SetStatus(audioData, status, "scanning"); await Task.Run(() => ScanAudioAsync(audioData, progress)); status.Report(""); }