vceCopyMessage

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

Prototype

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

Argument

Description

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

Return value

Description

SUCCESS

 

CTAERR_DISK_FULL

There is not enough room on the disk to complete the write operation. No data was written.

CTAERR_FILE_READ_FAILED

File system error.

CTAERR_FILE_WRITE_FAILED

File system error.

CTAERR_FUNCTION_ACTIVE

Playing or recording is active on the context.

CTAERR_INVALID_HANDLE

A voice handle is invalid, or source and destination message numbers belong to different contexts.

CTAERR_SVR_COMM

Server communication error.

VCEERR_INVALID_MESSAGE

Source or destination message number is invalid for file format type.

VCEERR_NO_SPACE

Insufficient room in the destination message.

VCEERR_OUT_OF_INDICES

No free header entries in the destination VOX file.

VCEERR_PLAY_ONLY

Destination voice file is not open for record.


Details

vceCopyMessage 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 is replaced.

Source and destination voice objects must belong to the same context. The destination voice object must be open for record. The destination message becomes the current message in the 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 is 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 setting replaces all messages in the destination voice object, not just messages that exist in the source voice object.

To copy message text associated with a voice message, use vceCopyMessageText.

See also

vceConvertMessage

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);

}