# vceSetPlayGain

Set the current play gain to a specified amount.

#### Prototype

DWORD vceSetPlayGain ( CTAHD ctahd, int db)

Argument | Description
ctahd | Handle returned by ctaCreateContext or ctaAttachContext.
db | The new gain, in decibels.

#### Return values

Return value | Description
SUCCESS |
CTAERR_INVALID_CTAHD | Context handle is invalid.
CTAERR_SVR_COMM | Server communication error.

#### Details

vceSetPlayGain changes the volume (loudness) of message playback by adjusting the amplification, or gain, applied to the message being played.

The change in volume is expressed in dB units. Positive values represent amplification and negative values represent attenuation. A gain of zero (0) dB provides no amplification or attenuation. A change of one dB is the smallest change in volume discernible by the human ear.

The new gain is stored in the current context that ctahd identified. If play is currently active, the change takes effect immediately. To start the next play with the current gain, set the play gain parameter on the next play to VCE_CURRENT_VALUE.

Use vceGetContextInfo to get the current value.

Refer to Playing for more information.

#### See also

vceSetPlaySpeed

#### Example

/*
* Sample to adjust play gain by a specific amount. If play is currently
* active, the change takes effect immediately. Otherwise, the change takes
* effect if play is started with the 'gain' parameter set to VCE_CURRENT_VALUE.
*/
void myAdjustGain(CTAHD ctahd, int change)
{
VCE_CONTEXT_INFO contextinfo;
int dB;
vceGetContextInfo(ctahd, &contextinfo, sizeof contextinfo) ;
dB = contextinfo.currentgain + change;
vceSetPlayGain(ctahd, dB);
}