Class AudioProfileBuilder


@RequiresApi(31) public class AudioProfileBuilder extends Object
Builder for AudioProfile.
  • Method Details

    • newBuilder

      public static AudioProfileBuilder newBuilder()
    • setFormat

      @CanIgnoreReturnValue public AudioProfileBuilder setFormat(int format)
      Sets the audio format.

      The default is AudioFormat.ENCODING_PCM_16BIT.

      format - The audio format. The possible values are the ENCODING_ constants defined in AudioFormat.
    • setSamplingRates

      @CanIgnoreReturnValue public AudioProfileBuilder setSamplingRates(int[] samplingRates)
      Sets the sampling rates.

      The default is a single-item array with 48000.

      samplingRates - The array of supported sampling rates.
    • setChannelMasks

      @CanIgnoreReturnValue public AudioProfileBuilder setChannelMasks(int[] channelMasks)
      Sets the channel masks.

      The default is a single-item array with AudioFormat.CHANNEL_OUT_STEREO.

      channelMasks - The array of supported channel masks. The possible values are the CHANNEL_OUT_ constants defined in AudioFormat.
    • setChannelIndexMasks

      @CanIgnoreReturnValue public AudioProfileBuilder setChannelIndexMasks(int[] channelIndexMasks)
      Sets the channel index masks.

      The default is an empty array.

      channelIndexMasks - The array of supported channel index masks.
    • setEncapsulationType

      @CanIgnoreReturnValue public AudioProfileBuilder setEncapsulationType(int encapsulationType)
      Sets the encapsulation type.

      The default is AudioProfile.AUDIO_ENCAPSULATION_TYPE_NONE.

      encapsulationType - The encapsulation type. The possible values are the AUDIO_ENCAPSULATION_TYPE_ constants defined in AudioProfile.
    • build

      public AudioProfile build()