private void setMasterTempo ( double newTempo ) { double oldTempo = Double . longBitsToDouble ( masterTempo . getAndSet ( Double . doubleToLongBits ( newTempo ) ) ) ; if ( ( getTempoMaster ( ) != null ) && ( Math . abs ( newTempo - oldTempo ) > getTempoEpsilon ( ) ) ) { // This is a change in tempo, so report it to any registered listeners, and update our metronome if we are synced. if ( isSynced ( ) ) { metronome . setTempo ( newTempo ) ; notifyBeatSenderOfChange ( ) ; } deliverTempoChangedAnnouncement ( newTempo ) ; } }
Establish a new master tempo and if it is a change from the existing one report it to the listeners .