@Override public void starting(long totalVolume) { this.totalVolume = totalVolume; if(totalVolume >= 0 && pulsePct > 0) { final double pulseAtVolume = (double) pulsePct * totalVolume / 100; this.pulseAtVolume = (int) pulseAtVolume; if (pulseAtVolume != this.pulseAtVolume) { ++this.pulseAtVolume; pulsePct = Math.round(((double) 100 / totalVolume) * this.pulseAtVolume); } } else { pulseAtVolume = pulsePct < 0 ? pulsePct : 1; } processedSincePulse = 0; processedVolume = 0; callback.starting(this); lastPulseInterval = -1; lastPulseNano = System.nanoTime(); }