예제 #1
0
  @Override
  public void start() throws UnsupportedAudioFileException, IOException, LineUnavailableException {
    ISound toStart = getSound();

    if (toStart == null) toStart = addSound();

    toStart.start();
  }
예제 #2
0
 private ISound addSound()
     throws UnsupportedAudioFileException, IOException, LineUnavailableException {
   ISound result = soundFactory.createSound();
   result.load();
   result.setRepeat(false);
   result.closeOnEnd(false);
   result.setVolume(volume);
   soundList.add(result);
   return result;
 }
예제 #3
0
  private ISound getSound() {
    ISound result = null;
    for (ISound sound : soundList) {
      if (!sound.running()) {
        result = sound;
        break;
      }
    }

    return result;
  }
예제 #4
0
 private void setAllVolumes() {
   for (ISound sound : soundList) sound.setVolume(volume);
 }