Records a message in an open voice object.
DWORD vceRecordMessage ( VCEHD vh, unsigned message, unsigned maxtime, VCE_RECORD_PARMS *parms)
|
Argument |
Description |
|
vh |
Handle of an open voice object. |
|
message |
Message number to record. |
|
maxtime |
Maximum amount to record, in milliseconds. Specify VCE_NO_TIME_LIMIT to record with no time limit. |
|
parms |
Pointer to a parameter structure. Set this to NULL to use default values. The VCE_RECORD_PARMS structure is: typedef struct Refer to VCE_RECORD_PARMS for a description of these fields. |
|
Return value |
Description |
|
SUCCESS |
|
|
CTAERR_FUNCTION_ACTIVE |
Playing or recording is already active on the context. |
|
CTAERR_INVALID_HANDLE |
vh is not a valid handle to an open voice object. |
|
CTAERR_OUTPUT_ACTIVE |
Another function is controlling the MVIP output timeslot of the context. |
|
CTAERR_RESOURCE_CONFLICT |
Energy detector is in use in the ADI Service. |
|
CTAERR_SVR_COMM |
Server communication error. |
|
VCEERR_INVALID_MESSAGE |
Message number is out of range for the object. |
|
VCEERR_OUT_OF_INDICES |
No free header entries in the destination VOX file. |
|
VCEERR_PLAY_ONLY |
Voice file was not opened for record. |
|
Event |
Description |
|
VCEEVN_RECORD_DONE |
Recording completed. The value field of the event contains one of the following reasons or an error code: CTA_REASON_DIGIT CTA_REASON_FINISHED CTA_REASON_NO_VOICE CTA_REASON_RELEASED CTA_REASON_STOPPED CTA_REASON_TIMEOUT CTA_REASON_VOICE_END CTAERR_FUNCTION_NOT_AVAIL CTAERR_RESOURCE_CONFLICT |
vceRecordMessage starts recording to the specified message number in the voice object that vh specified. Any existing data in the message is erased. vceRecordMessage always returns immediately. If the return is SUCCESS, a VCEEVN_RECORD_DONE event occurs when recording completes.
After recording ends, call vceGetContextInfo to get the number of milliseconds actually recorded and look in the position field of the status.
The voice handle and message number become the current message for the context in which the voice handle was opened. After recording stops, you can resume recording at the end of the current message with vceRecord. Refer to Recording for more information.
To trim data at the end of the recording:
Use vceSetPosition to back up the desired amount.
Use vceErase to erase data to the end of the message.
When the ADI energy detector is active, initiate a record operation (which uses the ADI Service) by setting novoicetime and silencetime to zero.
Refer to VCE_RECORD_PARMS for more information about the record parameters.
/* Record to an existing VOX file. */
extern CTAQUEUEHD CtaQueueHd;
void myRecordFile (CTAHD ctahd, char *filename, unsigned msgnum)
{
VCEHD vh;
CTA_EVENT event;
vceOpenFile (ctahd, filename, VCE_FILETYPE_VOX,
VCE_PLAY_RECORD, 0, &vh) ;
vceRecordMessage (vh, msgnum, VCE_NO_TIME_LIMIT, NULL) ;
do
{
ctaWaitEvent( CtaQueueHd, &event, CTA_WAIT_FOREVER);
} while (event.id != VCEEVN_RECORD_DONE);/* Ignore other events */
vceClose (vh);
}