Skip to content

Commit

Permalink
Mask menu item type field with 0xffff to cope with CDJ-3000 change
Browse files Browse the repository at this point in the history
  • Loading branch information
brunchboy committed Nov 20, 2023
1 parent d3341aa commit ae6b57f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ This change log follows the conventions of
packets sent by the CDJ-3000 use the humane approach.
- A convenience method on `TrackPositionUpdate` which returns the beat within
bar represented by that track position.
- We can now recognize loaded menu items that represent a track title plus
musical key.

### Fixed

Expand All @@ -42,6 +44,9 @@ This change log follows the conventions of

- The `TrackPositionUpdate` class has a new field, `precise`, which reports whether
we are receiving precise position updates from the player.
- When determining the item type of a menu item response message, we now mask the
menu item type (field 7) with `0xffff`, because CDJ-3000s seem to send additional
(as yet unknown) information in the higher-order bytes.


## [7.2.0] - 2023-08-13
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/org/deepsymmetry/beatlink/dbserver/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,12 @@ public enum MenuItemType {
*/
TRACK_TITLE_AND_LABEL (0x0e04),
/**
* Reports the title and bit rate of a track, return when listing playlists or all tracks sorted by bit rate,
* Reports the title and key of a track, returned when listing playlists or all tracks sorted by key,
* or in their default sort order when the DJ has set this as the default second column for track lists.
*/
TRACK_TITLE_AND_KEY (0xf04),
/**
* Reports the title and bit rate of a track, returned when listing playlists or all tracks sorted by bit rate,
* or in their default sort order when the DJ has set this as the default second column for track lists.
*/
TRACK_TITLE_AND_RATE (0x1004),
Expand Down Expand Up @@ -1073,7 +1078,7 @@ public MenuItemType getMenuItemType() {
throw new IllegalArgumentException("getMenuItemType() can only be used with MENU_ITEM responses.");
}
final NumberField type = (NumberField)arguments.get(6);
final MenuItemType result = MENU_ITEM_TYPE_MAP.get(type.getValue());
final MenuItemType result = MENU_ITEM_TYPE_MAP.get(type.getValue() & 0xffff);
if (result == null) {
return MenuItemType.UNKNOWN;
}
Expand Down

0 comments on commit ae6b57f

Please sign in to comment.