Class TrackPositionUpdate


  • public class TrackPositionUpdate
    extends Object
    Keeps track of the most recent information we have received from a player from which we have been able to compute a track position.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      BeatGrid beatGrid
      The track metadata against which this update was calculated, so that if it has changed, we know to discard the update.
      int beatNumber
      The beat number that was reported (or incremented) by this update.
      boolean definitive
      If true, this was created in response to a beat packet, so we know exactly where the player was at that point.
      long milliseconds
      How far into the track has the player reached.
      double pitch
      The playback pitch when this update was created.
      boolean playing
      If true, the player reported that it was playing when the update was received.
      boolean reverse
      If true, the player was playing backwards when this update was created.
      long timestamp
      When this update was received.
    • Constructor Summary

      Constructors 
      Constructor Description
      TrackPositionUpdate​(long timestamp, long milliseconds, int beatNumber, boolean definitive, boolean playing, double pitch, boolean reverse, BeatGrid beatGrid)
      Constructor simply sets the fields of this immutable value class.
    • Field Detail

      • timestamp

        public final long timestamp
        When this update was received.
      • milliseconds

        public final long milliseconds
        How far into the track has the player reached.
      • beatNumber

        public final int beatNumber
        The beat number that was reported (or incremented) by this update.
      • definitive

        public final boolean definitive
        If true, this was created in response to a beat packet, so we know exactly where the player was at that point. Otherwise, we infer position based on how long has elapsed since the previous beat packet, and the intervening playback pitch and direction.
      • playing

        public final boolean playing
        If true, the player reported that it was playing when the update was received.
      • pitch

        public final double pitch
        The playback pitch when this update was created.
      • reverse

        public final boolean reverse
        If true, the player was playing backwards when this update was created.
      • beatGrid

        public final BeatGrid beatGrid
        The track metadata against which this update was calculated, so that if it has changed, we know to discard the update.
    • Constructor Detail

      • TrackPositionUpdate

        public TrackPositionUpdate​(long timestamp,
                                   long milliseconds,
                                   int beatNumber,
                                   boolean definitive,
                                   boolean playing,
                                   double pitch,
                                   boolean reverse,
                                   BeatGrid beatGrid)
        Constructor simply sets the fields of this immutable value class.
        Parameters:
        timestamp - when this update was received
        milliseconds - how far into the track has the player reached
        beatNumber - the beat number that was reported (or incremented) by this update
        definitive - indicates if this was based on a direct report of track position from the player (i.e. a beat)
        playing - indicates whether the player was actively playing a track when this update was received
        pitch - the playback pitch (where 1.0 is normal speed) when this update was received
        reverse - indicates if the player was playing backwards when this update was received
        beatGrid - the track beat grid that was used to calculate the update