Interface TrackPositionBeatListener
-
- All Superinterfaces:
TrackPositionListener
@API(status=STABLE) public interface TrackPositionBeatListener extends TrackPositionListener
The listener interface for receiving updates when a new beat has occurred during track playback, when you want to know the actual new beat number (the beat packet itself does not carry this information, but the
TimeFinder
integrates it for you).Registering this extension of the
TrackPositionListener
interface withTimeFinder.addTrackPositionListener(int, TrackPositionListener)
will arrange fornewBeat(Beat, TrackPositionUpdate)
to be called whenever a player sends a beat, even if this does not represent an unexpected change in playback position (soTrackPositionListener.movementChanged(TrackPositionUpdate)
would not be called).- Author:
- James Elliott
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
newBeat(Beat beat, TrackPositionUpdate update)
Invoked when a beat is reported by a player for which we have aBeatGrid
.-
Methods inherited from interface org.deepsymmetry.beatlink.data.TrackPositionListener
movementChanged
-
-
-
-
Method Detail
-
newBeat
@API(status=STABLE) void newBeat(Beat beat, TrackPositionUpdate update)
Invoked when a beat is reported by a player for which we have a
BeatGrid
. The raw beat update is available inbeat
, and calculated beat number of the beat which is just beginning (as well as the playback position within the track that this represents) can be found inposition
.To reduce latency, beat announcements are delivered to listeners directly on the thread that is receiving them them from the network, so if you want to interact with user interface objects in this method, you need to use
javax.swing.SwingUtilities.invokeLater(Runnable)
to do so on the Event Dispatch Thread.Even if you are not interacting with user interface objects, any code in this method must finish quickly, or it will add latency for other listeners, and beat announcements will back up. If you want to perform lengthy processing of any sort, do so on another thread.
- Parameters:
beat
- the message which announced the start of the new beatupdate
- the latest information about the current track position and playback state and speed
-
-