audio delay [Android Development]

All your problems with Audio, Video and Images.

audio delay [Android Development]

Postby voltronixx » Wed Oct 24, 2012 11:33 am

Hi,

I'm creating a sampler app for school, I've made a code wich plays a sample when I press and hold a button and stops when I release it. My problem is that it has too many latency, it takes too long after I press the button to play the sound.

here's my code:

smpl1.setOnTouchListener(new View.OnTouchListener()
{
public boolean onTouch(View arg0, MotionEvent theMotion)
{
switch (theMotion.getAction())
{
case MotionEvent.ACTION_DOWN:
sample = MediaPlayer.create(MainActivity.this, R.raw.bassdrum);
smpl1.setText("ON");
smpl1.setTextColor(Color.GREEN);
sample.start();
break;
case MotionEvent.ACTION_UP:
smpl1.setText("OFF");
smpl1.setTextColor(Color.RED);
sample.stop();
break;

}
return true;

}

my audio files are now mp3's..

thanks!
voltronixx
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Oct 24, 2012 11:26 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 13 guests