Interface SyncListener


  • public interface SyncListener
    The listener interface for receiving sync control messages. Classes that are interested in knowing when they are being instructed to turn sync mode on or off, or to become the tempo master, can implement this interface. The listener object created is then registered using BeatFinder.addSyncListener(SyncListener). Whenever a relevant message is received, the setSyncMode(boolean) or becomeMaster() method in the listener object is invoked.
    Author:
    James Elliott
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void becomeMaster()
      Invoked when we have received a message telling us to take over the role of tempo master.
      void setSyncMode​(boolean synced)
      Invoked when we have received a message telling us to turn sync mode on or off.
    • Method Detail

      • setSyncMode

        void setSyncMode​(boolean synced)
        Invoked when we have received a message telling us to turn sync mode on or off.

        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:
        synced - will be true when we should turn sync mode on
      • becomeMaster

        void becomeMaster()
        Invoked when we have received a message telling us to take over the role of tempo master.

        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.