(Page 25 of 41 in this chapter) Version
typedef struct
{
DWORD size;
DWORD DTMFabort;
INT32 gain;
DWORD speed;
DWORD maxspeed;
} VCE_PLAY_PARMS;
/* 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 25 of 41 in this chapter) Version