- java.lang.Object
 - 
- org.deepsymmetry.beatlink.MasterAdapter
 
 
- 
- All Implemented Interfaces:
 BeatListener,MasterListener
@API(status=STABLE) public abstract class MasterAdapter extends Object implements MasterListener
An abstract adapter class for receiving updates related to the tempo master. The methods in this class are empty; it exists as a convenience for creating listener objects.
Extend this class to create a
MasterListenerand override only the methods for events that you care about. If you plan to implement all the methods in the interface, you might as well implementMasterListenerdirectly.Create a listener object using your extended class and then register it using
VirtualCdj.addMasterListener(MasterListener). Whenever a relevant change occurs, the appropriate method in the listener object is invoked, and theDeviceUpdatewhich reported the change is passed to it.- Author:
 - James Elliott
 
 
- 
- 
Constructor Summary
Constructors Constructor Description MasterAdapter() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidmasterChanged(DeviceUpdate update)Invoked when there is a change in which device is the current tempo master.voidnewBeat(Beat beat)Invoked when a beat is reported on the network.voidtempoChanged(double tempo)Invoked when the master tempo has changed. 
 - 
 
- 
- 
Method Detail
- 
masterChanged
public void masterChanged(DeviceUpdate update)
Description copied from interface:MasterListenerInvoked when there is a change in which device is the current tempo master.
To reduce latency, tempo master updates are delivered to listeners directly on the thread that is receiving 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 master updates will back up. If you want to perform lengthy processing of any sort, do so on another thread.
- Specified by:
 masterChangedin interfaceMasterListener- Parameters:
 update- the message identifying the new master, ornullif there is now none
 
- 
newBeat
public void newBeat(Beat beat)
Description copied from interface:BeatListenerInvoked 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 theTimeFinderis running, it will have been informed of the beat before any other beat listeners, 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 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.
- Specified by:
 newBeatin interfaceBeatListener- Parameters:
 beat- the message which announced the start of the new beat
 
- 
tempoChanged
public void tempoChanged(double tempo)
Description copied from interface:MasterListenerInvoked when the master tempo has changed.
To reduce latency, tempo master updates are delivered to listeners directly on the thread that is receiving 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 master updates will back up. If you want to perform lengthy processing of any sort, do so on another thread.
- Specified by:
 tempoChangedin interfaceMasterListener- Parameters:
 tempo- the new master tempo
 
 - 
 
 -