Interface MasterListener

  • All Superinterfaces:
    BeatListener
    All Known Implementing Classes:
    MasterAdapter

    public interface MasterListener
    extends BeatListener

    The listener interface for receiving updates about changes to tempo master state. Classes that are interested in knowing when a different device becomes tempo master, the tempo master starts a new beat, or the master tempo itself changes can either implement this interface (and all the methods it contains) or extend the abstract MasterAdapter class (overriding only the methods of interest). The listener object created from that class is then registered using VirtualCdj.addMasterListener(MasterListener). Whenever a relevant change occurs, the appropriate method in the listener object is invoked.

    Note that in order for beats to be reported, the BeatFinder must be active as well.

    Author:
    James Elliott
    • Method Detail

      • masterChanged

        void masterChanged​(DeviceUpdate update)

        Invoked 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.

        Parameters:
        update - the message identifying the new master, or null if there is now none
      • tempoChanged

        void tempoChanged​(double tempo)

        Invoked 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.

        Parameters:
        tempo - the new master tempo