AudioCompressionManagerSplitStereo Method (IntPtr, Byte, IntPtr, Byte, Byte) |
Namespace: Alvas.Audio
public static void SplitStereo( IntPtr formatStereo, byte[] dataStereo, ref IntPtr formatMono, ref byte[] leftData, ref byte[] rightData )
string inFile = "stereo.wav"; string leftFile = "left.wav"; string rightFile = "right.wav"; WaveReader wr = new WaveReader(File.OpenRead(inFile)); IntPtr formatStereo = wr.ReadFormat(); byte[] dataStereo = wr.ReadData(); wr.Close(); IntPtr formatMono = IntPtr.Zero; byte[] leftData = null; byte[] rightData = null; AudioCompressionManager.SplitStereo(formatStereo, dataStereo, ref formatMono, ref leftData, ref rightData); byte[] headerMono = AudioCompressionManager.FormatBytes(formatMono); WaveWriter wwLeft = new WaveWriter(File.Create(leftFile), headerMono); wwLeft.WriteData(leftData); wwLeft.Close(); WaveWriter wwRight = new WaveWriter(File.Create(rightFile), headerMono); wwRight.WriteData(rightData); wwRight.Close();