ctaGetParmID

Retrieves the parameter ID for a given parameter descriptor name.

Prototype

DWORD ctaGetParmID ( CTAHD ctahd, char *parmname, unsigned *parmid)

Argument

Description

ctahd

Context handle.

parmname

Pointer to the parameter name. Must be a valid parameter name.

parmid

Pointer to the parameter ID. Value cannot be NULL.


Return values

Return value

Description

SUCCESS

 

CTAERR_BAD_ARGUMENT

parmname is NULL or parmid is NULL.

CTAERR_INVALID_CTAHD

An invalid context handle was passed as an argument to a function, or the context was destroyed by another thread.

CTAERR_NOT_FOUND

Parameter name is not found.

CTAERR_NOT_INITIALIZED

Natural Access is not initialized. Call ctaInitialize first.

CTAERR_SVR_COMM

Server communication error.


Details

ctaGetParmID retrieves the parameter ID for a given parameter descriptor name. This function enables you to take advantage of the faster processing of parameters by ID without needing to hard code the parameter ID numbers.

Parameter IDs are fixed in Natural Access. The IDs are defined in the header files.

Note: Set ctahd to NULL_CTAHD if ctaGetParmID must be called before any contexts are created with ctaCreateContext.

Refer to Managing parameters for more information.

See also

ctaGetEventSources, ctaGetParmInfo, ctaGetParms, ctaLoadParameterFile, ctaRefreshParms, ctaSetEventSources

Example

void DemoRecordFile(DEMOCONTEXT *cx, char *filename, unsigned encoding)
{
    VCEHD            vh;
    CTA_EVENT        event;
    VCE_RECORD_PARMS rparms;
    DWORD            vcerecordid;
    unsigned         maxtime = 0;  /* no cap on length of recording */    
    /*
     * Record the caller, overriding default parameters for
     * quick recognition of silence once voice input has begun.
     */
    ctaGetParmID( cx->ctahd, "vce.record", &vcerecordid );
    ctaGetParms( cx->ctahd, vcerecordid, &rparms, sizeof(rparms) );
    rparms.silencetime = 500; /* 1/2 sec */
    vceOpenFile ( cx->ctahd, filename, VCE_FILETYPE_FLAT, VCE_PLAY_RECORD, 
                  encoding, &vh );
    vceRecordMessage( vh, 0, maxtime, &rparms);
    /* Wait for recording to end */
    do
    {
        ctaWaitEvent( cx->ctaqueuehd, &event, CTA_WAIT_FOREVER ); 
    } while ( event.id != VCEEVN_RECORD_DONE );
    printf ( "Record ended with reason: val=0x%x\n", event.value );
      
    vceClose (vh);
}