[6.2.4] fix bug of sound play helper , devices extends lenovo , npl of map init
This commit is contained in:
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
|
||||
import android.media.*;
|
||||
import android.content.*;
|
||||
import android.app.*;
|
||||
import android.util.Log;
|
||||
|
||||
public class SoundPoolHelper {
|
||||
private SoundPool mSoundPool;
|
||||
@@ -38,7 +39,9 @@ public class SoundPoolHelper {
|
||||
//init settings
|
||||
private void init(){
|
||||
// AudioManager audio settings for adjusting the volume
|
||||
mAudioManager = (AudioManager)this.mContext. getSystemService(Context.AUDIO_SERVICE);
|
||||
if(mAudioManager == null){
|
||||
mAudioManager = (AudioManager)this.mContext. getSystemService(Context.AUDIO_SERVICE);
|
||||
}
|
||||
|
||||
// Current volumn Index of particular stream type.
|
||||
float currentVolumeIndex = (float) mAudioManager.getStreamVolume(streamType);
|
||||
@@ -87,6 +90,10 @@ public class SoundPoolHelper {
|
||||
|
||||
//play the sound res
|
||||
private void playSound(){
|
||||
if(mSoundPool == null){
|
||||
Log.e("SoundPoolHelper","playSound mSoundPool is null");
|
||||
return;
|
||||
}
|
||||
float leftVolume = volume;
|
||||
float rightVolume = volume;
|
||||
// Play sound of gunfire. Returns the ID of the new stream.
|
||||
|
||||
Reference in New Issue
Block a user