Package org.deepsymmetry.beatlink.data
Class TrackPositionUpdate
- java.lang.Object
-
- org.deepsymmetry.beatlink.data.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 BeatGridbeatGridThe track metadata against which this update was calculated, so that if it has changed, we know to discard the update.intbeatNumberThe beat number that was reported (or incremented) by this update.booleandefinitiveIftrue, this was created in response to a beat packet, so we know exactly where the player was at that point.longmillisecondsHow far into the track has the player reached.doublepitchThe playback pitch when this update was created.booleanplayingIftrue, the player reported that it was playing when the update was received.booleanreverseIftrue, the player was playing backwards when this update was created.longtimestampWhen 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
Iftrue, 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
Iftrue, 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
Iftrue, 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 receivedmilliseconds- how far into the track has the player reachedbeatNumber- the beat number that was reported (or incremented) by this updatedefinitive- 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 receivedpitch- the playback pitch (where 1.0 is normal speed) when this update was receivedreverse- indicates if the player was playing backwards when this update was receivedbeatGrid- the track beat grid that was used to calculate the update
-
-