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


vceDefineMessages

Description

Defines messages in a flat (unformatted) file or memory block.

Prototype

DWORD vceDefineMessages ( VCEHD vh,
VCE_SEGMENT segments[],
unsigned msgcount)

vh Handle of an open voice object.

segments Pointer to an array of VCE_SEGMENT structures. Each element defines the corresponding message number. The VCE_SEGMENT structure is:

typedef struct
{
unsigned offset;
unsigned size;
} VCE_SEGMENT;
See the Details section for a description of these fields.

msgcount Number of elements in the segments array.

Return Values

E vents

Details

This function defines multiple messages in the file or memory block specified by vh. This function tells the Voice Message service how the file or memory is partitioned.

The VCE_SEGMENT structure contains the following fields:
Field

Description

offset

Starting offset in bytes from the beginning of the file or memory block.

size

Number of bytes in the message.

To skip a message number, set both offset and size to zero (0) in the element of the segments array indexed by the message number.

Messages must not overlap one another or extend beyond the size of the file or memory block.

See Also

vceOpenFile, vceOpenMemory

Example


/*
* Open a file that contains a simple header, then assign message numbers to
* segments of the file.
*
* Assume the file's header structure is:
* unsigned count = number of messages
* unsigned encoding = voice encoding of all messages
* VCE_SEGMENT msg[count] = array of "count" structures
* containing offset and size
*/

extern CTAHD CtaHd;

void myOpen (char *filename, VCEHD *returnedvh)
{
FILE *filep;
unsigned msgcount;
unsigned encoding;
VCE_SEGMENT *segments;
VCEHD vh;

/* Read the count, allocate a buffer, read the msg list */
filep = fopen (filename, "rb");
fread (&msgcount, sizeof msgcount, 1, filep);
fread (&encoding, sizeof encoding, 1, filep);
segments = malloc (msgcount * sizeof (VCE_SEGMENT));
fread (segments, sizeof (VCE_SEGMENT), msgcount, filep);
fclose (filep);

/* Re-open the file with VCE and define the messages */
vceOpenFile (CtaHd, filename, VCE_FILETYPE_FLAT, VCE_PLAY_ONLY,
encoding, &vh);
vceDefineMessages (vh, segments, msgcount);
*returnedvh = vh;
}


Table of Contents Index NMS Glossary Previous Page Next Page (Page 10 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.