soundpool

android soundpool heapsize overflow

强颜欢笑 提交于 2019-11-26 14:38:21
问题 I get this error hundreds of times when I run in Debug, it doesn't seem to affect the program, but how do I get rid of it? I know it can be traced back to the SoundPool based on other posts 09-15 09:03:09.190: ERROR/AudioCache(34): Heap size overflow! req size: 1052672, max size: 1048576 回答1: SoundPool is hard code the buffer size as 1M for all loaded file. So you probably will get 'heap size overflow' error when you load too much files into SoundPool. I also have this issue on a game project

Android : How to change Playback Rate of music using OpenSL ES

不问归期 提交于 2019-11-26 12:01:53
问题 I am working on a music player in which I need to change tempo (playback speed of music) without changing the pitch. I\'m not able to find any native android class to do so. I tried SoundPool but it doesn\'t work with large music files and it also doesn\'t seems to work on many devices. I also tried AudioTrack but again no luck. Now I am trying android NDK audio example which use OpenSL ES to handle music. Now I just want to add set playback rate feature in this example. Can anyone show me

Play sound using soundpool example

本秂侑毒 提交于 2019-11-26 08:59:48
问题 I would like to learn how to use soundpool method. I would like you to show me a very simple example that run 2 sounds. 回答1: Create a folder named as raw under your_app/res/ . Then paste your ringtone in this folder, for example your_app/res/ringtone.mp3 . Now use the following code: SoundPool soundPool = new SoundPool(5, AudioManager.STREAM_MUSIC, 0); int soundId = soundPool.load(context, R.raw.ringtone, 1); // soundId for reuse later on soundPool.play(soundId, 1, 1, 0, 0, 1); Be sure to