vceRecord

Starts recording at the current position in the current message.

Prototype

DWORD vceRecord ( CTAHD ctahd, unsigned maxtime, unsigned insertmode, VCE_RECORD_PARMS *parms)

Argument

Description

ctahd

Handle returned by ctaCreateContext or ctaAttachContext.

maxtime

Maximum amount to record, in milliseconds. Specify VCE_NO_TIME_LIMIT to record with no time limit.

insertmode

VCE_OVERWRITE or VCE_INSERT.

parms

Pointer to a parameter structure. Set this to NULL to use default values. The VCE_RECORD_PARMS structure is:

typedef struct
{
  DWORD size;
  DWORD DTMFabort;
  INT32 gain;
  DWORD novoicetime;
  DWORD silencetime;
  INT32 silenceampl;
  DWORD beepfreq;
  INT32 beepampl;
  DWORD beeptime;
  DWORD AGCenable;
} VCE_RECORD_PARMS;

Refer to VCE_RECORD_PARMS for a description of these fields.


Return values

Return value

Description

SUCCESS

 

CTAERR_FUNCTION_ACTIVE

Playing or recording is already active on the context.

CTAERR_INVALID_CTAHD

Context handle is invalid.

CTAERR_OUTPUT_ACTIVE

Another function is controlling the MVIP output timeslot associated with the context.

CTAERR_RESOURCE_CONFLICT

Energy detector is in use in the ADI service.

CTAERR_SVR_COMM

Server communication error.

VCEERR_INVALID_OPERATION

Insertion anywhere except at the end of a message is not supported by the file type of the current message. The operation is also invalid if the current message is a list.

VCEERR_NO_MESSAGE

No current message in the context.

VCEERR_OUT_OF_INDICES

No free header entries in the destination VOX file.

VCEERR_PLAY_ONLY

Voice file was not opened for record.


Events

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
Touch-tone digit was received and the corresponding bit in the DTMF abort parameter was set.

CTA_REASON_FINISHED
No more space is available or recording in overwrite mode reached the end of the existing message.

CTA_REASON_NO_VOICE
No voice detected for novoicetime milliseconds at the beginning of recording.

CTA_REASON_RELEASED
Stopped because the call was disconnected.

CTA_REASON_STOPPED
Stopped by vceStop or the current message was invalidated because one of the referenced voice objects was closed.

CTA_REASON_TIMEOUT
Time limit maxtime was reached.

CTA_REASON_VOICE_END
Silence detected for silencetime milliseconds after some voice detected.

CTAERR_FUNCTION_NOT_AVAIL
Recorded object has encoding that is not supported.

CTAERR_RESOURCE_CONFLICT
Energy detector is in use in the ADI service.


Details

vceRecord initiates recording from the current position in the current message for the specified context. vceRecord always returns immediately. If the return is SUCCESS, a VCEEVN_RECORD_DONE event occurs when recording completes.

Note: If the message has zero length, the DONE event occurs immediately and is not a beep.

Set insertmode to VCE_OVERWRITE to replace existing data without changing the message size. Set insertmode to VCE_INSERT to insert new data before the current position. If the current position is the end of the message, VCE_INSERT appends the new data to the current message. Inserting data anywhere except the end of a message is allowed only on file types that support editing (currently only VOX files).

On completion, the current position is after the inserted data for either insert mode.

EDTX encoding types are not supported.

When the ADI energy detector is active, initiate a record operation (which uses the ADI service) by setting novoicetime and silencetime to zero. For more information about the record parameters, refer to VCE_RECORD_PARMS.

The current position is advanced by the number of milliseconds recorded. The number of milliseconds recorded is reported in the size field of the VCEEVN_RECORD_DONE event.

Refer to Recording for more information.

See also

vcePlayMessage, vceRecordMessage, vceSetCurrentMessage, vceStop

Example

/* Append to an existing message */
extern CTAHD      CtaHd;
extern CTAQUEUEHD CtaQueueHd;

void myAppend (VCEHD vh, unsigned message, int maxseconds)
{
    CTA_EVENT event;
    unsigned  maxtime = maxseconds * 1000 ;

    vceSetCurrentMessage (vh, message) ;
    vceSetPosition (CtaHd, 0, VCE_SEEK_END, NULL) ;
    vceRecord (CtaHd, maxtime, VCE_INSERT, NULL);
    do
    {
        ctaWaitEvent( CtaQueueHd, &event, CTA_WAIT_FOREVER);
    } while (event.id != VCEEVN_RECORD_DONE);/* Ignore other events */
}