# vceGetWaveInfo

Returns wave header information for a given encoding value.

#### Prototype

DWORD vceGetWaveInfo ( CTAHD ctahd, unsigned encoding, VCE_WAVE_INFO *waveinfo, unsigned size)

Argument | Description
ctahd | Handle returned by ctaCreateContext or ctaAttachContext.
encoding | Encoding ID (for example, VCE_ENCODE_NMS_24).
waveinfo | Pointer to the buffer to receive the following VCE_WAVE_INFO structure: typedef struct { DWORD size; WORD format; WORD nchannels; DWORD samplespersec; DWORD datarate; WORD blocksize; DWORD bitspersample; } VCE_ WAVE_INFO; Refer to the Details section for a description of these fields.
size | Size in bytes of the waveinfo buffer.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_SIZE | size is less than the size of DWORD.
CTAERR_NOT_FOUND | No wave information found for specified encoding.
CTAERR_INVALID_CTAHD | Context handle is invalid.
CTAERR_SVR_COMM | Server communication error.

#### Details

vceGetWaveInfo returns information from the Voice Message service WAVE information table for a specified encoding. The Voice Message service maintains a table that maps encoding values to WAVE file header information. vceCreateFile uses this information to create a new WAVE file, and vceOpenFile uses it to determine the encoding of the file. For more information about WAVE files, refer to the Microsoft Windows Multimedia Programmer's Reference.

The table initially contains compiled-in entries for known encodings. Use vceSetWaveInfo to add new entries.

The VCE_WAVE_INFO structure contains the following fields:

Field | Description
--- | ---
size | Size of the structure, in bytes. This is set to: sizeof (VCE_WAVE_INFO)
format | The WAVE format type as defined by Microsoft. For example, WAVE_FORMAT_PCM (defined in the Microsoft header file mmreg.h).
nchannels | Number of discrete channels in the format. Use 1 for mono and 2 for stereo.
samplespersec | Sample rate in samples per second.
datarate | Average bytes per second.
blocksize | Minimum block size of the data. For PCM data, the block size is the number of bytes in a single sample.
bitspersample | Number of bits per sample.

#### Example

/* Display contents of WAVE info table */
/* Sample output:
*
* Encoding Wave Type M/S SampleRate DataRate Block Bits
* ----------------------------------------------------------
* 1 56 M 8000 2100 42 2
*/
void myShowWaveInfo (CTAHD ctahd)
{
unsigned encoding;
VCE_WAVE_INFO waveinfo;
printf("Encoding Wave Type M/S" " SampleRate DataRate Block Bits\n");
printf("------------------------" "----------------------------------\n");
for (encoding = 0; encoding < 256; encoding ++)
{
if (vceGetWaveInfo(ctahd,encoding,&waveinfo,sizeof waveinfo)!= SUCCESS)
continue;
printf(" %3d %3d %c" " %6d %6d %3d %2d\n",
encoding,
waveinfo.format,
waveinfo.nchannels == 1 ? 'M' : 'S',
waveinfo.samplespersec,
waveinfo.datarate,
waveinfo.blocksize,
waveinfo.bitspersample); }
}

#### Sample run

Encoding Wave Type M/S SampleRate DataRate Block Bits
----------------------------------------------------------
1 56 M 8000 2100 42 2
2 56 M 8000 3100 62 3
3 56 M 8000 4100 82 4
4 56 M 8000 8200 162 8
10 7 M 8000 8000 1 8
11 6 M 8000 8000 1 8
13 1 M 8000 16000 2 16
14 23 M 6000 3000 1 4
15 23 M 8000 4000 1 4
16 1 M 11025 11025 1 8
17 1 M 11025 22050 2 16
22 17 M 6000 6600 244 4
23 17 M 8000 8800 244 4