AudioCompressionManagerToPcm Method |
Helper for decoding audio data in PCM (Pulse-code modulation).
Namespace: Alvas.AudioAssembly: Alvas.Audio (in Alvas.Audio.dll) Version: 2016.0.6173.41573
Syntax public static void ToPcm(
IntPtr format,
byte[] data,
ref IntPtr formatPcm,
ref byte[] dataPcm
)
Public Shared Sub ToPcm (
format As IntPtr,
data As Byte(),
ByRef formatPcm As IntPtr,
ByRef dataPcm As Byte()
)
public:
static void ToPcm(
IntPtr format,
array<unsigned char>^ data,
IntPtr% formatPcm,
array<unsigned char>^% dataPcm
)
Parameters
- format
- Type: SystemIntPtr
input audio format - data
- Type: SystemByte
input audio data - formatPcm
- Type: SystemIntPtr
output audio format - dataPcm
- Type: SystemByte
output audio data
Examples This example shows simple using of ToPcm method.
string fileName = @"in.wav";
WaveReader wr = new WaveReader(File.OpenRead(fileName));
IntPtr formatWav = wr.ReadFormat();
byte[] data = wr.ReadData();
wr.Close();
IntPtr formatPcm = IntPtr.Zero;
byte[] dataPcm = null;
AudioCompressionManager.ToPcm(formatWav, data, ref formatPcm, ref dataPcm);
WaveWriter ww = new WaveWriter(File.Create(fileName + ".wav"), AudioCompressionManager.FormatBytes(formatPcm));
ww.WriteData(dataPcm);
ww.Close();
See Also