# ctaSetParmByName

Modifies a given parameter.

#### Prototype

DWORD ctaSetParmByName ( CTAHD ctahd, char *parmname, 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.
parmname | Pointer to a string that specifies the name of the parameter. See the Details section for the parmname format.
buffer | Pointer to a buffer that contains the new values of the named parameter.
size | Size of buffer in bytes.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | buffer is NULL.
CTAERR_BAD_SIZE | buffer size does not match the size of the parameter field data.
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 | parmname was not found.
CTAERR_NOT_INITIALIZED | Natural Access is not initialized. Call ctaInitialize first.
CTAERR_SVR_COMM | Server communication error.

#### Details

Use ctaSetParmByName to set the values of the named parameter. If ctahd is a valid context, this function modifies 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 ctahd is a void context handle, this function retrieves parameters from the global defaults and executes 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 parmname format is svcname[.x].structname[.fieldname].

An example of parmname is vce.play.gain.

You can retrieve the values of parameters using ctaGetParms or ctaGetParmByName.

Refer to Managing parameters for more information.

#### See also

ctaGetEventSources, ctaGetParmInfo, ctaSetParmByNameEx

#### Example

void DemoSetContextPlayGain(CTAHD ctahd, INT32 newgain)
{
INT32 oldgain;
ctaGetParmByName( ctahd, "vce.play.gain",
&oldgain, sizeof(oldgain) );
ctaSetParmByName( ctahd, "vce.play.gain",
&newgain, sizeof(newgain) );
printf( "CTAHD=%x vce.play.gain is now %d dB (old value = %d dB)\n",
ctahd, newgain, oldgain);
}