GainProcessor.GainProvider


public 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 methods

abstract float
getGainFactorAtSamplePosition(
    @IntRange(from = 0) long samplePosition,
    @IntRange(from = 1) int sampleRate
)

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

abstract long
isUnityUntil(
    @IntRange(from = 0) long samplePosition,
    @IntRange(from = 1) int sampleRate
)

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 methods

getGainFactorAtSamplePosition

abstract float getGainFactorAtSamplePosition(
    @IntRange(from = 0) long samplePosition,
    @IntRange(from = 1) int sampleRate
)

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

abstract long isUnityUntil(
    @IntRange(from = 0) long samplePosition,
    @IntRange(from = 1) int sampleRate
)

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
@IntRange(from = 0) long samplePosition

Inclusive starting position of the unity range.

@IntRange(from = 1) int sampleRate

Sample rate in Hertz related to samplePosition.