(Page 6 of 40 in this chapter)


vceCopyMessage

Description

Copies a message from one voice object to another voice object.

Prototype

DWORD vceCopyMessage ( VCEHD srcvh,
unsigned srcmsg,
VCEHD destvh,
unsigned destmsg)

srcvh Voice handle of source file or memory block.

srcmsg Source message number.

destvh Voice handle of destination file or memory block.

destmsg Destination message number.

Return Values

Events

Details

This function copies the srcmsg in the voice object denoted by srcvh to the destination message in the voice object denoted by destvh. It creates or replaces the message in a destination voice object with a copy of the message in the source voice object. If destmsg already exists, it will be replaced.

Source and destination voice objects must belong to the same CTA context. The destination voice object must have been opened for record. The destination message becomes the current message in the CTA context. srcvh and destvh can be the same.

Source and destination message numbers must be valid for their respective file types.

Note: If the source message has zero (0) size, the destination size will be set to zero (0). This is equivalent to erasing the destination message.

To copy all messages from the source to the destination, set source and destination message numbers to VCE_ALL_MESSAGES. This replaces all messages in the destination voice object , not just messages that exist in the source voice object.

If you want to copy a voice message, use vceCopyMessage. If you want to copy message text associated with a voice message, use vceCopyMessageText.

See Also

vceConvertMessage, vceCopyMessageText

Example


/*
* Copy .VOX file to a new one. The copy operation removes any fragmentation that
* might exist as a result of editing.
*/

void myCopyVoxFile (CTAHD ctahd, char *destfile, char *srcfile)
{
VCEHD srcvh, destvh;
VCE_OPEN_INFO openinfo;
VCE_CREATE_VOX voxcreate;
unsigned highmsg;

/* Open file, get encoding */
vceOpenFile (ctahd, srcfile, VCE_FILETYPE_VOX, VCE_PLAY_ONLY, 0, srcvh);
vceGetOpenInfo (srcvh, &openinfo, sizeof openinfo);

/* Create a file with enough indices to accommodate growth */
vceGetHighMessageNumber (srcvh, &highmsg);
voxcreate.maxindex = 2 * highmsg + 100;
voxcreate.size = sizeof voxcreate;
vceCreateFile (ctahd, destfile, VCE_FILETYPE_VOX,
openinfo.encoding, &voxcreate, &destvh);

/* Copy all messages */
vceCopyMessage(srcvh, VCE_ALL_MESSAGES, destvh, VCE_ALL_MESSAGES);

/* Close files */
vceClose(destvh);
vceClose(srcvh);
}


(Page 6 of 40 in this chapter)


tech_support@nmss.com
Copyright © 1999, Natural MicroSystems, Inc. All rights reserved.