Returns parameter values for a specified parameter structure.
DWORD ctaGetParms ( CTAHD ctahd, unsigned parmid, void *buffer, unsigned size)
Argument |
Description |
ctahd |
Context handle that specifies the server on which commands are executed. ctahd can be a void context handle. |
parmid |
Parameter structure ID. |
buffer |
Pointer to a buffer to receive parameter values. |
size |
Size of buffer in bytes. |
Return value |
Description |
SUCCESS |
|
CTAERR_BAD_ARGUMENT |
parmid is zero (0), or buffer is NULL. |
CTAERR_BAD_SIZE |
size is less than the parameter size. |
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 |
parmid is not found. |
CTAERR_NOT_INITIALIZED |
Natural Access is not initialized. Call ctaInitialize first. |
CTAERR_SVR_COMM |
Server communication error. |
ctaGetParms retrieves the parameter values for the structure identified by its parmid. If ctahd is a valid context, this function retrieves the parameters from the context defaults.
ctahd can be a void context handle. A void context handle refers only to the server on which the commands are executed and not to any real context object. Each server has a unique void context handle. If the void context handle is equal to NULL_CTAHD, it refers to the default server.
If a void context handle is used for ctahd, this function retrieves parameters from the global defaults and is executed on the server specified by the void context handle. Global defaults are either statically defined values maintained within a process or dynamically defined values maintained by the Natural Access Server.
The size argument specifies the amount of available memory at the buffer and must be large enough to contain the returned parameter structure. The parameter structure's size can be retrieved using ctaGetParmInfo.
Refer to Managing parameters for more information.
ctaGetEventSources, ctaGetParmsEx, ctaSetEventSources
void DemoRecordFile(DEMOCONTEXT *cx, char *filename, unsigned encoding)
{
VCEHD vh;
CTA_EVENT event;
VCE_RECORD_PARMS rparms;
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.
*/
ctaGetParms( cx->ctahd, VCE_RECORD_PARMID, &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);
}