I wanted to load files from the SD card into a SoundPool as well as ringtones. I am able to successfully get the path of the files, and I am able to play them with MediaPlayer. However, I need the functionality of the SoundPool. I have tried SoundPool.load(String, int) but it appears to not load the file. Is it possible to load files from the SD card into a SoundPool, or is there a better way to do this?
Asked
Active
Viewed 1,296 times
1
-
Take a look at: http://stackoverflow.com/questions/4293122/how-can-i-load-a-sound-from-the-sd-card-insted-of-the-raw-folder-in-my-android-a – ᴘᴀɴᴀʏɪᴏᴛɪs Oct 24 '11 at 16:55
-
I saw that when I was researching, but I don't understand how it's useful. I have access to the file's path, it's just not loading into the soundpool. Was there something I missed in that other question? – jp14 Oct 24 '11 at 17:07
-
Try using this : http://stackoverflow.com/a/11009250/847501 – Rafiq Jun 13 '12 at 08:36
1 Answers
1
You can use android.os.Environment.getExternalStorageDirectory()
to get the directory to your sdcard and append the file and extension, you can then use SoundPool withload(String path, int priority)
, to access your file.
Or while not recommended you can even hardcode your path to "/sdcard/".
If the problem is not with getting the soundfile path then you can take a look at Creating Sound Effects in Android

ᴘᴀɴᴀʏɪᴏᴛɪs
- 7,169
- 9
- 50
- 81