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

# opus\_genericctls(3)

Generic CTLs - These macros are used with the opus\_decoder\_ctl and opus\_encoder\_ctl calls to generate a particular request.

## NAME

opus\_genericctls - Generic CTLs

 \- These macros are used with the `opus_decoder_ctl` and `opus_encoder_ctl` calls to generate a particular request.

## SYNOPSIS

### Macros

\#define **OPUS\_RESET\_STATE**\
 Resets the codec state to be equivalent to a freshly initialized state.  #define **OPUS\_GET\_FINAL\_RANGE**(x)\
 Gets the final state of the codec's entropy coder.  #define **OPUS\_GET\_BANDWIDTH**(x)\
 Gets the encoder's configured bandpass or the decoder's last bandpass.  #define **OPUS\_GET\_SAMPLE\_RATE**(x)\
 Gets the sampling rate the encoder or decoder was initialized with.  #define **OPUS\_SET\_PHASE\_INVERSION\_DISABLED**(x)\
 If set to 1, disables the use of phase inversion for intensity stereo, improving the quality of mono downmixes, but slightly reducing normal stereo quality.  #define **OPUS\_GET\_PHASE\_INVERSION\_DISABLED**(x)\
 Gets the encoder's configured phase inversion status.  #define **OPUS\_GET\_IN\_DTX**(x)\
 Gets the DTX state of the encoder.

## Detailed Description

These macros are used with the `opus_decoder_ctl` and `opus_encoder_ctl` calls to generate a particular request.

When called on an `OpusDecoder` they apply to that particular decoder instance. When called on an `OpusEncoder` they apply to the corresponding setting on that encoder instance, if present.

Some usage examples:

```
int ret;
opus_int32 pitch;
ret = opus_decoder_ctl(dec_ctx, OPUS_GET_PITCH(&pitch));
if (ret == OPUS_OK) return ret;
opus_encoder_ctl(enc_ctx, OPUS_RESET_STATE);
opus_decoder_ctl(dec_ctx, OPUS_RESET_STATE);
opus_int32 enc_bw, dec_bw;
opus_encoder_ctl(enc_ctx, OPUS_GET_BANDWIDTH(&enc_bw));
opus_decoder_ctl(dec_ctx, OPUS_GET_BANDWIDTH(&dec_bw));
if (enc_bw != dec_bw) {
  printf("packet bandwidth mismatch!\n");
}
```

**See also**

**Opus Encoder**, **opus\_decoder\_ctl**, **opus\_encoder\_ctl**, **Decoder related CTLs**, **Encoder related CTLs**

## Macro Definition Documentation

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

Gets the encoder's configured bandpass or the decoder's last bandpass.

**See also**

**OPUS\_SET\_BANDWIDTH**

**Parameters**

*x* `opus_int32 *`: Returns one of the following values:

- **OPUS\_AUTO**

  (default)

- **OPUS\_BANDWIDTH\_NARROWBAND**

  4 kHz passband

- **OPUS\_BANDWIDTH\_MEDIUMBAND**

  6 kHz passband

- **OPUS\_BANDWIDTH\_WIDEBAND**

  8 kHz passband

- **OPUS\_BANDWIDTH\_SUPERWIDEBAND**

  12 kHz passband

- **OPUS\_BANDWIDTH\_FULLBAND**

  20 kHz passband

### #define OPUS\_GET\_FINAL\_RANGE(x)

Gets the final state of the codec's entropy coder. This is used for testing purposes, The encoder and decoder state should be identical after coding a payload (assuming no data corruption or software bugs)

**Parameters**

*x* `opus_uint32 *`: Entropy coder state

### #define OPUS\_GET\_IN\_DTX(x)

Gets the DTX state of the encoder. Returns whether the last encoded frame was either a comfort noise update during DTX or not encoded because of DTX.

**Parameters**

*x* `opus_int32 *`: Returns one of the following values:

- **0**

  The encoder is not in DTX.

- **1**

  The encoder is in DTX.

### #define OPUS\_GET\_PHASE\_INVERSION\_DISABLED(x)

Gets the encoder's configured phase inversion status.

**See also**

**OPUS\_SET\_PHASE\_INVERSION\_DISABLED**

**Parameters**

*x* `opus_int32 *`: Returns one of the following values:

- **0**

  Stereo phase inversion enabled (default).

- **1**

  Stereo phase inversion disabled.

### #define OPUS\_GET\_SAMPLE\_RATE(x)

Gets the sampling rate the encoder or decoder was initialized with. This simply returns the `Fs` value passed to **opus\_encoder\_init()** or **opus\_decoder\_init()**.

**Parameters**

*x* `opus_int32 *`: Sampling rate of encoder or decoder.

### #define OPUS\_RESET\_STATE

Resets the codec state to be equivalent to a freshly initialized state. This should be called when switching streams in order to prevent the back to back decoding from giving different results from one at a time decoding.

### #define OPUS\_SET\_PHASE\_INVERSION\_DISABLED(x)

If set to 1, disables the use of phase inversion for intensity stereo, improving the quality of mono downmixes, but slightly reducing normal stereo quality. Disabling phase inversion in the decoder does not comply with RFC 6716, although it does not cause any interoperability issue and is expected to become part of the Opus standard once RFC 6716 is updated by draft-ietf-codec-opus-update.

**See also**

**OPUS\_GET\_PHASE\_INVERSION\_DISABLED**

**Parameters**

*x* `opus_int32`: Allowed values:

- **0**

  Enable phase inversion (default).

- **1**

  Disable phase inversion.

## Author

Generated automatically by Doxygen for Opus from the source code.
