Guest User

Untitled

a guest
Feb 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. 02-21 21:02:35.432 5448-5448/package.name E/AudioTrack: AudioFlinger could not create track, status: -12
  2. 02-21 21:02:35.432 5448-5448/package.name E/SoundPool: Error creating AudioTrack
  3. 02-21 21:05:08.852 5448-5448/package.name E/AudioTrack: AudioFlinger could not create track, status: -12
  4. 02-21 21:05:08.852 5448-5448/package.name E/SoundPool: Error creating AudioTrack
  5. 02-21 21:05:09.592 5448-5448/package.name E/AudioTrack: AudioFlinger could not create track, status: -12
  6. 02-21 21:05:09.592 5448-5448/package.name E/SoundPool: Error creating AudioTrack
  7. 02-21 21:05:10.402 5448-5448/package.name E/AudioTrack: AudioFlinger could not create track, status: -12
  8. 02-21 21:05:10.402 5448-5448/package.name E/SoundPool: Error creating AudioTrack
  9.  
  10. private int mSoundID;
  11. private SoundPool mSoundPool;
  12. private boolean isSoundLoaded = false;
  13.  
  14. @Override
  15. protected void onCreate(@Nullable Bundle savedInstanceState) {
  16. super.onCreate(savedInstanceState);
  17.  
  18. setContentView(R.layout.my_layout);
  19.  
  20. mSoundPool = new SoundPool(10, AudioManager.STREAM_MUSIC,0);
  21.  
  22. mSoundID = mSoundPool.load(getApplicationContext(),R.raw.soundfile,1);
  23.  
  24. mSoundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
  25. @Override
  26. public void onLoadComplete(SoundPool soundPool, int i, int i1) {
  27. isSoundLoaded = true;
  28.  
  29. }
  30. });
  31.  
  32. }
  33.  
  34. if (isSoundLoaded)
  35. mSoundPool.play(mSoundID,1,1,1,0,1.0f);
Add Comment
Please, Sign In to add comment