From d71cb1daf4aa232e0baac6f0f5e5915a0f0ec0f6 Mon Sep 17 00:00:00 2001 From: Dmitry Khrustalev Date: Tue, 1 Sep 2020 10:35:13 -0300 Subject: [PATCH] ScannerTools constructor has list of patches as parameter #2 --- .../CarefulAudioRepair/CarefulAudioRepair.xml | 3 ++- CarefulAudioRepair/Data/Channel - Copy.cs | 2 +- CarefulAudioRepair/Data/PatchCollection.cs | 11 ++++++++++- CarefulAudioRepair/Processing/ScannerTools.cs | 8 ++++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CarefulAudioRepair/CarefulAudioRepair/CarefulAudioRepair/CarefulAudioRepair.xml b/CarefulAudioRepair/CarefulAudioRepair/CarefulAudioRepair/CarefulAudioRepair.xml index 63da06b..eae8faf 100644 --- a/CarefulAudioRepair/CarefulAudioRepair/CarefulAudioRepair/CarefulAudioRepair.xml +++ b/CarefulAudioRepair/CarefulAudioRepair/CarefulAudioRepair/CarefulAudioRepair.xml @@ -1109,12 +1109,13 @@ Contains a set of objects to support the Scanner class. - + Initializes a new instance of the class. Input audio samples. Settings for processing audio. + diff --git a/CarefulAudioRepair/Data/Channel - Copy.cs b/CarefulAudioRepair/Data/Channel - Copy.cs index 8ec35a5..63da3d5 100644 --- a/CarefulAudioRepair/Data/Channel - Copy.cs +++ b/CarefulAudioRepair/Data/Channel - Copy.cs @@ -113,7 +113,7 @@ public Patch[] GetAllPatches() /// Value. public double GetOutputSample(int position) { - var tools = new ScannerTools(this.inputImmutable, this.settings); + var tools = new ScannerTools(this.inputImmutable, this.settings, this.patches); var outputSample = tools.InputPatcher.GetValue(position); tools.Dispose(); diff --git a/CarefulAudioRepair/Data/PatchCollection.cs b/CarefulAudioRepair/Data/PatchCollection.cs index 411c523..102eff5 100644 --- a/CarefulAudioRepair/Data/PatchCollection.cs +++ b/CarefulAudioRepair/Data/PatchCollection.cs @@ -19,8 +19,17 @@ internal class PatchCollection : IDisposable private int[] startPositions; - public PatchCollection() + public PatchCollection(List patches = null) { + if (patches is null) + { + return; + } + + foreach (var patch in patches) + { + this.patchCollection.Add(patch); + } } public bool Finalized { get; private set; } = false; diff --git a/CarefulAudioRepair/Processing/ScannerTools.cs b/CarefulAudioRepair/Processing/ScannerTools.cs index 54ca805..f6beef1 100644 --- a/CarefulAudioRepair/Processing/ScannerTools.cs +++ b/CarefulAudioRepair/Processing/ScannerTools.cs @@ -2,6 +2,8 @@ // Copyright (c) Dmitrii Khrustalev. All rights reserved. // +using System.Collections.Generic; + namespace CarefulAudioRepair.Processing { using System; @@ -22,9 +24,11 @@ internal class ScannerTools : IDisposable /// /// Input audio samples. /// Settings for processing audio. - public ScannerTools(ImmutableArray inputSamples, IAudioProcessingSettings settings) + /// + public ScannerTools(ImmutableArray inputSamples, IAudioProcessingSettings settings, + List patches = null) { - this.PatchCollection = new PatchCollection(); + this.PatchCollection = new PatchCollection(patches); this.Input = inputSamples;