Changes the current play speed to a specified rate.
DWORD vceSetPlaySpeed ( CTAHD ctahd, unsigned speed)
|
Argument |
Description |
|
ctahd |
Handle returned by ctaCreateContext or ctaAttachContext. |
|
speed |
The new speed, expressed as a percentage, where 100 is normal speed. |
|
Return value |
Description |
|
SUCCESS |
|
|
CTAERR_INVALID_CTAHD |
Context handle is invalid. |
|
CTAERR_SVR_COMM |
Server communication error. |
vceSetPlaySpeed changes the speed (rate) of message playback. The speed is expressed in hundredths of normal speed. For example, to change the speed to 160 percent of normal, set the speed value to 160.
Note: This functionality is not implemented for the PacketMedia HMP process.
The new speed is stored in the current context that ctahd identified. If play is currently active, the change takes effect immediately. To start the next play with the current speed, set the play speed parameter on the next play to VCE_CURRENT_VALUE.
Use vceGetContextInfo to get the current speed value.
The actual playback speed may not be the same as the value of the current speed in the context. The ability to change playback speed depends on the capabilities of the hardware and may not be the same for all encodings. The maximum speed is also limited by the value of the maxspeed play parameter.
Refer to Playing for more information.
Speed control is available for the NMS ADPCM encodings (VCE_ENCODE_NMS_xxx) and the OKI ADPCM encodings (VCE_ENCODE_OKI_xxx).
If you are using an AG or a CG board to enable speed control of NMS encodings, refer to the DSP files section of the ADI Service Developer's Reference Manual for more information.
/*
* Play a message where digit '6' changes to double speed and digit 4
* restores normal speed. Any other digit stops play. The function returns
* the reason for stopping.
*/
extern CTAHD Ctahd;
extern CTAQUEUEHD CtaQueueHd;
void myPlay(VCEHD vh, unsigned message)
{
CTA_EVENT event;
VCE_PLAY_PARMS parms;
BOOL done = FALSE;
char digit ;
/* Modify default play parms to allow speed up and to not abort
* on digits 4 or 6.
*/
ctaGetParms (Ctahd, VCE_PLAY_PARMID, &parms, sizeof parms);
parms.maxspeed = 200;
parms.DTMFabort = VCE_DIGIT_ANY & ~(VCE_DIGIT_4 | VCE_DIGIT_6);
vcePlayMessage (vh, message, &parms);
do
{
ctaWaitEvent (CtaQueueHd, &event, CTA_WAIT_FOREVER);
if (event.id == ADIEVN_DIGIT_BEGIN)
{
if (event.value == '4')
vceSetPlaySpeed (Ctahd, 100);
else if (event.value == '6')
vceSetPlaySpeed (Ctahd, 200);
adiGetDigit (Ctahd, &digit); /* Remove and discard the digit */
}
} while (event.id != VCEEVN_PLAY_DONE);
}