GainProcessor.GainProvider


interface GainProcessor.GainProvider

Known direct subclasses
DefaultGainProvider

Provides gain automation information to be applied on an audio stream.


Interface that provides sample-level gain automation to be applied on an audio stream.

Summary

Public functions

Float
getGainFactorAtSamplePosition(
    samplePosition: @IntRange(from = 0) Long,
    sampleRate: @IntRange(from = 1) Int
)

Returns a gain factor between [0f; 1f] to apply at the given sample position relative to sampleRate.

Long
isUnityUntil(
    samplePosition: @IntRange(from = 0) Long,
    sampleRate: @IntRange(from = 1) Int
)

Returns the exclusive upper limit of the range starting at samplePosition where the gain value is 1f (unity), or TIME_UNSET if samplePosition does not correspond to a gain of 1f.

Public functions

getGainFactorAtSamplePosition

fun getGainFactorAtSamplePosition(
    samplePosition: @IntRange(from = 0) Long,
    sampleRate: @IntRange(from = 1) Int
): Float

Returns a gain factor between [0f; 1f] to apply at the given sample position relative to sampleRate.

Returned values must not change for the same pair of parameter values within the lifetime of the instance.

isUnityUntil

fun isUnityUntil(
    samplePosition: @IntRange(from = 0) Long,
    sampleRate: @IntRange(from = 1) Int
): Long

Returns the exclusive upper limit of the range starting at samplePosition where the gain value is 1f (unity), or TIME_UNSET if samplePosition does not correspond to a gain of 1f.

If the range continues until the end of the stream, this method returns TIME_END_OF_SOURCE.

Returned values must not change for the same pair of parameter values within the lifetime of the instance.

Parameters
samplePosition: @IntRange(from = 0) Long

Inclusive starting position of the unity range.

sampleRate: @IntRange(from = 1) Int

Sample rate in Hertz related to samplePosition.