diff --git a/Cavern/Utilities/WaveformUtils.cs b/Cavern/Utilities/WaveformUtils.cs index 41a7d277..09d518a3 100644 --- a/Cavern/Utilities/WaveformUtils.cs +++ b/Cavern/Utilities/WaveformUtils.cs @@ -28,8 +28,13 @@ public static unsafe void ClearChannel(float[] signal, int channel, int channels /// Apply a delay of a given number of on a . /// public static void Delay(float[] waveform, int samples) { - Array.Copy(waveform, 0, waveform, samples, waveform.Length - samples); - Array.Clear(waveform, 0, samples); + int count = waveform.Length - samples; + if (count > 0) { + Array.Copy(waveform, 0, waveform, samples, count); + Array.Clear(waveform, 0, samples); + } else { + Array.Clear(waveform, 0, waveform.Length); + } } ///