Android-如何获取AudioManager/AudioSystem参数列表 [英] Android - How to get list of AudioManager / AudioSystem parameters

查看:73
本文介绍了Android-如何获取AudioManager/AudioSystem参数列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AudioManager 具有 setParameters 方法,该方法接受字符串表示形式的键值对("parameter_name = parameter_value").
在内部,它调用本机 AudioSystem.setParameters .
获取参数值的唯一方法是,如果您知道其名称,则通过调用 AudioManager.getParameters 方法,该方法将在"AudioSystem"中调用相应的本机方法.

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)?

推荐答案

经过简要调查,我可以猜测没有可靠的方法可以枚举音频设备参数的所有可用键.Android标头定义了一小组通用参数,所有设备可能都应支持该通用参数.您可以在此处(查找 AUDIO_PARAMETER _ * 宏).和界面实际设备实现 struct audio_hw_device (由供应商实现)只有 get_parameters()/set_parameters(),并且没有枚举入口点.因此,无法请求支持的参数键的完整列表.

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.

最重要的是:

  1. 我们有少量预定义的常用参数
  2. 要处理特定于供应商的参数-我们应该从供应商文档或特定设备的硬件相关资源中获取额外密钥的列表.

欢迎任何纠正措施.

这篇关于Android-如何获取AudioManager/AudioSystem参数列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆