vceSetCurrentList

Defines the current message to be a list of messages.

Prototype

DWORD vceSetCurrentList ( CTAHD ctahd, VCE_MESSAGE msglist[], unsigned count)

Argument

Description

ctahd

Handle returned by ctaCreateContext or ctaAttachContext.

msglist

Pointer to an array of the VCE_MESSAGE structure:

typedef struct
{
  VCEHD      vh;
  unsigned   message;
} VCE_MESSAGE;

Refer to the Details section for a description of these fields.

count

Number of elements in the msglist array.


Return values

Return value

Description

SUCCESS

 

CTAERR_FUNCTION_ACTIVE

Playing or recording is already active on the context.

CTAERR_INVALID_CTAHD

Context handle is invalid.

CTAERR_INVALID_HANDLE

One or more voice handles is invalid.

CTAERR_SVR_COMM

Server communication error.

VCEERR_INVALID_MESSAGE

One or more message numbers is out of range for the corresponding voice object.

VCEERR_MIXED_ENCODING

Messages have different encoding.


Details

vceSetCurrentList defines the current message for the context that ctahd specified. The current message can be a list of messages that are treated as one contiguous message.

Messages can be in different files or memory blocks but all must have been opened with ctahd as the context and all must have the same encoding.

The VCE_MESSAGE structure contains the following fields:

Field

Description

vh

Handle of an open voice object.

message

Message number in the voice object that vh specified.


To define a single current message, define a list with one element or use vceSetCurrentMessage.

Use vceSetCurrentList to select a message list prior to using the following position-oriented functions: vceSetPosition, vcePlay, and vceRead.

If a message in msglist does not exist, vceSetCurrentList returns SUCCESS as long as the message number is one that could exist in the corresponding vh field. If a message is out of range, the function returns VCEERR_INVALID_MESSAGE.

You cannot set the current message while play or record is active.

Use vceGetCurrentList to query the current message.

Example

/* Play digit string from multiple prompt files */

/* This routine starts speaking a digit string */
/* The spoken digits "oh" through "nine" are in message 0 in
 * 10 separate files. The open file handles are in an array vh[] where
 * vh[0] = "oh", vh[1] = "one", etc.
 */

extern CTAHD ctahd;

VCEHD Vh[10];       /* Array of open file handles */

void mySpeakDigitString (char *digits)
{
    VCE_MESSAGE msglist[50];
    unsigned    count;
    CTA_EVENT   event;

    /* Convert the digit string into a list of VCE_MESSAGE structs */
    for (count = 0;
        *digits != '\0' && count < sizeof msglist/sizeof msglist[0];
        digits++)
   {
        if (isdigit(*digits))
        {
            msglist[count].vh      = Vh[*digits - '0'];
            msglist[count].message = 0;
            ++ count;
        }
    }

    vceSetCurrentList(ctahd, msglist, count) ;
    vcePlay (ctahd, VCE_NO_TIME_LIMIT, NULL) ;
    do
    {

       ctaWaitEvent( CtaQueueHd, &event, CTA_WAIT_FOREVER);
    } while (event.id != VCEEVN_PLAY_DONE);/* Ignore other events */
}