public class BeatFinder extends Object
When players are stopped, they do not send beat packets, but the mixer continues sending them
at the last BPM reported by the master player, so it acts as the most reliable synchronization
source. The mixer does not make any effort to keep its notion of measures (down beats) consistent
with any player, however. So systems which want to stay in sync with measures as well as beats
will want to use the VirtualCdj to maintain awareness of which player is the master player.
| Modifier and Type | Field and Description |
|---|---|
static int |
BEAT_PORT
The port to which devices broadcast beat messages.
|
| Constructor and Description |
|---|
BeatFinder() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addBeatListener(BeatListener listener)
Adds the specified beat listener to receive beat announcements when DJ Link devices broadcast
them on the network.
|
static Set<BeatListener> |
getBeatListeners()
Get the set of beat listeners that are currently registered.
|
static boolean |
isActive()
Check whether we are presently listening for beat packets.
|
static void |
removeBeatListener(BeatListener listener)
Removes the specified beat listener so that it no longer receives beat announcements when
DJ Link devices broadcast them to the network.
|
static void |
start()
Start listening for beat announcements.
|
static void |
stop()
Stop listening for beats.
|
public static final int BEAT_PORT
public static boolean isActive()
true if our socket is open and monitoring for DJ Link beat packets on the networkpublic static void start()
throws SocketException
SocketException - if the socket to listen on port 50001 cannot be createdpublic static void stop()
public static void addBeatListener(BeatListener listener)
listener is null or already present in the list
of registered listeners, no exception is thrown and no action is performed.
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 listener methods, 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 the listener 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.
listener - the beat listener to addpublic static void removeBeatListener(BeatListener listener)
listener is null or not present
in the list of registered listeners, no exception is thrown and no action is performed.listener - the beat listener to removepublic static Set<BeatListener> getBeatListeners()
Copyright © 2016 Deep Symmetry, LLC. All rights reserved.