Code example for SoundPool

Methods: load

0
    private boolean[] mPattern;
 
    private int mPatternIndex;
 
    public Metronome(Context context, int resId) {
        mSoundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, DEFAULT_QUALITY);
        mSoundId = mSoundPool.load(context, resId, DEFAULT_PRIORITY);
 
        mStreamId = -1;
        mDelayMillis = 1000;
        mLeftVolume = 0.5f;
        mRightVolume = 0.5f;
        mPitch = 1.0f;
 
        mPattern = new boolean[] { true };
        mPatternIndex = 0;
    } 
 
    /** 
     * Starts metronome playback. Does nothing if called again before stop(). 
     */