java - Combining two audiofiles -


i'm newbie in java. tried play them 1 one, error. how can combine 2 audio files one? me please. should play different sound if user type different text. know between sounds starts should pause, how can that. can combine of sounds each letter , after play whole sound?

setcontentview(r.layout.main);     button bstart = (button) findviewbyid(r.id.bstart);     final edittext etstart = (edittext) findviewbyid(r.id.etstart);     final edittext etfinish = (edittext) findviewbyid(r.id.etfinish);     final char[] arr = etstart.gettext().tostring().tochararray();     final mediaplayer = mediaplayer.create(r2d2activity.this, r.raw.as);     final mediaplayer bs = mediaplayer.create(r2d2activity.this, r.raw.bs);     final soundpool sp;     final int a;     sp = new soundpool(2, audiomanager.stream_music, 0);     = sp.load(this, r.raw.as, 1);     bstart.setonclicklistener(new view.onclicklistener() {          @override         public void onclick(view v) {             // todo auto-generated method stub             (int i=0; i<1; i++){                 string value = etstart.gettext().tostring();                 string first = value.substring(i, + 1);                 if(first.contentequals("a")){                 sp.play(a, 100, 100, 0, 0, 1);                 }if(first.contentequals("b")){                 sp.play(b, 100, 100, 0, 0, 1);                 }             } 

base on comment, think should read soundpool document:

http://developer.android.com/reference/android/media/soundpool.html

final void pause(int streamid); // pause playback stream. 

it should you.


edited: if want force program pause sounds, may separate sound playing standalone thread. sleep thread within period of time.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -