private DataEndSignal createDataEndSignal() {
    if (!(this instanceof ConcatAudioFileDataSource))
      for (AudioFileProcessListener fileListener : fileListeners)
        fileListener.audioFileProcFinished(curAudioFile);

    return new DataEndSignal(getDuration());
  }
  /**
   * Sets the audio file from which the data-stream will be generated of.
   *
   * @param audioFileURL The location of the audio file to use
   * @param streamName The name of the InputStream. if <code>null</code> the complete path of the
   *     audio file will be uses as stream name.
   */
  public void setAudioFile(URL audioFileURL, String streamName) {
    // first close the last stream if there's such a one
    if (dataStream != null) {
      try {
        dataStream.close();
      } catch (IOException e) {
        e.printStackTrace();
      }

      dataStream = null;
    }

    assert audioFileURL != null;
    if (streamName != null) streamName = audioFileURL.getPath();

    AudioInputStream audioStream = null;
    try {
      audioStream = AudioSystem.getAudioInputStream(audioFileURL);
    } catch (UnsupportedAudioFileException e) {
      System.err.println("Audio file format not supported: " + e);
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }

    curAudioFile = new File(audioFileURL.getFile());
    for (AudioFileProcessListener fileListener : fileListeners)
      fileListener.audioFileProcStarted(curAudioFile);

    setInputStream(audioStream, streamName);
  }