I combed the AudioManager and couldn't find any API or setting to switch from stereo to mono (both channels having a signal that's the sum of the two stereo channels).
Is it possible a开发者_开发技巧t all to accomplish this in Android?
There is a method in the AudioManager class called setParameters
that might do that. Unfortunately, the API is not very clear about what it does:
public void setParameters (String keyValuePairs)
Sets a variable number of parameter values to audio hardware.
Parameters
keyValuePairs list of parameters key value pairs in the form: key1=value1;key2=value2;...
If we look at the source code for this method in AudioManager.java:
/**
* Sets a variable number of parameter values to audio hardware.
*
* @param keyValuePairs list of parameters key value pairs in the form:
* key1=value1;key2=value2;...
*
*/
public void setParameters(String keyValuePairs) {
AudioSystem.setParameters(keyValuePairs);
}
And looking at AudioSystem.java:
/*
* Sets a group generic audio configuration parameters. The use of these parameters
* are platform dependant, see libaudio
*
* param keyValuePairs list of parameters key value pairs in the form:
* key1=value1;key2=value2;...
*/
public static native int setParameters(String keyValuePairs);
Not much information there. It looks like the parameters might be hardware-specific, and I'm not even sure the parameters would do what you're looking to do.
Are you trying to set this system-wide or just in one app? I assumed system-wide, but if that's not the case, I'd imagine it would be easier.
There's been an open issue on this for Android for the last three years, but no response from Google on it yet:
https://code.google.com/p/android/issues/detail?id=17337
If you have rooted your device and installed BusyBox, you can use the Boeffla Sound Control app off of the Google Play store.
精彩评论