Ejemplo n.º 1
0
  @Override
  public void start() throws UnsupportedAudioFileException, IOException, LineUnavailableException {
    ISound toStart = getSound();

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

    toStart.start();
  }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
0
  private ISound getSound() {
    ISound result = null;
    for (ISound sound : soundList) {
      if (!sound.running()) {
        result = sound;
        break;
      }
    }

    return result;
  }
Ejemplo n.º 4
0
 private void setAllVolumes() {
   for (ISound sound : soundList) sound.setVolume(volume);
 }