Making Soundboard...MediaPlayer help?


Last Updated:

  1. UNEXPECTED62

    UNEXPECTED62 Member This Topic's Starter

    Joined:
    Jan 31, 2010
    Messages:
    8
    Likes Received:
    0
    I am going to just have one thread for my app to avoid cluttering the boards and edit this post as necessary.

    My current issue is not really an issue per say, but a question on applications in general. I really want to do a good, complete and thorough job, so I wanted to do all the gui custom instead of using Android's built in buttons. I also have focused and pressed buttons for each. So this means for every button I have, it's actually x3. I'm not sure if this is the actual size of the .apk when loaded onto a device, but my project folder is 20 MB, which seems large to me for such a simple app. Am I not compressing images well enough with proper file formats, or going about GUI all wrong? Is it inefficient to make your GUI like I am? And what worries me, is I have only done it for hdpi devices, and I still would need to create proper files for the mdpi and ldpi devices......

    Can anyone shed some light on how to make a good gui with everything custom while still having a respectable app size?

    ***************************************************
    I have solved this issue below, but I will keep it here to prevent the posts from making no sense.

    I have been working on a soundboard for some time now. This is my first app for Android, but I have been programming Java at an educational level (3rd year college student).

    Before I go too far, would Android's MediaPlayer class be a good thing to use for making a soundboard? Or should a different approach be taken?
     

    Advertisement
  2. markb

    markb Well-Known Member

    Joined:
    Sep 14, 2009
    Messages:
    148
    Likes Received:
    26
    Hi,

    For a soundboard where you have a fixed number of sound samples, it might be worth considering the SoundPool class.

    You pre-load the sounds when you start up, and then get the pool to play each sound as you need it. It also makes it trivially easy to handle playing multiple sounds at the same time (not that you'd need it though).

    There's some documentation here:

    SoundPool | Android Developers

    And a code example here:

    Android Snippets: Playing sound FX for a game

    I used it recently for a game I'm developing, and I found it much easier than using the MediaPlayer.

    Regards,

    Mark
     
  3. UNEXPECTED62

    UNEXPECTED62 Member This Topic's Starter

    Joined:
    Jan 31, 2010
    Messages:
    8
    Likes Received:
    0
    Wow, thanks Mark. This is something I was looking for, and I have never heard of androidsnippets. I appreciate you sharing those resources. I will play around with that and give it another shot. If I have more questions I will reply again.
     
  4. UNEXPECTED62

    UNEXPECTED62 Member This Topic's Starter

    Joined:
    Jan 31, 2010
    Messages:
    8
    Likes Received:
    0
    I am going to just have one thread for my app to avoid cluttering the boards and edit this post as necessary.

    My current issue is not really an issue per say, but a question on applications in general. I really want to do a good, complete and thorough job, so I wanted to do all the gui custom instead of using Android's built in buttons. I also have focused and pressed buttons for each. So this means for every button I have, it's actually x3. I'm not sure if this is the actual size of the .apk when loaded onto a device, but my project folder is 20 MB, which seems large to me for such a simple app. Am I not compressing images well enough with proper file formats, or going about GUI all wrong? Is it inefficient to make your GUI like I am? And what worries me, is I have only done it for hdpi devices, and I still would need to create proper files for the mdpi and ldpi devices......

    Can anyone shed some light on how to make a good gui with everything custom while still having a respectable app size?
     

Share This Page

Loading...