I hope my question is clear from the title. But still I will explain briefly my problems. I tried ogg and faced the problem of looping. I added a tag ANDROID_LOOP=true for ogg file to enable loop while it is set as ringtone. But when I play in the soundboard app, it continues to play in infinite loop. When I googled about this, I found it to be a bug with ogg files. Then I tried mp3, and I am not able to set the TITLE, or ARTIST or any metadata to the m开发者_JAVA技巧p3 file even after when i enter the mediastore database as follows
values.put(MediaStore.MediaColumns.TITLE, "foo");
values.put(MediaStore.MediaColumns.DISPLAY_NAME, "foo");
values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/mp3");
values.put(MediaStore.Audio.Media.ARTIST, "Sound Board");
When I open the mp3 file in the Media Player, it says Unknown Artist and Unknown Album. Anybody knows how to fix this? Also suggest me a good format which will save me some space. Your help is really appreciated. Thanks.
Is there a reason you're adding your audio to the media store? It seems that a sound board application would keep all their audio inside the application resources and play them as necessary. In that case I would go back to using ogg files since the performance seems to be the best, and if you take a look at SoundPool class that's pretty much exactly what you'll need to load up a bunch of audio samples, trigger and loop them as necessary.
精彩评论