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


vcePlay

Description

Starts playing from the current position in the current message.

Prototype

DWORD vcePlay ( CTAHD ctahd,
unsigned maxtime,
VCE_PLAY_PARMS *parms)

ctahd Handle returned by ctaCreateContext.

maxtime The maximum amount to play, in milliseconds. Use VCE_NO_TIME_LIMIT to play with no time limit.

parms Pointer to a parameter structure. Set this to NULL to use default values. The VCE_PLAY_PARMS structure is:

typedef struct
{
DWORD size;
DWORD DTMFabort;
INT32 gain;
DWORD speed;
DWORD maxspeed;
} VCE_PLAY_PARMS;
See the Details section for a description of these fields.

Return Values

Events

Details

This function initiates playing from the current position in the current message for the specified context. The current message is defined by vceConvertMessage, vceCopyMessage, vceEraseMessage, vcePlayList, vcePlayMessage, vceRecordMessage, vceSetCurrentList, or vceSetCurrentMessage.

vcePlay always returns immediately. If the return is SUCCESS, a VCEEVN_PLAY_DONE event occurs when play completes.

The VCE_PLAY_PARMS structure contains the following fields:
Field Name

Default

Description

size

sizeof (VCE_PLAY_PARMS)

Size of this structure, in bytes.

DTMFabort

0xffff

Abort on DTMF (bit mask).

gain

0 dB

Playing gain in decibels, or VCE_CURRENT_VALUE to use the most recent gain setting.

speed

100%

Initial speed in percent or VCE_CURRENT_VALUE to use the most recent speed setting.

maxspeed

100%

Maximum play speed in percent.

Note: Refer to Appendix B for more information about the play parameters.

The current position will be advanced by the number of milliseconds actually played. The number of milliseconds played is reported in the size field of the VCEEVN_PLAY_DONE event.

If the current position is already at the end of the current message, vcePlay returns SUCCESS and the DONE event occurs immediately.

This function is useful for resuming play after stopping a message in the middle. Use vceSetPosition to adjust the current position before resuming, for example, if you want to rewind or fast forward.

See Also

vceConvertMessage, vceCopyMessage, vceEraseMessage, vcePlayList, vcePlayMessage, vceSetCurrentList, vceSetCurrentMessage, vceSetPosition, vceStop

Example


/* sample to reposition play

/*
* Play a message, allowing pause, forward, and rewind using digits 8, 9, and 7,
* respectively. Any other digit stops play. The function returns the reason for
* stopping.
*/

extern CTAHD Ctahd;
extern CTAQUEUEHD CtaQueueHd;

int myFancyPlay(VCEHD vh, unsigned message)
{
BOOL done = FALSE;
BOOL paused = FALSE;
CTA_EVENT event;
char digit;

vcePlayMessage (vh, message, NULL);
while (!done)
{
ctaWaitEvent( CtaQueueHd, &event, CTA_WAIT_FOREVER);
if (event.id == VCEEVN_PLAY_DONE)
{
if (event.value == CTA_REASON_DIGIT)
{
adiPeekDigit(Ctahd, &digit);
switch (digit)
{
case `7': /* Rewind 2 seconds */
vceSetPosition (Ctahd, -2000, VCE_SEEK_CUR, NULL);
break;
case `8': /* Toggle pause */
paused = !paused;
break;
case `9': /* Forward 2 seconds */
vceSetPosition (Ctahd, 2000, VCE_SEEK_CUR, NULL);
break;
default:
done = TRUE;
break;
} if (!done) {

/* Remove and discard the digit */
adiGetDigit (Ctahd, &digit);

if (!paused)
vcePlay(Ctahd, VCE_NO_TIME_LIMIT, NULL);
}
}
else
done = TRUE;
}
/* Ignore other events */
}
return event.value;
}


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