Skip to content

Commit 164b3db

Browse files
committed
add an additional optional argument to manually init newAudio with an external List<double>
1 parent f313dc1 commit 164b3db

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Spectrogram/SpectrogramGenerator.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ public class SpectrogramGenerator
2525

2626
private readonly Settings settings;
2727
private readonly List<double[]> ffts = new List<double[]>();
28-
private readonly List<double> newAudio = new List<double>();
28+
private readonly List<double> newAudio;
2929
private Colormap cmap = Colormap.Viridis;
3030

3131
public SpectrogramGenerator(int sampleRate, int fftSize, int stepSize,
3232
double minFreq = 0, double maxFreq = double.PositiveInfinity,
33-
int? fixedWidth = null, int offsetHz = 0)
33+
int? fixedWidth = null, int offsetHz = 0, List<double> initialAudioList = null)
3434
{
3535
settings = new Settings(sampleRate, fftSize, stepSize, minFreq, maxFreq, offsetHz);
3636

37+
newAudio = initialAudioList ?? new List<double>();
38+
3739
if (fixedWidth.HasValue)
3840
SetFixedWidth(fixedWidth.Value);
3941
}

0 commit comments

Comments
 (0)