gpt4 book ai didi

android - Android 均衡器中的频段数

转载 作者:太空宇宙 更新时间:2023-11-03 12:35:48 27 4
gpt4 key购买 nike

我的问题很简单:内置android均衡器提供的默认频段数是多少?另外,保证的最低频段数是多少?

据我研究,答案似乎是 5,但没有很好的记录。但是,在我目前可用的设备上对其进行测试时,我得到了以下结果:

  • 运行 android 2.3.5 的 HTC Desire S:5 个频段
  • 运行 android 4.0.x 的索尼 Xperia Tipo:5 个频段
  • 但是,运行 Android 4.3.1 的 Nexus 4:6 频段

我得到这些数字的方式如下:

MediaPlayer mp=new MediaPlayer(this);
/* some initialization */
Equalizer eq=new Equalizer(0, mp.getAudioSessionId());
short bands=eq.getNumberOfBands();

那么,在某些设备上,我可能可以获得更多频段,但最小数量是 5?

此外,我根据当前设备的频段动态呈现均衡器的 UI 部分,然后让用户设置自己的偏好,这是一种好方法吗?

提前致谢!

最佳答案

I can't tell the number of bands of device. It is hardware dependent. Samsung galaxy have 13 equalizer bands and some devices have greater than it.

您可以简单地以编程方式创建任意数量的波段。

Equalizer eq=new Equalizer(0, mp.getAudioSessionId());
short bands=eq.getNumberOfBands();
LinearLayout parentViewToAllEqualizerSeekBars = findViewById...
for(int i=0;i<(int)bands.length;i++)
{
//create seekbar programmatically and set it min max and add to the view
Seekbar seek = new SeekBar(this);
seek.min(equalizerMinLevel....)
seek.max(equalizerMaxLevel..)
parentViewToAllEqualizerSeekBars .addView(seek);
}

现在它可以在所有设备上运行。无论是频段小于 5 还是大于 13。

注意:

同时检查 equalizer!=null 是否必须

关于android - Android 均衡器中的频段数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19682653/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com