Table of Contents Index NMS Glossary Previous Page Next Page (Page 21 of 41 in this chapter) Version


vceGetWaveInfo

Description

Gets wave header information for a given encoding value.

Prototype

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

ctahd Handle returned by ctaCreateContext.

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;
The fields are described in the Details section.

size Size in bytes of the waveinfo buffer.

Return Values

Events

Details

This function retrieves information from the Voice Message service's WAVE information table for a specified encoding. The Voice Message service maintains a table that maps encoding values to WAVE file header information. This is used by vceCreateFile to create a new WAVE file and by vceOpenFile 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. New entries may be added with vceSetWaveInfo.

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

The number of discrete channels in the format. Use 1 for mono and 2 for stereo.

samplespersec

The sample rate in samples per second.

datarate

Average bytes per second.

blockalign

The 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.

See Also

vceCreateFile, vceOpenFile, vceSetWaveInfo

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


Table of Contents Index NMS Glossary Previous Page Next Page (Page 21 of 41 in this chapter) Version


Want to send us feedback on our documentation? Email: Tech_Pubs@nmss.com
Copyright © 2001, Natural MicroSystems, Inc. All rights reserved.