Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue With Sound Manager Playing Random Files
    text
    copied!<p>I am trying to use the SoundManager to randomly play a 30 second sound bite while simultaneously starting an animation sequence (flashing graphic) triggered by an onTouch event. For whatever reason, the sound bite is clipped after about 5 seconds of playback and I can't figure out why. Any thoughts?</p> <p>Also after testing, it appears that the will not play until a minute or so after the initial onTouch event.</p> <pre><code>public class Soundboard extends Activity { private SoundManager mSoundManager; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mSoundManager = new SoundManager(); mSoundManager.initSounds(getBaseContext()); mSoundManager.addSound(0, R.raw.sound0); mSoundManager.addSound(1, R.raw.sound1); mSoundManager.addSound(2, R.raw.sound2); mSoundManager.addSound(3, R.raw.sound3); }; public boolean onTouchEvent(MotionEvent evt){ Random r = new Random(); int x = r.nextInt(3); switch (evt.getAction()) { case MotionEvent.ACTION_DOWN: mSoundManager.playSound(x); startAnimating(); return super.onTouchEvent(evt); case MotionEvent.ACTION_UP: break; default: break; } return true; } private void startAnimating() { ImageView wiub_screen01 = (ImageView) findViewById(R.id.wiub_screen01); Animation fadein01 = AnimationUtils.loadAnimation(this, R.anim.fade_in01); wiub_screen01.startAnimation(fadein01); ImageView wiub_screen00 = (ImageView) findViewById(R.id.wiub_screen00); Animation fadein00 = AnimationUtils.loadAnimation(this, R.anim.fade_in00); wiub_screen00.startAnimation(fadein00); } </code></pre> <p>}</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload