VoxRaw2Vox Method |
Namespace: Alvas.Audio
[Missing <param name="br"/> documentation for "M:Alvas.Audio.Vox.Raw2Vox(System.IO.BinaryReader,System.IO.BinaryWriter,System.Int16)"]
[Missing <param name="bw"/> documentation for "M:Alvas.Audio.Vox.Raw2Vox(System.IO.BinaryReader,System.IO.BinaryWriter,System.Int16)"]
[Missing <param name="bitsPerSample"/> documentation for "M:Alvas.Audio.Vox.Raw2Vox(System.IO.BinaryReader,System.IO.BinaryWriter,System.Int16)"]
private static void Decode2Pcm(ref IntPtr format, ref byte[] data, ref WaveFormat wf) { IntPtr newFormat = AudioCompressionManager.GetCompatibleFormat(format, AudioCompressionManager.PcmFormatTag); byte[] buffer = AudioCompressionManager.Convert(format, newFormat, data, false); wf = AudioCompressionManager.GetWaveFormat(newFormat); format = newFormat; data = buffer; } public static void Raw2VoxTest() { string inFile = "in.wav"; string outFile = "out.vox"; WaveReader wr = new WaveReader(File.OpenRead(inFile)); IntPtr format = wr.ReadFormat(); byte[] data = wr.ReadData(); wr.Close(); WaveFormat wf = AudioCompressionManager.GetWaveFormat(format); if (wf.wFormatTag != AudioCompressionManager.PcmFormatTag)//Decode if not PCM data { Decode2Pcm(ref format, ref data, ref wf); } BinaryWriter bw = new BinaryWriter(File.OpenWrite(outFile)); BinaryReader br = new BinaryReader(new MemoryStream(data)); Vox.Raw2Vox(br, bw, wf.wBitsPerSample); br.Close(); bw.Close(); }