简体   繁体   English

来自Android Visualizer的FFT数据取决于音量

[英]FFT Data from Android Visualizer dependent on volume

I've been struggling with this for the past hour and it's driving me nuts. 在过去的一个小时里,我一直在为此苦苦挣扎,这让我发疯了。 I'm making a music app, and i want to have a visualizer built in. I have a MediaPlayer object, and I'm linking a Visualizer to that player's session id, but the data I get is dependent on the volume. 我正在制作一个音乐应用程序,并且希望内置一个可视化器。我有一个MediaPlayer对象,并且要将可视化器链接到该播放器的会话ID,但是我得到的数据取决于音量。 I've tried initializing an Equalizer before and after the visualizer, and I've tried changing the audio stream to music in the activity, but nothing is working. 我尝试在可视化器之前和之后初始化均衡器,并且尝试在活动中将音频流更改为音乐,但是没有任何效果。

How can I make the visualizer not dependent on the output volume of the device? 如何使显示器不依赖于设备的输出音量?

You should use this: setVolumeControlStream (AudioManager. STREAM_MUSIC); 您应该使用此方法: setVolumeControlStream (AudioManager. STREAM_MUSIC); in your activity, if you have a fragment you can call it with getActivity() . 在您的活动中,如果有片段,则可以使用getActivity()进行调用。 Hope it helps! 希望能帮助到你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM