Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7cdc0b58 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge "Unhide AudioTrack constructor with AudioAttributes, AudioFormat" into lmp-dev

parents 6120c4c9 7f6ee760
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -14078,6 +14078,8 @@ package android.media {
    field public static final int CHANNEL_OUT_LOW_FREQUENCY = 32; // 0x20
    field public static final int CHANNEL_OUT_MONO = 4; // 0x4
    field public static final int CHANNEL_OUT_QUAD = 204; // 0xcc
    field public static final int CHANNEL_OUT_SIDE_LEFT = 2048; // 0x800
    field public static final int CHANNEL_OUT_SIDE_RIGHT = 4096; // 0x1000
    field public static final int CHANNEL_OUT_STEREO = 12; // 0xc
    field public static final int CHANNEL_OUT_SURROUND = 1052; // 0x41c
    field public static final int ENCODING_AC3 = 5; // 0x5
@@ -14089,6 +14091,15 @@ package android.media {
    field public static final int ENCODING_PCM_FLOAT = 4; // 0x4
  }
  public static class AudioFormat.Builder {
    ctor public AudioFormat.Builder();
    ctor public AudioFormat.Builder(android.media.AudioFormat);
    method public android.media.AudioFormat build();
    method public android.media.AudioFormat.Builder setChannelMask(int);
    method public android.media.AudioFormat.Builder setEncoding(int) throws java.lang.IllegalArgumentException;
    method public android.media.AudioFormat.Builder setSampleRate(int) throws java.lang.IllegalArgumentException;
  }
  public class AudioManager {
    method public int abandonAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener);
    method public void adjustStreamVolume(int, int, int);
@@ -14270,6 +14281,7 @@ package android.media {
  public class AudioTrack {
    ctor public AudioTrack(int, int, int, int, int, int) throws java.lang.IllegalArgumentException;
    ctor public AudioTrack(int, int, int, int, int, int, int) throws java.lang.IllegalArgumentException;
    ctor public AudioTrack(android.media.AudioAttributes, android.media.AudioFormat, int, int, int) throws java.lang.IllegalArgumentException;
    method public int attachAuxEffect(int);
    method public void flush();
    method public int getAudioFormat();
+1 −4
Original line number Diff line number Diff line
@@ -78,9 +78,7 @@ public class AudioFormat {
    public static final int CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x100;
    public static final int CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x200;
    public static final int CHANNEL_OUT_BACK_CENTER = 0x400;
    /** @hide  CANDIDATE FOR PUBLIC API */
    public static final int CHANNEL_OUT_SIDE_LEFT =         0x800;
    /** @hide  CANDIDATE FOR PUBLIC API */
    public static final int CHANNEL_OUT_SIDE_RIGHT =       0x1000;
    /** @hide */
    public static final int CHANNEL_OUT_TOP_CENTER =       0x2000;
@@ -277,7 +275,6 @@ public class AudioFormat {
    }

    /**
     * @hide CANDIDATE FOR PUBLIC API
     * Builder class for {@link AudioFormat} objects.
     */
    public static class Builder {
@@ -287,7 +284,7 @@ public class AudioFormat {
        private int mPropertySetMask = AUDIO_FORMAT_HAS_PROPERTY_NONE;

        /**
         * Constructs a new Builder with the defaults.
         * Constructs a new Builder with the defaults format values.
         */
        public Builder() {
        }
+22 −8
Original line number Diff line number Diff line
@@ -366,20 +366,34 @@ public class AudioTrack
    }

    /**
     * @hide
     * CANDIDATE FOR PUBLIC API
     * Constructor with AudioAttributes and AudioFormat
     * @param aa
     * @param format
     * @param bufferSizeInBytes
     * @param mode
     * @param sessionId
     * Class constructor with {@link AudioAttributes} and {@link AudioFormat}.
     * @param attributes a non-null {@link AudioAttributes} instance.
     * @param format a non-null {@link AudioFormat} instance describing the format of the data
     *     that will be played through this AudioTrack. See {@link AudioFormat.Builder} for
     *     configuring the audio format parameters such as encoding, channel mask and sample rate.
     * @param bufferSizeInBytes the total size (in bytes) of the buffer where audio data is read
     *   from for playback. If using the AudioTrack in streaming mode, you can write data into
     *   this buffer in smaller chunks than this size. If using the AudioTrack in static mode,
     *   this is the maximum size of the sound that will be played for this instance.
     *   See {@link #getMinBufferSize(int, int, int)} to determine the minimum required buffer size
     *   for the successful creation of an AudioTrack instance in streaming mode. Using values
     *   smaller than getMinBufferSize() will result in an initialization failure.
     * @param mode streaming or static buffer. See {@link #MODE_STATIC} and {@link #MODE_STREAM}.
     * @param sessionId ID of audio session the AudioTrack must be attached to.
     * @throws IllegalArgumentException
     */
    public AudioTrack(AudioAttributes attributes, AudioFormat format, int bufferSizeInBytes,
            int mode, int sessionId)
                    throws IllegalArgumentException {
        // mState already == STATE_UNINITIALIZED

        if (attributes == null) {
            throw new IllegalArgumentException("Illegal null AudioAttributes");
        }
        if (format == null) {
            throw new IllegalArgumentException("Illegal null AudioFormat");
        }

        // remember which looper is associated with the AudioTrack instantiation
        Looper looper;
        if ((looper = Looper.myLooper()) == null) {