carb::audio::calculateOpusGain

Defined in carb/audio/AudioUtils.h

inline int16_t carb::audio::calculateOpusGain(float gain)

Calculate the gain parameter for an Opus encoder from a floating point gain.

Parameters

gain[in] The floating point gain to convert to an Opus gain parameter. This must be between [-128, 128] or it will be clamped.

Returns

A gain value that can be used as a parameter to an Opus encoder. This is a signed 16 bit fixed point value with 8 fractional bits.