问题描述
我正在使用可视化类在Android上2.3.1一些音乐分析。我发现,在FFT和波形幅值受该装置的体积。这意味着,如果用户有音量调低,我收到很少或没有FFT数据。
I'm working on some music analysis using the Visualizer class on Android 2.3.1. I am finding that the FFT and waveform magnitudes are affected by the volume of the device. This means that if the user has the volume turned down I receive little or not FFT data.
我测试过这在摩托罗拉Xoom,三星Galaxy Tab和仿真器和它的行为这种方式。
I've tested this on a Motorola Xoom, Samsung Galaxy Tab and the emulator and it behaves this way.
我用下面的code:
mp = new MediaPlayer();
mp.setDataSource("/sdcard/sine1.wav");
mp.prepare();
mp.setLooping(true);
mp.start();
int audioSessionID = mp.getAudioSessionId();
v = new Visualizer(audioSessionID);
v.setEnabled(true);
纵观文档的展示台类看来,如果我们传递在一个有效的音频会话ID,然后在可视化应该在这个音频会话操作。看来,展示台是在输出混音工作。
Looking at the docs for the Visualizer class it seems that if we are passing in a valid audio session id then the visualizer should operate upon this audio session. It appears that the Visualizer is operating upon the output mix.
有没有其他人遇到这样或找到一个解决的方法?
Has anyone else encountered this or found a way around it?
感谢
推荐答案
我也面临同样的问题,但是当我使Eqaulizer和可视化工具一样seession id.I不知道它的原因,它是工作,我检查的可视化工具类中删除均衡器API演示,它正在像你说的。
I was also facing the same problem, but it is working when i am enabled the Eqaulizer and Visualizer for same seession id.I dont know the reason for it ,i checked it remove the equalizer from visualizer class in api demos it is working as you said.
Equalizer mEqualizer = new Equalizer(0, SessionId);
mEqualizer.setEnabled(true); // need to enable equalizer
Visualizer mVisualizer = new Visualizer(SessionId);
这篇关于Android的展台FFT /波形受设备的体积?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!