diff options
author | Eric Laurent <elaurent@google.com> | 2014-05-31 00:49:57 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-31 00:49:58 +0000 |
commit | 54b5e5bdf621449a1806ff2971b95df273069c44 (patch) | |
tree | 86cbd3faf4cddfa699cbedde701b18107818b56e /media | |
parent | 8725859ee3a9fb7dd09641c2b13baa4f7a16ca99 (diff) | |
parent | 3a24199a0fe9479802ff6096d82cb3745efa1f1f (diff) | |
download | frameworks_base-54b5e5bdf621449a1806ff2971b95df273069c44.zip frameworks_base-54b5e5bdf621449a1806ff2971b95df273069c44.tar.gz frameworks_base-54b5e5bdf621449a1806ff2971b95df273069c44.tar.bz2 |
Merge "AudioManager: add audio port gain control" into lmp-preview-dev
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioManager.java | 9 | ||||
-rw-r--r-- | media/java/android/media/AudioPort.java | 3 | ||||
-rw-r--r-- | media/java/android/media/AudioSystem.java | 1 |
3 files changed, 12 insertions, 1 deletions
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index e6988b6..2f8a17b 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -3087,7 +3087,14 @@ public class AudioManager { * @hide */ public int setAudioPortGain(AudioPort port, AudioGainConfig gain) { - return ERROR_INVALID_OPERATION; + if (port == null || gain == null) { + return ERROR_BAD_VALUE; + } + AudioPortConfig activeConfig = port.activeConfig(); + AudioPortConfig config = new AudioPortConfig(port, activeConfig.samplingRate(), + activeConfig.channelMask(), activeConfig.format(), gain); + config.mConfigMask = AudioPortConfig.GAIN; + return AudioSystem.setAudioPortConfig(config); } /** diff --git a/media/java/android/media/AudioPort.java b/media/java/android/media/AudioPort.java index 9aeddef..fbd5022 100644 --- a/media/java/android/media/AudioPort.java +++ b/media/java/android/media/AudioPort.java @@ -133,6 +133,9 @@ public class AudioPort { * Get the gain descriptor at a given index */ AudioGain gain(int index) { + if (index < mGains.length) { + return null; + } return mGains[index]; } diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java index 47a884b..af7a3e1 100644 --- a/media/java/android/media/AudioSystem.java +++ b/media/java/android/media/AudioSystem.java @@ -465,5 +465,6 @@ public class AudioSystem AudioPortConfig[] sources, AudioPortConfig[] sinks); public static native int releaseAudioPatch(AudioPatch patch); public static native int listAudioPatches(ArrayList<AudioPatch> patches, int[] generation); + public static native int setAudioPortConfig(AudioPortConfig config); } |