如何获得Android手机扬声器的声音幅度?

时间:2016-10-27 00:20:44

标签: android

我尝试根据Android手机上播放的音乐渲染图表。但我想不出办法知道这首歌当前播放的声音有多大。谢谢!

1 个答案:

答案 0 :(得分:0)

// getSystemService is a Context method
AudioManager audioManager =
    (AudioManager) getSystemService(Context.AUDIO_SERVICE);
// see other AudioManager.STREAM_* constants
int volume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);