Android Open Source - AdoreLib Sound Effect






From Project

Back to project page AdoreLib.

License

The source code is released under:

MIT License

If you think the Android project AdoreLib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ylinval.adore.adorelib.Sound;
/*from  ww w  .ja  v  a 2 s.  c o  m*/
import android.content.Context;
import android.media.MediaPlayer;

/**
 * Created by jdourlens on 5/10/14.
 */
public class SoundEffect {

    MediaPlayer mp;

    public SoundEffect(Context c, int id)
    {
mp = MediaPlayer.create(c, id);
    }

    public void play()
    {
        if (mp != null) {
            mp.seekTo(0);
            mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {

                @Override
                public void onCompletion(MediaPlayer mp) {
                    mp.pause();
                }
            });
            mp.start();
        }
    }
}




Java Source Code List

com.ylinval.adore.adorelib.AdoreActivity.java
com.ylinval.adore.adorelib.AdoreFragment.java
com.ylinval.adore.adorelib.AdoreLoop.java
com.ylinval.adore.adorelib.AdoreView.java
com.ylinval.adore.adorelib.AdoreGraphics.Circle.java
com.ylinval.adore.adorelib.AdoreGraphics.Image.java
com.ylinval.adore.adorelib.AdoreGraphics.Line.java
com.ylinval.adore.adorelib.AdoreGraphics.Point.java
com.ylinval.adore.adorelib.AdoreGraphics.Rectangle.java
com.ylinval.adore.adorelib.AdoreGraphics.RoundRectangle.java
com.ylinval.adore.adorelib.AdoreGraphics.RoundSquare.java
com.ylinval.adore.adorelib.AdoreGraphics.Square.java
com.ylinval.adore.adorelib.AdoreGraphics.TextOutlined.java
com.ylinval.adore.adorelib.AdoreGraphics.Text.java
com.ylinval.adore.adorelib.AndroidViews.VerticalTextView.java
com.ylinval.adore.adorelib.Libs.Atlas.Circ.java
com.ylinval.adore.adorelib.Libs.Atlas.Pos.java
com.ylinval.adore.adorelib.Libs.Atlas.Rect.java
com.ylinval.adore.adorelib.Libs.State.StateManager.java
com.ylinval.adore.adorelib.Libs.State.State.java
com.ylinval.adore.adorelib.Libs.Tween.Tween.java
com.ylinval.adore.adorelib.Mobile.Accelerometer.java
com.ylinval.adore.adorelib.Sound.Music.java
com.ylinval.adore.adorelib.Sound.SoundEffect.java