summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-05-19 19:33:26 -0700
committerEric Laurent <elaurent@google.com>2014-05-30 17:13:10 -0700
commit3a24199a0fe9479802ff6096d82cb3745efa1f1f (patch)
tree7409f76d1b7340abc58eb547bc031e7fec7c7fab /media
parent700e73471d85348b52ecf213c36bb24b93997ec7 (diff)
downloadframeworks_base-3a24199a0fe9479802ff6096d82cb3745efa1f1f.zip
frameworks_base-3a24199a0fe9479802ff6096d82cb3745efa1f1f.tar.gz
frameworks_base-3a24199a0fe9479802ff6096d82cb3745efa1f1f.tar.bz2
AudioManager: add audio port gain control
Implement AudioManager.setAudioPortGain() API. Bug: 14815883. Change-Id: Ib54bd1fd1392c474f4767a00228b0a617c51ec5e
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioManager.java9
-rw-r--r--media/java/android/media/AudioPort.java3
-rw-r--r--media/java/android/media/AudioSystem.java1
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);
}