Interface BeatListener
-
- All Known Subinterfaces:
MasterListener
- All Known Implementing Classes:
MasterAdapter
public interface BeatListener
The listener interface for receiving beat announcements. Classes that are interested in knowing when DJ Link devices report beats can implement this interface. The listener object created from that class is then registered usingBeatFinder.addBeatListener(BeatListener)
. Whenever a new beat starts, thenewBeat(Beat)
method in the listener object is invoked with it.- Author:
- James Elliott
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
newBeat(Beat beat)
Invoked when a beat is reported on the network.
-
-
-
Method Detail
-
newBeat
void newBeat(Beat beat)
Invoked when a beat is reported on the network. Even though beats contain far less detailed information than status updates, they can be passed to
VirtualCdj.getLatestStatusFor(DeviceUpdate)
to find the current detailed status for that device, as long as the Virtual CDJ is active. Also, if theTimeFinder
is running, it will have been informed of the beat before any other beat lsteners, so you can use itsTimeFinder.getTimeFor(DeviceUpdate)
method to find out the actual beat number even though it is not part of the packet itself.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 beat
-
-