public void Write(float[] left_buffer, float[] right_buffer) { CrossPlatformHelper.Assert(channels == 2, "Mismatched channels! Output expects : " + channels + " channels."); if (left_buffer == null || right_buffer == null) { throw new ArgumentException("One or more input buffers were null!"); } Write(WaveHelper.GetRawData(left_buffer, right_buffer, bits)); }
protected PcmData(int bits, byte[] pcmData, bool isDataInLittleEndianFormat) { bytes = (byte)(bits / 8); if (pcmData.Length % bytes != 0) { throw new Exception("Invalid PCM format. The PCM data was an invalid size."); } data = pcmData; length = data.Length / bytes; if (BitConverter.IsLittleEndian != isDataInLittleEndianFormat) { WaveHelper.SwapEndianess(data, bits); } }
public void Write(float[][] buffer) { Write(WaveHelper.ConvertToPcm(buffer, bits)); }