Skip to content

Commit

Permalink
Merge branch 'main' into synclock-05-explicitload
Browse files Browse the repository at this point in the history
  • Loading branch information
ywwg committed Jul 22, 2021
2 parents 1a1cc2d + 0fb764a commit a5b0969
Show file tree
Hide file tree
Showing 49 changed files with 694 additions and 599 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/util/sandbox.cpp
src/util/semanticversion.cpp
src/util/screensaver.cpp
src/util/screensavermanager.cpp
src/util/sleepableqthread.cpp
src/util/stat.cpp
src/util/statmodel.cpp
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/FindLibUSB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ find_path(LibUSB_INCLUDE_DIR
mark_as_advanced(LibUSB_INCLUDE_DIR)

find_library(LibUSB_LIBRARY
NAMES usb-1.0
NAMES usb-1.0 usb
PATHS ${PC_LibUSB_LIBRARY_DIRS}
DOC "LibUSB library"
)
Expand Down
2 changes: 1 addition & 1 deletion lib/rigtorp/SPSCQueue/include/rigtorp/SPSCQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ template <typename T, typename Allocator = std::allocator<T>> class SPSCQueue {
// on macOS there is a bug in libc++ where __cpp_lib_hardware_interference_size
// is defined but std::hardware_destructive_interference_size is not actually implemented
// https://bugs.llvm.org/show_bug.cgi?id=41423
#if defined(__cpp_lib_hardware_interference_size) && ! defined(__APPLE__)
#if defined(__cpp_lib_hardware_interference_size) && ! defined(__APPLE__) && ! defined(__BSD__)
static constexpr size_t kCacheLineSize =
std::hardware_destructive_interference_size;
#else
Expand Down
2 changes: 1 addition & 1 deletion res/skins/LateNight/style_palemoon.qss
Original file line number Diff line number Diff line change
Expand Up @@ -2444,7 +2444,7 @@ QPushButton#pushButtonShuffle:enabled {
image: url(skin:/palemoon/buttons/btn__autodj_shuffle.svg) no-repeat center center;
}

QPushButton#pushButtonAddRandom:enabled {
QPushButton#pushButtonAddRandomTrack:enabled {
image: url(skin:/palemoon/buttons/btn__autodj_addrandom.svg) no-repeat center center;
}

Expand Down
48 changes: 22 additions & 26 deletions src/control/controlproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
#include "preferences/usersettings.h"
#include "util/platform.h"

// This class is the successor of ControlObjectThread. It should be used for
// new code to avoid unnecessary locking during send if no slot is connected.
// Do not (re-)connect slots during runtime, since this locks the mutex in
// QMetaObject::activate().
// Be sure that the ControlProxy is created and deleted from the same
// thread, otherwise a pending signal may lead to a segfault (Bug #1406124).
// Parent it to the the creating object to achieve this.
/// This class is the successor of ControlObjectThread. It should be used for
/// new code to avoid unnecessary locking during send if no slot is connected.
/// Do not (re-)connect slots during runtime, since this locks the mutex in
/// QMetaObject::activate().
/// Be sure that the ControlProxy is created and deleted from the same
/// thread, otherwise a pending signal may lead to a segfault (Bug #1406124).
/// Parent it to the the creating object to achieve this.
class ControlProxy : public QObject {
Q_OBJECT
public:
Expand Down Expand Up @@ -108,7 +108,7 @@ class ControlProxy : public QObject {
return true;
}

// Called from update();
/// Called from update();
virtual void emitValueChanged() {
emit valueChanged(get());
}
Expand All @@ -117,49 +117,45 @@ class ControlProxy : public QObject {
return m_pControl != nullptr;
}

// Returns the value of the object. Thread safe, non-blocking.
/// Returns the value of the object. Thread safe, non-blocking.
inline double get() const {
return m_pControl ? m_pControl->get() : 0.0;
}

// Returns the bool interpretation of the value
/// Returns the bool interpretation of the value. Thread safe, non-blocking.
inline bool toBool() const {
return get() > 0.0;
}

// Returns the parameterized value of the object. Thread safe, non-blocking.
/// Returns the parameterized value of the object. Thread safe, non-blocking.
inline double getParameter() const {
return m_pControl ? m_pControl->getParameter() : 0.0;
}

// Returns the parameterized value of the object. Thread safe, non-blocking.
/// Returns the parameterized value of the object. Thread safe, non-blocking.
inline double getParameterForValue(double value) const {
return m_pControl ? m_pControl->getParameterForValue(value) : 0.0;
}

// Returns the normalized parameter of the object. Thread safe, non-blocking.
/// Returns the normalized parameter of the object. Thread safe, non-blocking.
inline double getDefault() const {
return m_pControl ? m_pControl->defaultValue() : 0.0;
}

public slots:
// Set the control to a new value. Non-blocking.
inline void slotSet(double v) {
set(v);
}
// Sets the control value to v. Thread safe, non-blocking.
/// Sets the control value to v. Thread safe, non-blocking.
void set(double v) {
if (m_pControl) {
m_pControl->set(v, this);
}
}
// Sets the control parameterized value to v. Thread safe, non-blocking.
/// Sets the control parameterized value to v. Thread safe, non-blocking.
void setParameter(double v) {
if (m_pControl) {
m_pControl->setParameter(v, this);
}
}
// Resets the control to its default value. Thread safe, non-blocking.
/// Resets the control to its default value. Thread safe, non-blocking.
void reset() {
if (m_pControl) {
// NOTE(rryan): This is important. The originator of this action does
Expand All @@ -172,28 +168,28 @@ class ControlProxy : public QObject {
}

signals:
// This signal must not connected by connect(). Use connectValueChanged()
// instead. It will connect to the base ControlDoublePrivate as well.
/// This signal must not connected by connect(). Use connectValueChanged()
/// instead. It will connect to the base ControlDoublePrivate as well.
void valueChanged(double);

protected slots:
// Receives the value from the master control by a unique direct connection
/// Receives the value from the master control by a unique direct connection
void slotValueChangedDirect(double v, QObject* pSetter) {
if (pSetter != this) {
// This is base implementation of this function without scaling
emit valueChanged(v);
}
}

// Receives the value from the master control by a unique auto connection
/// Receives the value from the master control by a unique auto connection
void slotValueChangedAuto(double v, QObject* pSetter) {
if (pSetter != this) {
// This is base implementation of this function without scaling
emit valueChanged(v);
}
}

// Receives the value from the master control by a unique Queued connection
/// Receives the value from the master control by a unique Queued connection
void slotValueChangedQueued(double v, QObject* pSetter) {
if (pSetter != this) {
// This is base implementation of this function without scaling
Expand All @@ -203,6 +199,6 @@ class ControlProxy : public QObject {

protected:
ConfigKey m_key;
// Pointer to connected control.
/// Pointer to connected control.
QSharedPointer<ControlDoublePrivate> m_pControl;
};
3 changes: 1 addition & 2 deletions src/controllers/midi/hss1394controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ void DeviceChannelListener::Reconnected() {

Hss1394Controller::Hss1394Controller(
const hss1394::TNodeInfo& deviceInfo,
int deviceIndex,
UserSettingsPointer pConfig)
int deviceIndex)
: MidiController(),
m_deviceInfo(deviceInfo),
m_iDeviceIndex(deviceIndex) {
Expand Down
3 changes: 1 addition & 2 deletions src/controllers/midi/hss1394controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ class Hss1394Controller : public MidiController {
public:
Hss1394Controller(
const hss1394::TNodeInfo& deviceInfo,
int deviceIndex,
UserSettingsPointer pConfig);
int deviceIndex);
~Hss1394Controller() override;

private slots:
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/midi/hss1394enumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ QList<Controller*> Hss1394Enumerator::queryDevices() {
QString("%1").arg(tNodeInfo.uProtocolVersion, 0, 16));
qDebug() << " " << message;
Hss1394Controller* currentDevice = new Hss1394Controller(
tNodeInfo, i, m_pConfig);
tNodeInfo, i);
m_devices.push_back(currentDevice);
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/controllers/scripting/colormapperjsproxy.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "controllers/scripting/colormapperjsproxy.h"

#include <QVariant>
#include <QtDebug>

#include "moc_colormapperjsproxy.cpp"

ColorMapperJSProxy::ColorMapperJSProxy(const QVariantMap& availableColors)
Expand Down
1 change: 1 addition & 0 deletions src/controllers/scripting/colormapperjsproxy.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <QJSValue>
#include <QObject>
#include <memory>

#include "controllers/scripting/colormapper.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void ControllerScriptInterfaceLegacy::setValue(
if (pControl &&
!m_st.ignore(
pControl, coScript->getParameterForValue(newValue))) {
coScript->slotSet(newValue);
coScript->set(newValue);
}
}
}
Expand Down Expand Up @@ -621,7 +621,7 @@ void ControllerScriptInterfaceLegacy::scratchEnable(int deck,

// Set scratch2_enable
if (pScratch2Enable != nullptr) {
pScratch2Enable->slotSet(1);
pScratch2Enable->set(1);
}
}

Expand Down Expand Up @@ -688,10 +688,10 @@ void ControllerScriptInterfaceLegacy::scratchProcess(int timerId) {

if (m_brakeActive[deck]) {
// If in brake mode, set scratch2 rate to 0 and turn off the play button.
pScratch2->slotSet(0.0);
pScratch2->set(0.0);
ControlObjectScript* pPlay = getControlObjectScript(group, "play");
if (pPlay != nullptr) {
pPlay->slotSet(0.0);
pPlay->set(0.0);
}
}

Expand All @@ -701,7 +701,7 @@ void ControllerScriptInterfaceLegacy::scratchProcess(int timerId) {
if (pScratch2Enable == nullptr) {
return; // abort and maybe it'll work on the next pass
}
pScratch2Enable->slotSet(0);
pScratch2Enable->set(0);

// Remove timer
killTimer(timerId);
Expand All @@ -724,7 +724,7 @@ void ControllerScriptInterfaceLegacy::scratchDisable(int deck, bool ramp) {
// Clear scratch2_enable
ControlObjectScript* pScratch2Enable = getControlObjectScript(group, "scratch2_enable");
if (pScratch2Enable != nullptr) {
pScratch2Enable->slotSet(0);
pScratch2Enable->set(0);
}
// Can't return here because we need scratchProcess to stop the timer.
// So it's still actually ramping, we just won't hear or see it.
Expand Down Expand Up @@ -761,7 +761,7 @@ void ControllerScriptInterfaceLegacy::brake(int deck, bool activate, double fact
// enable/disable scratch2 mode
ControlObjectScript* pScratch2Enable = getControlObjectScript(group, "scratch2_enable");
if (pScratch2Enable != nullptr) {
pScratch2Enable->slotSet(activate ? 1 : 0);
pScratch2Enable->set(activate ? 1 : 0);
}

// used in scratchProcess for the different timer behavior we need
Expand Down Expand Up @@ -792,7 +792,7 @@ void ControllerScriptInterfaceLegacy::brake(int deck, bool activate, double fact

ControlObjectScript* pScratch2 = getControlObjectScript(group, "scratch2");
if (pScratch2 != nullptr) {
pScratch2->slotSet(initRate);
pScratch2->set(initRate);
}

// setup the filter with default alpha and beta*factor
Expand Down Expand Up @@ -824,7 +824,7 @@ void ControllerScriptInterfaceLegacy::softStart(int deck, bool activate, double
// enable/disable scratch2 mode
ControlObjectScript* pScratch2Enable = getControlObjectScript(group, "scratch2_enable");
if (pScratch2Enable != nullptr) {
pScratch2Enable->slotSet(activate ? 1 : 0);
pScratch2Enable->set(activate ? 1 : 0);
}

// used in scratchProcess for the different timer behavior we need
Expand All @@ -851,12 +851,12 @@ void ControllerScriptInterfaceLegacy::softStart(int deck, bool activate, double

ControlObjectScript* pPlay = getControlObjectScript(group, "play");
if (pPlay != nullptr) {
pPlay->slotSet(1.0);
pPlay->set(1.0);
}

ControlObjectScript* pScratch2 = getControlObjectScript(group, "scratch2");
if (pScratch2 != nullptr) {
pScratch2->slotSet(initRate);
pScratch2->set(initRate);
}

// setup the filter like in brake(), with default alpha and beta*factor
Expand Down
8 changes: 8 additions & 0 deletions src/coreservices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "util/font.h"
#include "util/logger.h"
#include "util/screensaver.h"
#include "util/screensavermanager.h"
#include "util/statsmanager.h"
#include "util/time.h"
#include "util/translations.h"
Expand Down Expand Up @@ -261,6 +262,13 @@ void CoreServices::initialize(QApplication* pApp) {
m_pVCManager->init();
#endif

// Inhibit Screensaver
m_pScreensaverManager = std::make_shared<ScreensaverManager>(pConfig);
connect(&PlayerInfo::instance(),
&PlayerInfo::currentPlayingDeckChanged,
m_pScreensaverManager.get(),
&ScreensaverManager::slotCurrentPlayingDeckChanged);

emit initializationProgressUpdate(50, tr("library"));
CoverArtCache::createInstance();

Expand Down
8 changes: 8 additions & 0 deletions src/coreservices.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class LV2Backend;
namespace mixxx {

class DbConnectionPool;
class ScreensaverManager;

class CoreServices : public QObject {
Q_OBJECT
Expand All @@ -39,6 +40,7 @@ class CoreServices : public QObject {
void initializeSettings();
// FIXME: should be private, but WMainMenuBar needs it initialized early
void initializeKeyboard();
void initializeScreensaverManager();
void initialize(QApplication* pApp);
void shutdown();

Expand Down Expand Up @@ -100,6 +102,10 @@ class CoreServices : public QObject {
return m_pSettingsManager->settings();
}

std::shared_ptr<ScreensaverManager> getScreensaverManager() const {
return m_pScreensaverManager;
}

signals:
void initializationProgressUpdate(int progress, const QString& serviceName);

Expand Down Expand Up @@ -132,6 +138,8 @@ class CoreServices : public QObject {
std::shared_ptr<ConfigObject<ConfigValueKbd>> m_pKbdConfig;
std::shared_ptr<ConfigObject<ConfigValueKbd>> m_pKbdConfigEmpty;

std::shared_ptr<mixxx::ScreensaverManager> m_pScreensaverManager;

std::unique_ptr<ControlPushButton> m_pTouchShift;

Timer m_runtime_timer;
Expand Down
2 changes: 1 addition & 1 deletion src/encoder/encoderopus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void EncoderOpus::pushTagsPacket() {
int commentCount = 0;

const char* vendorString = opus_get_version_string();
int vendorStringLength = strlen(vendorString);
int vendorStringLength = static_cast<int>(strlen(vendorString));

// == Compute tags frame size ==
// - Magic signature: 8 bytes
Expand Down
2 changes: 1 addition & 1 deletion src/engine/enginebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ void EngineBuffer::postProcess(const int iBufferSize) {
if (isLeader(mode)) {
m_pEngineSync->notifyBeatDistanceChanged(m_pSyncControl, beatDistance);
} else if (isFollower(mode)) {
// Report our speed to SyncControl. If we are master, we already did this.
// Report our speed to SyncControl. If we are leader, we already did this.
m_pSyncControl->reportPlayerSpeed(m_speed_old, m_scratching_old);
m_pSyncControl->updateTargetBeatDistance();
}
Expand Down
1 change: 1 addition & 0 deletions src/engine/enginesidechaincompressor.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include <QString>

#include "util/types.h"

Expand Down
Loading

0 comments on commit a5b0969

Please sign in to comment.