hlThread.queue(track);  synchronized (hlThread.getMutex()) { final String message = "Please wait... Need to determine track loudness"; getApp().addStatusMessage(100, message); try { while ((loudness = track.getProperty("loudness")) == null) hlThread.getMutex().wait();
bgHowLoud.queue(track);   bgHowLoud.addWaiter(); try {  synchronized (bgHowLoud.getMutex()) { final String message = "Please wait... Need to determine track loudness"; getApp().addStatusMessage(100, message); try { while ((loudness = track.getProperty("loudness")) == null) bgHowLoud.getMutex().wait(); } catch (InterruptedException e) { } getApp().removeStatusMessage(message);
  public int determineVolume(Track track, int suggestedVolume)  {      // Note: The suggestedVolume is only used when we don't know what the volume is.    String loudness = track.getProperty("loudness");      // If we don't know how loud it is...    if (loudness == null) {        // Then queue it for processing - top priority.      try {        hlThread.queue(track);          // Wait until we have determined how loud it is.        synchronized (hlThread.getMutex()) {          final String message = "Please wait... Need to determine track loudness";          getApp().addStatusMessage(100, message);          try {            while ((loudness = track.getProperty("loudness")) == null)              hlThread.getMutex().wait();          }          catch (InterruptedException e) {          }          getApp().removeStatusMessage(message);        }      }      catch (FileNotFoundException e) {        System.err.println("auto-normalize: Warning - File not found when trying to determine loudness of "+track);        return 0;      }    }    try {      int loudnessDb = (int) Math.floor(Float.parseFloat(loudness));        // Negate the loudness to make it a volume adjustment.      int adj = -loudnessDb;      System.out.println("auto-normalize: playing "+track+" with volume adjustment of "+(adj<0?"":"+")+adj+" dB");      return -loudnessDb;    }    catch (NumberFormatException e) {      return suggestedVolume;    }  }