Returns parameter values for a specified parameter structure from a particular Natural Access Server.
DWORD ctaGetParmsEx ( char addr, CTAHD ctahd, unsigned parmid, void *buffer, unsigned size)
Argument |
Description |
addr |
Natural Access Server address. |
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_IMPLEMENTED |
Function is not available in the execution mode associated with the specified context. |
CTAERR_NOT_INITIALIZED |
Natural Access is not initialized. Call ctaInitialize first. |
CTAERR_SVR_COMM |
Server communication error. |
ctaGetParmsEx retrieves the parameter values for the structure identified by its parmid. If ctahd is a valid context, this function retrieves the parameters from the server associated with the context.
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 a void context handle is used for ctahd, ctaGetParmsEx 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.
If the context handle is equal to NULL_CTAHD, the function retrieves parameters from the server specified by addr. If addr is equal to NULL or is an empty string, the function retrieves parameters from the default 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.
ctaGetParmByName, ctaGetParmByNameEx, ctaGetParmID, ctaGetParmIds, ctaGetParmIdsEx, ctaGetParms, ctaSetParmByName, ctaSetParmByNameEx
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.
*/
ctaGetParmsEx( "localhost", 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);
}