• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Repeating a sound

Hey guys I'm building a metronome and am using the MediaPlayer.
Code:
MediaPlayer mp;

.....

public void run() {
    		if(playing) {
    			mp.seekTo(0);
    			mp.start();
    		}
    		else
    		{
    			mp = MediaPlayer.create(getBaseContext(), R.raw.cowbell);
    	 		mp.start();
                        playing = true;
    		}
}

the run method is called in regular intervals. There is a delay between the first and second click then it seems to run smoothly. Even so at higher tempos I feel like it is phasing in and out of time. Also the fastest the sound will play is about every 300ms anything faster and there is no noticeable difference.

Any thoughts?

Thanks,
Jordan
 
Back
Top Bottom