Copyright © 2006-2018 MultiMedia Soft

EncodeFormats.ACM.SetCodecFormatWavData method

Previous pageReturn to chapter overviewNext page



Sets the WAVEFORMATEX data structure including any extra-byte the specific format may require.

This method is useful for setting the WAV format of an ACM codec without the need to visually enumerate codecs currently installed on the target PC and is used for recording, CD ripping and exporting sessions when the EncodeFormats.ACM.EncodeMode property is set to ACM_ENCODE_USE_WAV_FORMAT.


The WAVEFORMATEX structure, common to all waveform-audio formats, is defined inside the Microsoft SDK as follows:

typedef struct {

 WORD  wFormatTag;

 WORD  nChannels;

 DWORD nSamplesPerSec;

 DWORD nAvgBytesPerSec;

 WORD  nBlockAlign;

 WORD  wBitsPerSample;

 WORD  cbSize;


The cbSize member defines how many extra-bytes, specific for the needed codec, are appended to the end of the WAVEFORMATEX structure.


It's important to note that further encoding through the downloaded WAV format will not work if the specific codec is not installed on the target PC.


For further details about the Windows Audio Compression Manager refer to the EncodeACM class section.

For a tutorial about the use of the Windows Audio Compression Manager refer to the How to use the Windows Audio Compression Manager section.

For further information about available encoding formats see the EncodeFormatsMan class.





[Visual Basic]

Public Function SetCodecFormatWavData (

pWavData() as Byte,

sizeWavData as Int32

) as enumErrorCodes



public enumErrorCodes SetCodecFormatWavData (

byte [] pWavData,

Int32 sizeWavData




public: enumErrorCodes SetCodecFormatWavData (

unsigned char __gc[] pWavData,

Int32 sizeWavData









Memory buffer that, on exit from the method's call, will contain the given codec's format description: this buffer should be allocated through a global variable in order to avoid becoming invalid when the variable will go out of scope.


The size in bytes of the WAVEFORMATEX data structure, including any extra-byte the specific format may require




Return value






Negative value

An error occurred, check the LastError property value in order to get the error code

enumErrorCodes.ERR_NOERROR (0)

The method call was successful