Пример #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);
 }