0

After I compile the code, if received a msg which notified that the soundpool is deprecated. I found out that soundpool has been replaced that soundpool.build().

I edited the code from:

this.mSoundPool = new SoundPool(Cocos2dxSound.MAX_SIMULTANEOUS_STREAMS_I9100, 
                                AudioManager.STREAM_MUSIC, Cocos2dxSound.SOUND_QUALITY);

to:

this.mSoundPool = new SoundPool.Builder().Cocos2dxSound.MAX_SIMULTANEOUS_STREAMS_I9100 
                               .AudioManager.STREAM_MUSIC .Cocos2dxSound.SOUND_QUALITY);

Now I received error.

Can someone enlighten me on how can I edit the code to correct this?

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56

1 Answers1

0

Your Brackets are unbalanced here:

this.mSoundPool = new SoundPool.Builder().Cocos2dxSound.MAX_SIMULTANEOUS_STREAMS_I9100 
                           .AudioManager.STREAM_MUSIC .Cocos2dxSound.SOUND_QUALITY);

Try something like this syntax:

this.mSoundPool.setAudioAttributes(new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_MEDIA)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.build());

source

KYL3R
  • 3,877
  • 1
  • 12
  • 26