Interface MasterHandoffListener
-
public interface MasterHandoffListener
The listener interface for receiving tempo master handoff messages. Classes that are interested in knowing when they are being instructed to yield the tempo master role to another device, or when a device they have asked to yield it to them has responded, can implement this interface. The listener object created is then registered usingBeatFinder.addMasterHandoffListener(MasterHandoffListener)
. Whenever a relevant message is received, theyieldMasterTo(int)
oryieldResponse(int, boolean)
method in the listener object is invoked.- Author:
- James Elliott
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
yieldMasterTo(int deviceNumber)
Invoked when we have received a message asking us to yield the tempo master role to another device.void
yieldResponse(int deviceNumber, boolean yielded)
Invoked when we have received a response from a device we have asked to yield the tempo master role to us.
-
-
-
Method Detail
-
yieldMasterTo
void yieldMasterTo(int deviceNumber)
Invoked when we have received a message asking us to yield the tempo master role to another device.To reduce latency, handoff messages 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:
deviceNumber
- identifies the device that we are supposed to hand the tempo master role to
-
yieldResponse
void yieldResponse(int deviceNumber, boolean yielded)
Invoked when we have received a response from a device we have asked to yield the tempo master role to us.To reduce latency, sync commands 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:
deviceNumber
- identifies the device that is agreeing to hand the tempo master role to usyielded
- will betrue
to indicate it is time for us to be the tempo master
-
-