コード例 #1
0
 public void play() {
   if (use_short_sound) {
     short_sound.play();
     is_playing = false; // short sound, won't be playing long...
   } else {
     if (use_start_sound) {
       t =
           newTimer(
               start_sound.getLengthAsInt(),
               false,
               new ActionListener() {
                 public void actionPerformed(ActionEvent e) {
                   handleTimerPop(e);
                 }
               });
       start_sound.play();
       if (use_mid_sound) {
         t.start();
         is_playing = true;
       }
     } else if (use_mid_sound) {
       mid_sound.setLooped(true);
       mid_sound.play();
     }
   }
 }
コード例 #2
0
 public void loop() {
   if (use_start_sound) {
     start_sound.setLooped(false);
     start_sound.play();
     t =
         newTimer(
             start_sound.getLengthAsInt() - 100,
             false,
             new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                 handleTimerPop(e);
               }
             });
     t.setRepeats(false); // timer pop only once to trigger the sustain sound.
     t.start();
   } else if (use_mid_sound) {
     mid_sound.setLooped(true);
     mid_sound.play();
   }
   is_playing = true;
 }