Voice Message Service Developer's Reference Manual (6422-12): Alphabetical Function Reference
(Page 24 of 40 in this chapter)
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 CTA context. The current message is defined by vcePlayMessage, vcePlayList, vceRecordMessage, vceSetCurrentMessage, vceSetCurrentList, vceEraseMessage, vceCopyMessage, or vceConvertMessage.
- vcePlay always returns immediately and, if the return is SUCCESS, a VCEEVN_PLAY_DONE event occurs when play completes.
- The VCE_PLAY_PARMS structure contains the following fields:
Note: Refer to Appendix C 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;
}
(Page 24 of 40 in this chapter)
tech_support@nmss.com
Copyright © 1999, Natural MicroSystems, Inc. All rights
reserved.