Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - How to get list of AudioManager / AudioSystem parameters

AudioManager has a setParameters method that accepts a Key-Value pair in string representation ("parameter_name=parameter_value").
Internally, it calls native AudioSystem.setParameters.
The only way to get a parameter value is if you know its name, by calling AudioManager.getParameters method which calls the corresponding native method in `AudioSystem'.

Is there a way (using reflection or other techniques) to get a list of supported parameters (of course the result will be dependent on the device it is called on as it is platform-specific)?

like image 231
Oren Avatar asked Apr 04 '15 20:04

Oren


1 Answers

After brief investigation I can guess that there is no reliable way to enumerate all available keys for audio device parameters. Android headers define small set of general parameters, that probably should be supported by all devices. You can find actual keys here (look for AUDIO_PARAMETER_* macros). And interface to actual device implementation struct audio_hw_device (that is implemented by vendor) has only get_parameters()/set_parameters() and no enumeration entry points. So, there is no way to request full list of supported parameter keys.

To top it off:

  1. we have small set of predefined, common parameters
  2. to cope with vendor-specific parameters - we should obtain list of extra keys from vendor docs or hardware related sources for particular device.

Any correctives are welcome.

like image 68
Sergio Avatar answered Oct 18 '22 01:10

Sergio