Skip to content

Commit b2a8133

Browse files
committed
Better track time for unanalyzed CDJ-3000 tracks.
1 parent 300b894 commit b2a8133

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This change log follows the conventions of
1515
- A setting has been added to the `TimeFinder` to prevent it from using precise position packets sent by CDJ-3000s.
1616
They help keep tighter synchronization with playback position, but currently seem to exhibit too much jitter for use when synchronizing with audio sources over Ableton Link.
1717
This setting is a workaround until a smoothing solution is developed.
18+
- When we are using precise position packets, though, we now do a better job of tracking the position of CDJ-3000s that are playing unanalyzed tracks (and which thus have no beat grids).
1819
- When we unexpectedly are unable to route a message to a CDJ, we now log extensive troubleshooting information about the address we are trying to send to and the state of the network interfaces at that moment.
1920

2021
### Fixed

src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,8 @@ private long timeOfBeat(BeatGrid beatGrid, int beatNumber, DeviceUpdate update)
566566
updates.put(device, beat);
567567
// logger.info("Beat: " + beat.getBeatWithinBar());
568568
final BeatGrid beatGrid = BeatGridFinder.getInstance().getLatestBeatGridFor(beat);
569+
TrackPositionUpdate lastPosition = positions.get(device);
569570
if (beatGrid != null) {
570-
TrackPositionUpdate lastPosition = positions.get(device);
571571
int beatNumber;
572572
if (lastPosition == null || lastPosition.beatGrid != beatGrid) {
573573
// We don’t handle beat packets received before any status packets for the player. This will
@@ -594,8 +594,13 @@ private long timeOfBeat(BeatGrid beatGrid, int beatNumber, DeviceUpdate update)
594594
positions.put(device, newPosition);
595595
updateListenersIfNeeded(device, newPosition, beat);
596596
} else {
597-
positions.remove(device); // We can't determine where the player is.
598-
updateListenersIfNeeded(device, null, beat);
597+
// We can't determine where the player is. That's ok if it is sending us precise position packets,
598+
// (e.g. a CDJ-3000 playing an unanalyzed track), we will just wait for the next one in that case.
599+
// Otherwise, clear our notion of the playback position.
600+
if (!lastPosition.precise) {
601+
positions.remove(device);
602+
updateListenersIfNeeded(device, null, beat);
603+
}
599604
}
600605
}
601606
};

0 commit comments

Comments
 (0)