Skip to content

Commit

Permalink
Start using precise position for CDJ-3000s
Browse files Browse the repository at this point in the history
There are glitches around beats that need to be investigated and
fixed, but this is a huge start.
  • Loading branch information
brunchboy committed Oct 8, 2023
1 parent b755c0b commit 1a81435
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ This change log follows the conventions of

### Added

- Precise position packets from CDJ-3000s are used to be able to track
movement inside beats, and much more tightly than was possible using
the interpolation methods required for older players.
- New command-line options allowing you to reset the configuration to
a default value if you are having problems, launch with a saved
configuration, open additional show files on startup, or suppress
Expand Down
11 changes: 10 additions & 1 deletion src/beat_link_trigger/players.clj
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@
(:time simulator)
(and (.isRunning time-finder) (.getTimeFor time-finder n))))

(defn precise?
"Checks whether we are receving precise position packets for the
specified player."
[^Long n]
(when-not (simulator/for-player n)
(when (.isRunning time-finder)
(when-let [position (.getLatestPositionFor time-finder n)]
(.-precise position)))))

(defn- playing?
"Returns `true` if the specified player can be determined to be
playing right now."
Expand Down Expand Up @@ -259,7 +268,7 @@
(.setRenderingHint g RenderingHints/KEY_ANTIALIASING RenderingHints/VALUE_ANTIALIAS_ON)
(.setPaint g (if remain (Color. 255 200 200) (Color/WHITE)))
(.setFont g (util/get-display-font :teko Font/PLAIN 16))
(.drawString g (if remain "Remain" "Time") (int 4) (int 16))
(.drawString g (if remain "Remain" (if (precise? n) "Precise Time" "Time")) (int 4) (int 16))
(if (and (not ms) (pre-nexus n))
(do ; Report that we can't display time information, as this is a pre-nexus device.
(.setFont g (util/get-display-font :teko Font/PLAIN 19))
Expand Down

0 comments on commit 1a81435

Please sign in to comment.