Hello,
I'm desperately trying to get my soundboard application to work. I
have a GridView consisting of Buttons, which have an OnClickListener
starting the sound file associated with the button. The sound files
are stored as MP3 (64 kbit/s, LAME encoded) audio files in the res/raw
folder and are referenced using the R class.
The following problem only occurs when running the app on a real
device, however, on the emulator it works perfectly. I have tried two
different HTC Hero so far.
I have a mysterious problem, that everytime I press a button to play a
specific sound, ALL sounds in the res/raw folder are played in the
order they are listed there. My current code to play a sound looks
like this:
if (player != null) {
player.stop();
player.release();
}
player = MediaPlayer.create(this, resId);
if (player != null) {
player.start();
}
As you can see I use a "singleton" MediaPlayer to play the files. I
have also tried using a new separate MediaPlayer instance for each
sound file, with the same result. Additionally, I have tried playing
the sound file in a separate thread with the result, that only the
first time all sound files are played. After that, the buttons work as
intended.
You can take a look at the source code on the Google Code project
site: http://code.google.com/p/zappenduster-soundboard/
Thanks for your help!
Adrian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---