Ejemplo n.º 1
0
 private void audioSetup() {
   if (musicCB.isSelected()) {
     try {
       if (mp3 == null) {
         mp3 = new MP3();
       }
     } catch (Exception e) {
     }
     mp3.play();
   }
 }
Ejemplo n.º 2
0
 public String playSong(int index) {
   if (!SOUND_ON) {
     return null; // don't play anything if the SOUND_ON is off
   }
   if (!timer.isRunning()) {
     timer.start();
   }
   for (int i = index; i >= 0; i--) { // count down to find last valid track
     if (TITLES.containsKey(i)) {
       index = i;
       break;
     }
   }
   String title = "mix/" + TITLES.get(index);
   if (mp3 != null) {
     mp3.kill();
   } else {
     timer.start();
   }
   mp3 = new MP3(title);
   new Thread(mp3).start();
   return ("Now playing: " + TITLES.get(index));
 }
Ejemplo n.º 3
0
 public void stopSong() {
   if (mp3 != null) {
     mp3.kill();
   }
   playing = false;
 }