namespace NAudio.Utils { /// /// Helper methods for working with audio buffers /// public static class BufferHelpers { /// /// Ensures the buffer is big enough /// /// /// /// public static byte[] Ensure(byte[] buffer, int bytesRequired) { if (buffer == null || buffer.Length < bytesRequired) { buffer = new byte[bytesRequired]; } return buffer; } /// /// Ensures the buffer is big enough /// /// /// /// public static float[] Ensure(float[] buffer, int samplesRequired) { if (buffer == null || buffer.Length < samplesRequired) { buffer = new float[samplesRequired]; } return buffer; } } }