Skip to content

Commit

Permalink
Merge branch '2.3' of [email protected]:mixxxdj/mixxx.git
Browse files Browse the repository at this point in the history
# Conflicts:
#	CMakeLists.txt
#	cmake/modules/Findhidapi.cmake
  • Loading branch information
uklotzde committed Mar 19, 2021
2 parents 002fd89 + 05d3a6d commit be05257
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2605,7 +2605,8 @@ find_package(LibUSB)
# USB HID controller support
find_package(hidapi)
option(HID "USB HID controller support" ON)
default_option(HIDAPI_STATIC "Link HIDAPI library statically" "NOT HIDAPI_FOUND OR hidapi_VERSION VERSION_LESS '0.10.0'")
# hidapi_VERSION is only available starting with 0.10.0
default_option(HIDAPI_STATIC "Link HIDAPI library statically" "NOT hidapi_FOUND OR NOT hidapi_VERSION OR hidapi_VERSION VERSION_LESS 0.10.0")
if(HID)
target_sources(mixxx-lib PRIVATE
src/controllers/hid/hidcontroller.cpp
Expand Down
5 changes: 4 additions & 1 deletion cmake/modules/Findhidapi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ if (EXISTS "${hidapi_INCLUDE_DIR}/hidapi.h")
set(hidapi_VERSION_MINOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define HID_API_VERSION_PATCH ([0-9]+)" _dummy "${hidapi_H_CONTENTS}")
set(hidapi_VERSION_PATCH "${CMAKE_MATCH_1}")
set(hidapi_VERSION "${hidapi_VERSION_MAJOR}.${hidapi_VERSION_MINOR}.${hidapi_VERSION_PATCH}")
# hidapi_VERSION is only available starting with 0.10.0
if (hidapi_VERSION_MAJOR AND hidapi_VERSION_MINOR AND hidapi_VERSION_PATCH)
set(hidapi_VERSION "${hidapi_VERSION_MAJOR}.${hidapi_VERSION_MINOR}.${hidapi_VERSION_PATCH}")
endif()
endif ()

if(hidapi_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion src/engine/sync/internalclock.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

#include "engine/sync/clock.h"
#include "engine/sync/syncable.h"
#include "engine/channels/enginechannel.h"

class ControlObject;
class ControlLinPotmeter;
class ControlPushButton;
class EngineSync;
class EngineChannel;

/// Internal Clock is a Master Sync object that provides a source of constant
/// tempo when needed. The EngineSync will decide when to make the Internal
Expand Down
10 changes: 10 additions & 0 deletions src/track/cueinfoimporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ CueInfoImporter::CueInfoImporter(const QList<CueInfo>& cueInfos)
: m_cueInfos(cueInfos) {
}

bool CueInfoImporter::hasCueOfType(CueType cueType) const {
for (const CueInfo& cueInfo : qAsConst(m_cueInfos)) {
if (cueInfo.getType() == cueType) {
return true;
}
}

return false;
}

double CueInfoImporter::guessTimingOffsetMillis(
const QString& filePath,
const audio::SignalInfo& signalInfo) const {
Expand Down
3 changes: 3 additions & 0 deletions src/track/cueinfoimporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class CueInfoImporter {
explicit CueInfoImporter(const QList<CueInfo>& cueInfos);
virtual ~CueInfoImporter() = default;

/// Returns true if the importer has any cue(s) of the given cueType.
virtual bool hasCueOfType(CueType cueType) const;

/// Returns audio signal dependent timing offset correction.
/// The default implementation just returns 0, but this can be overridden
/// in subclasses.
Expand Down
12 changes: 12 additions & 0 deletions src/track/serato/cueinfoimporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

namespace mixxx {

bool SeratoCueInfoImporter::hasCueOfType(CueType cueType) const {
// Make this a little more efficient by skipping cue types this importer
// will never contain.
switch (cueType) {
case CueType::HotCue:
case CueType::Loop:
return CueInfoImporter::hasCueOfType(cueType);
default:
return false;
}
}

/// This method simply calls SeratoTags::guessTimingOffsetMillis() and returns
/// its result. We also need the timing offset for exporting our cues to
/// Serato, so the actual cue offset calculation remains a static method of
Expand Down
2 changes: 2 additions & 0 deletions src/track/serato/cueinfoimporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class SeratoCueInfoImporter : public CueInfoImporter {

~SeratoCueInfoImporter() override = default;

bool hasCueOfType(CueType cueType) const override;

double guessTimingOffsetMillis(
const QString& filePath,
const audio::SignalInfo& signalInfo) const override;
Expand Down
11 changes: 10 additions & 1 deletion src/track/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,16 @@ bool Track::importPendingCueInfosWhileLocked() {
DEBUG_ASSERT(sampleRate ==
m_record.getMetadata().getStreamInfo().getSignalInfo().getSampleRate());
QList<CuePointer> cuePoints;
cuePoints.reserve(m_pCueInfoImporterPending->size());
cuePoints.reserve(m_pCueInfoImporterPending->size() + m_cuePoints.size());

// Preserve all existing cues with types that are not available for
// importing.
for (const CuePointer& pCue : qAsConst(m_cuePoints)) {
if (!m_pCueInfoImporterPending->hasCueOfType(pCue->getType())) {
cuePoints.append(pCue);
}
}

const auto cueInfos =
m_pCueInfoImporterPending->importCueInfosAndApplyTimingOffset(
getLocation(), m_record.getStreamInfoFromSource()->getSignalInfo());
Expand Down

0 comments on commit be05257

Please sign in to comment.