Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into effects_refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Oct 18, 2021
2 parents 02e7b6a + 581803a commit 4f1e771
Show file tree
Hide file tree
Showing 74 changed files with 740 additions and 434 deletions.
36 changes: 21 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/soundio/soundmanagerutil.cpp
src/sources/audiosource.cpp
src/sources/audiosourcestereoproxy.cpp
src/sources/metadatasource.cpp
src/sources/metadatasourcetaglib.cpp
src/sources/readaheadframebuffer.cpp
src/sources/soundsource.cpp
Expand Down Expand Up @@ -2099,10 +2100,10 @@ target_include_directories(mixxx-lib SYSTEM PUBLIC lib/rigtorp/SPSCQueue/include

# Qt
if(QT6)
find_package(QT NAMES Qt6 COMPONENTS Core REQUIRED)
find_package(QT 6.2 NAMES Qt6 COMPONENTS Core REQUIRED)
set(QT6_NEW_COMPONENTS "SvgWidgets;Core5Compat")
else()
find_package(QT NAMES Qt5 COMPONENTS Core REQUIRED)
find_package(QT 5.12 NAMES Qt5 COMPONENTS Core REQUIRED)
endif()
find_package(Qt${QT_VERSION_MAJOR}
COMPONENTS
Expand Down Expand Up @@ -2155,30 +2156,30 @@ if(Qt_IS_STATIC)

target_link_libraries(mixxx-lib PRIVATE
# platform plugins
Qt5::QOffscreenIntegrationPlugin
Qt5::QMinimalIntegrationPlugin
Qt${QT_VERSION_MAJOR}::QOffscreenIntegrationPlugin
Qt${QT_VERSION_MAJOR}::QMinimalIntegrationPlugin

# imageformats plugins
Qt5::QGifPlugin
Qt5::QICOPlugin
Qt5::QJpegPlugin
Qt5::QSvgPlugin
Qt${QT_VERSION_MAJOR}::QGifPlugin
Qt${QT_VERSION_MAJOR}::QICOPlugin
Qt${QT_VERSION_MAJOR}::QJpegPlugin
Qt${QT_VERSION_MAJOR}::QSvgPlugin

# sqldrivers
Qt5::QSQLiteDriverPlugin
Qt${QT_VERSION_MAJOR}::QSQLiteDriverPlugin
)

if(WIN32)
target_link_libraries(mixxx-lib PRIVATE
Qt5::QWindowsIntegrationPlugin
Qt5::QWindowsVistaStylePlugin
Qt${QT_VERSION_MAJOR}::QWindowsIntegrationPlugin
Qt${QT_VERSION_MAJOR}::QWindowsVistaStylePlugin
)
endif()

if(APPLE)
target_link_libraries(mixxx-lib PRIVATE
Qt5::QCocoaIntegrationPlugin
Qt5::QMacStylePlugin
Qt${QT_VERSION_MAJOR}::QCocoaIntegrationPlugin
Qt${QT_VERSION_MAJOR}::QMacStylePlugin
)
endif()

Expand Down Expand Up @@ -2210,11 +2211,16 @@ if(APPLE)
)
endif()
elseif(UNIX AND NOT APPLE)
if(NOT QT6)
if(QT6)
find_package(X11)
else()
find_package(X11 REQUIRED)
find_package(Qt5 COMPONENTS X11Extras REQUIRED)
target_link_libraries(mixxx-lib PRIVATE Qt5::X11Extras)
endif()
if(${X11_FOUND})
target_include_directories(mixxx-lib SYSTEM PUBLIC "${X11_INCLUDE_DIR}")
target_link_libraries(mixxx-lib PRIVATE "${X11_LIBRARIES}" Qt5::X11Extras)
target_link_libraries(mixxx-lib PRIVATE "${X11_LIBRARIES}")
endif()
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus REQUIRED)
target_link_libraries(mixxx-lib PRIVATE
Expand Down
2 changes: 1 addition & 1 deletion packaging/CPackConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-source")
# dpkg --compare-versions 2.3~alpha~1234~g8163 lt 2.3~beta~1234~g8163 && echo true
# dpkg --compare-versions 2.3~beta~1234~g8163 lt 2.3.0 && echo true
# dpkg --compare-versions 2.3.0 lt 2.3.0+2345+g163 && echo true
if (PACKAGE_VERSION MATCHES "^[0-9][A-Za-z0-9.+~-]*$")
if (PACKAGE_VERSION MATCHES "^[0-9]+\\.[0-9]+[A-Za-z0-9.+~-]*$")
if (PACKAGE_VERSION MATCHES "(alpha|beta)")
string(REPLACE "-" "~" CPACK_DEBIAN_PACKAGE_VERSION "${PACKAGE_VERSION}")
else()
Expand Down
12 changes: 12 additions & 0 deletions packaging/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
mixxx (2.3.1-1~bionic) bionic; urgency=medium

* Build of 2.3.1

-- RJ Skerry-Ryan <[email protected]> Wed, 29 Sep 2021 19:08:14 +0000

mixxx (2.3.0-1~bionic) bionic; urgency=medium

* Build of 2.3.0

-- RJ Skerry-Ryan <[email protected]> Mon, 28 Jun 2021 20:45:05 +0000

mixxx (2.2.4-0ubuntu3) bionic; urgency=medium

* Bugfix release
Expand Down
36 changes: 28 additions & 8 deletions src/engine/controls/bpmcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ void BpmControl::adjustBeatsBpm(double deltaBpm) {
const auto centerBpm = mixxx::Bpm(math_max(kBpmAdjustMin, bpm.value() + deltaBpm));
mixxx::Bpm adjustedBpm = BeatUtils::roundBpmWithinRange(
centerBpm - kBpmAdjustStep / 2, centerBpm, centerBpm + kBpmAdjustStep / 2);
pTrack->trySetBeats(pBeats->setBpm(adjustedBpm));
const auto newBeats = pBeats->trySetBpm(adjustedBpm);
if (!newBeats) {
return;
}
pTrack->trySetBeats(*newBeats);
}

void BpmControl::slotAdjustBeatsFaster(double v) {
Expand Down Expand Up @@ -191,7 +195,10 @@ void BpmControl::slotTranslateBeatsEarlier(double v) {
if (pBeats) {
const double sampleOffset = frameInfo().sampleRate * -0.01;
const mixxx::audio::FrameDiff_t frameOffset = sampleOffset / mixxx::kEngineChannelCount;
pTrack->trySetBeats(pBeats->translate(frameOffset));
const auto translatedBeats = pBeats->tryTranslate(frameOffset);
if (translatedBeats) {
pTrack->trySetBeats(*translatedBeats);
}
}
}

Expand All @@ -208,7 +215,10 @@ void BpmControl::slotTranslateBeatsLater(double v) {
// TODO(rryan): Track::frameInfo is possibly inaccurate!
const double sampleOffset = frameInfo().sampleRate * 0.01;
const mixxx::audio::FrameDiff_t frameOffset = sampleOffset / mixxx::kEngineChannelCount;
pTrack->trySetBeats(pBeats->translate(frameOffset));
const auto translatedBeats = pBeats->tryTranslate(frameOffset);
if (translatedBeats) {
pTrack->trySetBeats(*translatedBeats);
}
}
}

Expand Down Expand Up @@ -245,7 +255,11 @@ void BpmControl::slotTapFilter(double averageLength, int numSamples) {
averageBpm = BeatUtils::roundBpmWithinRange(averageBpm - kBpmTabRounding,
averageBpm,
averageBpm + kBpmTabRounding);
pTrack->trySetBeats(pBeats->setBpm(averageBpm));
const auto newBeats = pBeats->trySetBpm(averageBpm);
if (!newBeats) {
return;
}
pTrack->trySetBeats(*newBeats);
}

// static
Expand Down Expand Up @@ -961,8 +975,11 @@ void BpmControl::slotBeatsTranslate(double v) {
if (pBeats) {
const auto currentPosition = frameInfo().currentPosition.toLowerFrameBoundary();
const auto closestBeat = pBeats->findClosestBeat(currentPosition);
const mixxx::audio::FrameDiff_t delta = currentPosition - closestBeat;
pTrack->trySetBeats(pBeats->translate(delta));
const mixxx::audio::FrameDiff_t frameOffset = currentPosition - closestBeat;
const auto translatedBeats = pBeats->tryTranslate(frameOffset);
if (translatedBeats) {
pTrack->trySetBeats(*translatedBeats);
}
}
}

Expand All @@ -980,8 +997,11 @@ void BpmControl::slotBeatsTranslateMatchAlignment(double v) {
// otherwise it will always return 0 if sync lock is active.
m_dUserOffset.setValue(0.0);

const mixxx::audio::FrameDiff_t frameOffset = getPhaseOffset(frameInfo().currentPosition);
pTrack->trySetBeats(pBeats->translate(-frameOffset));
const mixxx::audio::FrameDiff_t frameOffset = -getPhaseOffset(frameInfo().currentPosition);
const auto translatedBeats = pBeats->tryTranslate(frameOffset);
if (translatedBeats) {
pTrack->trySetBeats(*translatedBeats);
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/library/basetracktablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ QVariant BaseTrackTableModel::data(
DEBUG_ASSERT(bgColor.isValid());
DEBUG_ASSERT(m_backgroundColorOpacity >= 0.0);
DEBUG_ASSERT(m_backgroundColorOpacity <= 1.0);
bgColor.setAlphaF(m_backgroundColorOpacity);
bgColor.setAlphaF(static_cast<float>(m_backgroundColorOpacity));
return QBrush(bgColor);
}

Expand Down Expand Up @@ -646,7 +646,11 @@ QVariant BaseTrackTableModel::roleValue(
}
case ColumnCache::COLUMN_LIBRARYTABLE_LAST_PLAYED_AT: {
QDateTime lastPlayedAt;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (rawValue.metaType().id() == QMetaType::QString) {
#else
if (rawValue.type() == QVariant::String) {
#endif
// column value
lastPlayedAt = mixxx::sqlite::readGeneratedTimestamp(rawValue);
} else {
Expand Down
6 changes: 6 additions & 0 deletions src/library/coverart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@ QString typeToString(CoverInfo::Type type) {

quint16 calculateLegacyHash(
const QImage& image) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
auto legacyHash = qChecksum(QByteArrayView(
reinterpret_cast<const char*>(image.constBits()),
image.sizeInBytes()));
#else
auto legacyHash = qChecksum(
reinterpret_cast<const char*>(image.constBits()),
image.sizeInBytes());
#endif
// In rare cases the calculated checksum could be equal to the
// reserved value CoverInfo::defaultLegacyHash() which might cause
// unexpected behavior. In this case we simply invert all bits to
Expand Down
7 changes: 4 additions & 3 deletions src/library/coverartutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,19 @@ void CoverInfoGuesser::guessAndSetCoverInfoForTracks(
}
}

void guessTrackCoverInfoConcurrently(
QFuture<void> guessTrackCoverInfoConcurrently(
TrackPointer pTrack) {
VERIFY_OR_DEBUG_ASSERT(pTrack) {
return;
return {};
}
if (s_enableConcurrentGuessingOfTrackCoverInfo) {
QtConcurrent::run([pTrack] {
return QtConcurrent::run([pTrack] {
CoverInfoGuesser().guessAndSetCoverInfoForTrack(*pTrack);
});
} else {
// Disabled only during tests
CoverInfoGuesser().guessAndSetCoverInfoForTrack(*pTrack);
return {};
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/library/coverartutils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <QFuture>
#include <QImage>
#include <QList>
#include <QSize>
Expand Down Expand Up @@ -93,7 +94,7 @@ class CoverInfoGuesser {
// Guesses the cover art for the provided tracks by searching the tracks'
// metadata and folders for image files. All I/O is done in a separate
// thread.
void guessTrackCoverInfoConcurrently(TrackPointer pTrack);
[[nodiscard]] QFuture<void> guessTrackCoverInfoConcurrently(TrackPointer pTrack);

// Concurrent guessing of track covers during short running
// tests may cause spurious test failures due to timing issues.
Expand Down
25 changes: 18 additions & 7 deletions src/library/dao/analysisdao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,15 @@ QList<AnalysisDao::AnalysisInfo> AnalysisDao::loadAnalysesFromQuery(TrackId trac
int checksum = query->value(dataChecksumColumn).toInt();
QString dataPath = analysisPath.absoluteFilePath(
QString::number(info.analysisId));
QByteArray compressedData = loadDataFromFile(dataPath);
int file_checksum = qChecksum(compressedData.constData(),
compressedData.length());
const QByteArray compressedData = loadDataFromFile(dataPath);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const int file_checksum = qChecksum(
compressedData);
#else
const int file_checksum = qChecksum(
compressedData.constData(),
compressedData.length());
#endif
if (checksum != file_checksum) {
qDebug() << "WARNING: Corrupt analysis loaded from" << dataPath
<< "length" << compressedData.length();
Expand Down Expand Up @@ -114,10 +120,15 @@ bool AnalysisDao::saveAnalysis(AnalysisDao::AnalysisInfo* info) {
PerformanceTimer time;
time.start();

QByteArray compressedData = qCompress(info->data, kCompressionLevel);
int checksum = qChecksum(compressedData.constData(),
compressedData.length());

const QByteArray compressedData = qCompress(info->data, kCompressionLevel);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const int checksum = qChecksum(
compressedData);
#else
const int checksum = qChecksum(
compressedData.constData(),
compressedData.length());
#endif
QSqlQuery query(m_database);
if (info->analysisId == -1) {
query.prepare(QString(
Expand Down
2 changes: 1 addition & 1 deletion src/library/dao/settingsdao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ QString SettingsDAO::getValue(const QString& name, QString defaultValue) const {
}

bool SettingsDAO::setValue(const QString& name, const QVariant& value) const {
VERIFY_OR_DEBUG_ASSERT(value.canConvert(QMetaType::QString)) {
VERIFY_OR_DEBUG_ASSERT(value.canConvert<QString>()) {
return false;
}

Expand Down
32 changes: 28 additions & 4 deletions src/library/dao/trackdao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "library/dao/libraryhashdao.h"
#include "library/dao/playlistdao.h"
#include "library/dao/trackschema.h"
#include "library/library_prefs.h"
#include "library/queryutil.h"
#include "library/trackset/crate/cratestorage.h"
#include "moc_trackdao.cpp"
Expand Down Expand Up @@ -648,7 +649,11 @@ bool insertTrackLibrary(
pTrackLibraryInsert->bindValue(":mixxx_deleted", 0);

// We no longer store the wavesummary in the library table.
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
pTrackLibraryInsert->bindValue(":wavesummaryhex", QVariant(QMetaType(QMetaType::QByteArray)));
#else
pTrackLibraryInsert->bindValue(":wavesummaryhex", QVariant(QVariant::ByteArray));
#endif

VERIFY_OR_DEBUG_ASSERT(pTrackLibraryInsert->exec()) {
// We failed to insert the track. Maybe it is already in the library
Expand Down Expand Up @@ -849,8 +854,10 @@ TrackPointer TrackDAO::addTracksAddFile(

// Initially (re-)import the metadata for the newly created track
// from the file.
SoundSourceProxy(pTrack).updateTrackFromSource();
if (!pTrack->isSourceSynchronized()) {
SoundSourceProxy(pTrack).updateTrackFromSource(
m_pConfig,
SoundSourceProxy::UpdateTrackFromSourceMode::Once);
if (!pTrack->checkSourceSynchronized()) {
qWarning() << "TrackDAO::addTracksAddFile:"
<< "Failed to parse track metadata from file"
<< pTrack->getLocation();
Expand Down Expand Up @@ -1487,7 +1494,22 @@ TrackPointer TrackDAO::getTrackById(TrackId trackId) const {
// file. This import might have never been completed successfully
// before, so just check and try for every track that has been
// freshly loaded from the database.
SoundSourceProxy(pTrack).updateTrackFromSource();
auto updateTrackFromSourceMode =
SoundSourceProxy::UpdateTrackFromSourceMode::Once;
if (m_pConfig &&
m_pConfig->getValueString(
mixxx::library::prefs::kSyncTrackMetadataConfigKey)
.toInt() == 1) {
// An implicit re-import and update is performed if the
// user has enabled export of file tags in the preferences.
// Either they want to keep their file tags synchronized or
// not, no exceptions!
updateTrackFromSourceMode =
SoundSourceProxy::UpdateTrackFromSourceMode::Newer;
}
SoundSourceProxy(pTrack).updateTrackFromSource(
m_pConfig,
updateTrackFromSourceMode);
if (kLogger.debugEnabled() && pTrack->isDirty()) {
kLogger.debug()
<< "Updated track metadata from file tags:"
Expand Down Expand Up @@ -2181,7 +2203,9 @@ TrackPointer TrackDAO::getOrAddTrack(

// If the track wasn't in the library already then it has not yet
// been checked for cover art.
guessTrackCoverInfoConcurrently(pTrack);
const auto future = guessTrackCoverInfoConcurrently(pTrack);
// Don't wait for the result and keep running in the background
Q_UNUSED(future)

return pTrack;
}
Expand Down
Loading

0 comments on commit 4f1e771

Please sign in to comment.