Skip to content

Commit

Permalink
Add CMake option to enable TRACKSIMILARITY
Browse files Browse the repository at this point in the history
  • Loading branch information
danferns committed Aug 13, 2024
1 parent 5445735 commit e3b80ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3693,6 +3693,12 @@ if(QTKEYCHAIN)
target_include_directories(mixxx-lib SYSTEM PUBLIC ${QTKEYCHAIN_INCLUDE_DIRS})
endif()

# Track Similarity
option(TRACKSIMILARITY "Display harmonic similarity of tracks in the Library" OFF)
if(TRACKSIMILARITY)
target_compile_definitions(mixxx-lib PUBLIC __TRACKSIMILARITY__)
endif()

# USB HID or/and Bulk controller support
find_package(LibUSB)

Expand Down
2 changes: 2 additions & 0 deletions src/library/basetracktablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ QVariant BaseTrackTableModel::roleValue(
case ColumnCache::COLUMN_LIBRARYTABLE_RATING:
case ColumnCache::COLUMN_LIBRARYTABLE_TIMESPLAYED:
return rawValue;
#ifdef __TRACKSIMILARITY__
case ColumnCache::COLUMN_LIBRARYTABLE_KEY: {
const QVariant keyCodeValue = rawSiblingValue(
index,
Expand Down Expand Up @@ -774,6 +775,7 @@ QVariant BaseTrackTableModel::roleValue(
const auto similarity = KeyUtils::trackSimilarity(targetKey, targetBpm, key, bpm);
return QVariant(similarity);
}
#endif
default:
// Same value as for Qt::DisplayRole (see below)
break;
Expand Down

0 comments on commit e3b80ac

Please sign in to comment.