0

I'm playing a m4a format sound in my android device, I both use MediaPlayer and SoundPool and set volume to the same value, but sounds different!

MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setVolume(1, 1); 
...start to play...

SoundPool mSoundPool = new SoundPool(5, AudioManager.STREAM_MUSIC,5);
steamID...
mSoundPool.setVolume(steamID, 1, 1);

What's wrong?

Michael
  • 57,169
  • 9
  • 80
  • 125
Jared
  • 371
  • 1
  • 3
  • 4
  • [MediaPlayer.setVolume(float,float)](https://developer.android.com/reference/android/media/MediaPlayer.html#setVolume(float,%20float)) API is recommended for balancing the output of audio streams within an application. Unless you are writing an application to control user settings, this API should be used in preference to [setStreamVolume(int, int, int)](https://developer.android.com/reference/android/media/AudioManager.html#setStreamVolume(int,%20int,%20int)) which sets the volume of ALL streams of a particular type. – Priyank Patel Sep 26 '16 at 08:26
  • `MediaPlayer`'s volume is logarithmic. Perhaps `SoundPool`'s volume is linear. – Michael Sep 26 '16 at 08:26

0 Answers0