GainProcessor
@UnstableApi
public final class GainProcessor extends BaseAudioProcessor
| java.lang.Object | ||
| ↳ | androidx.media3.common.audio.BaseAudioProcessor | |
| ↳ | androidx.media3.common.audio.GainProcessor |
Applies gain automation over an audio stream.
Summary
Nested types |
|---|
public interface GainProcessor.GainProviderInterface that provides sample-level gain automation to be applied on an audio stream. |
Public constructors |
|---|
GainProcessor(GainProcessor.GainProvider gainProvider) |
Public methods |
|
|---|---|
boolean |
isActive()Returns whether the processor is configured and will process input buffers. |
AudioProcessor.AudioFormat |
@CanIgnoreReturnValueCalled when the processor is configured for a new input format. |
void |
onFlush(AudioProcessor.StreamMetadata streamMetadata)Called when the processor is |
void |
onReset()Called when the processor is reset. |
void |
queueInput(ByteBuffer inputBuffer)Queues audio data between the position and limit of the |
Inherited Constants |
||
|---|---|---|
|
Inherited fields |
||||
|---|---|---|---|---|
|
Inherited methods |
||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||
|
Public constructors
Public methods
isActive
public boolean isActive()
Returns whether the processor is configured and will process input buffers.
onConfigure
@CanIgnoreReturnValue
public AudioProcessor.AudioFormat onConfigure(AudioProcessor.AudioFormat inputAudioFormat)
Called when the processor is configured for a new input format.
onFlush
public void onFlush(AudioProcessor.StreamMetadata streamMetadata)
Called when the processor is flushed.
queueInput
public void queueInput(ByteBuffer inputBuffer)
Queues audio data between the position and limit of the inputBuffer for processing. After calling this method, processed output may be available via getOutput. Calling queueInput(ByteBuffer) again invalidates any pending output.
| Parameters | |
|---|---|
ByteBuffer inputBuffer |
The input buffer to process. It must be a direct byte buffer with native byte order. Its contents are treated as read-only. Its position will be advanced by the number of bytes consumed (which may be zero). The caller retains ownership of the provided buffer. |