My old SoundPool construction went as follows:
mySoundPool = new SoundPool(3, AudioManager.STREAM_MUSIC, 0);
I am just playing small mp3 sounds.
This has now been deprecated, so we now use SoundPool.Builder.
I have looked around and all I can find is something on the lines:
AudioAttributes attributes = new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_MEDIA)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.build();
mySoundPool = new SoundPool.Builder()
.setAudioAttributes(attributes)
.setMaxStreams(3)
.build();
But,
- I cannot see the new equivalent of
AudioManager.STREAM_MUSIC
in the new version. Where does this go? - What AudioAttribute do I need in
.setUsage(AudioAttributes.USAGE_MEDIA)
? - My Android Studio does not like the existence of the line `.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)’. Why is that?
Can anyone help me on what I need to do to update my code with new-equivalence of my old code?