---
name: "opus_decoderctls"
section: "3"
platform: "linux"
package: "libopus-doc"
version: "1.5.2-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/opus_decoderctls"
---

# opus\_decoderctls(3)

Decoder related CTLs

## NAME

opus\_decoderctls - Decoder related CTLs

## SYNOPSIS

### Macros

\#define **OPUS\_SET\_GAIN**(x)\
 Configures decoder gain adjustment.  #define **OPUS\_GET\_GAIN**(x)\
 Gets the decoder's configured gain adjustment.  #define **OPUS\_GET\_LAST\_PACKET\_DURATION**(x)\
 Gets the duration (in samples) of the last packet successfully decoded or concealed.  #define **OPUS\_GET\_PITCH**(x)\
 Gets the pitch of the last decoded frame, if available.

## Detailed Description

**See also**

**Generic CTLs**, **Encoder related CTLs**, **Opus Decoder**

## Macro Definition Documentation

### #define OPUS\_GET\_GAIN(x)

Gets the decoder's configured gain adjustment.

**See also**

**OPUS\_SET\_GAIN**

**Parameters**

*x* `opus_int32 *`: Amount to scale PCM signal by in Q8 dB units.

### #define OPUS\_GET\_LAST\_PACKET\_DURATION(x)

Gets the duration (in samples) of the last packet successfully decoded or concealed.

**Parameters**

*x* `opus_int32 *`: Number of samples (at current sampling rate).

### #define OPUS\_GET\_PITCH(x)

Gets the pitch of the last decoded frame, if available. This can be used for any post-processing algorithm requiring the use of pitch, e.g. time stretching/shortening. If the last frame was not voiced, or if the pitch was not coded in the frame, then zero is returned.

This CTL is only implemented for decoder instances.

**Parameters**

*x* `opus_int32 *`: pitch period at 48 kHz (or 0 if not available)

### #define OPUS\_SET\_GAIN(x)

Configures decoder gain adjustment. Scales the decoded output by a factor specified in Q8 dB units. This has a maximum range of -32768 to 32767 inclusive, and returns OPUS\_BAD\_ARG otherwise. The default is zero indicating no adjustment. This setting survives decoder reset.

gain = pow(10, x/(20.0\*256))

**Parameters**

*x* `opus_int32`: Amount to scale PCM signal by in Q8 dB units.

## Author

Generated automatically by Doxygen for Opus from the source code.
