Skip to content

Commit

Permalink
ScannerTools constructor has list of patches as parameter #2
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriiKh committed Sep 1, 2020
1 parent 0b04ac6 commit d71cb1d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CarefulAudioRepair/Data/Channel - Copy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public Patch[] GetAllPatches()
/// <returns>Value.</returns>
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();

Expand Down
11 changes: 10 additions & 1 deletion CarefulAudioRepair/Data/PatchCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,17 @@ internal class PatchCollection : IDisposable

private int[] startPositions;

public PatchCollection()
public PatchCollection(List<AbstractPatch> patches = null)
{
if (patches is null)
{
return;
}

foreach (var patch in patches)
{
this.patchCollection.Add(patch);
}
}

public bool Finalized { get; private set; } = false;
Expand Down
8 changes: 6 additions & 2 deletions CarefulAudioRepair/Processing/ScannerTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Copyright (c) Dmitrii Khrustalev. All rights reserved.
// </copyright>

using System.Collections.Generic;

namespace CarefulAudioRepair.Processing
{
using System;
Expand All @@ -22,9 +24,11 @@ internal class ScannerTools : IDisposable
/// </summary>
/// <param name="inputSamples">Input audio samples.</param>
/// <param name="settings">Settings for processing audio.</param>
public ScannerTools(ImmutableArray<double> inputSamples, IAudioProcessingSettings settings)
/// <param name="patches"></param>
public ScannerTools(ImmutableArray<double> inputSamples, IAudioProcessingSettings settings,
List<AbstractPatch> patches = null)
{
this.PatchCollection = new PatchCollection();
this.PatchCollection = new PatchCollection(patches);

this.Input = inputSamples;

Expand Down

0 comments on commit d71cb1d

Please sign in to comment.