(Page 35 of 41 in this chapter) Version
vceSetPlaySpeed
Description
- Changes the current play speed to a specified rate.
Prototype
- DWORD vceSetPlaySpeed ( CTAHD ctahd,
unsigned speed)
- ctahd Handle returned by ctaCreateContext.
- speed The new speed, expressed as a percentage amount, where 100 is normal speed.
Return Values
Events
Details
- This function changes the speed (rate) of message playback. The speed is expressed in hundredths of normal speed. For example, to change the speed to 160% of normal, the speed value would be 160.
- The new speed is stored in the current context identified by ctahd. 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 will also be limited by the value of the maxspeed play parameter.
- Speed control is available for the NMS ADPCM encodings (VCE_ENCODE_NMS_xxx) and the OKI ADPCM encodings (VCE_ENCODE_OKI_xxx).
Note: If you are using an AG board to enable speed control of NMS encodings, refer to the DSP Files appendix in the ADI Service Function Reference Manual for more information.
See Also
- vceGetContextInfo
, vceSetPlayGain
Example
/*
* 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);
}
(Page 35 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.