private void setLineVolume(SourceDataLine line, double volume) {
		if (oldVolume == volume) return;
		oldVolume = volume;
		if (line.isControlSupported(FloatControl.Type.VOLUME)) {
			FloatControl volumeControl = (FloatControl) line.getControl(FloatControl.Type.VOLUME);
			volumeControl.setValue((float) volume);
		} else if (line.isControlSupported(FloatControl.Type.MASTER_GAIN)) {
			FloatControl gainControl = (FloatControl) line.getControl(FloatControl.Type.MASTER_GAIN);
			double gain = 20 * Math.log(Math.max(volume, EPSILON)) / Math.log(10.0);
			gainControl.setValue((float) gain);
		}
	}