Voice Message Service Developer's Reference Manual (6422-12): Alphabetical Function Reference
(Page 9 of 40 in this chapter)
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:
- 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;
}
(Page 9 of 40 in this chapter)
tech_support@nmss.com
Copyright © 1999, Natural MicroSystems, Inc. All rights
reserved.