Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Be-ing committed Jun 10, 2018
2 parents f3a1442 + 4302cd0 commit 64bd9db
Show file tree
Hide file tree
Showing 52 changed files with 510 additions and 236 deletions.
3 changes: 2 additions & 1 deletion build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def configure(self, build, conf, env=None):

if build.platform_is_linux:
# Try using system lib
if conf.CheckForPKG('soundtouch', '1.8.0'):
if conf.CheckForPKG('soundtouch', '2.0.0'):
# System Lib found
build.env.ParseConfig('pkg-config soundtouch --silence-errors \
--cflags --libs')
Expand Down Expand Up @@ -1059,6 +1059,7 @@ def sources(self, build):
"library/bpmdelegate.cpp",
"library/previewbuttondelegate.cpp",
"library/coverartdelegate.cpp",
"library/tableitemdelegate.cpp",

"library/treeitemmodel.cpp",
"library/treeitem.cpp",
Expand Down
9 changes: 8 additions & 1 deletion plugins/soundsourcem4a/soundsourcem4a.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ typedef unsigned long SAMPLERATE_TYPE;

namespace mixxx {

// TODO(XXX): Remove this ugly "extern" hack after getting rid of
// the broken plugin architecture.
LogLevel g_logLevel;
LogLevel g_logFlushLevel;

namespace {

const Logger kLogger("SoundSourceM4A");
Expand Down Expand Up @@ -617,9 +622,11 @@ SoundSourcePointer SoundSourceProviderM4A::newSoundSource(const QUrl& url) {
} // namespace mixxx

extern "C" MIXXX_SOUNDSOURCEPLUGINAPI_EXPORT
mixxx::SoundSourceProvider* Mixxx_SoundSourcePluginAPI_createSoundSourceProvider() {
mixxx::SoundSourceProvider* Mixxx_SoundSourcePluginAPI_createSoundSourceProvider(int logLevel, int logFlushLevel) {
// SoundSourceProviderM4A is stateless and a single instance
// can safely be shared
mixxx::g_logLevel = static_cast<mixxx::LogLevel>(logLevel);
mixxx::g_logFlushLevel = static_cast<mixxx::LogLevel>(logFlushLevel);
static mixxx::SoundSourceProviderM4A singleton;
return &singleton;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/soundsourcem4a/soundsourcem4a.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class SoundSourceProviderM4A: public SoundSourceProvider {
} // namespace mixxx

extern "C" MIXXX_SOUNDSOURCEPLUGINAPI_EXPORT
mixxx::SoundSourceProvider* Mixxx_SoundSourcePluginAPI_createSoundSourceProvider();
mixxx::SoundSourceProvider* Mixxx_SoundSourcePluginAPI_createSoundSourceProvider(int logLevel, int logFlushLevel);

extern "C" MIXXX_SOUNDSOURCEPLUGINAPI_EXPORT
void Mixxx_SoundSourcePluginAPI_destroySoundSourceProvider(mixxx::SoundSourceProvider*);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ template<class T> static void safeRelease(T **ppT) {

namespace mixxx {

// TODO(XXX): Remove this ugly "extern" hack after getting rid of
// the broken plugin architecture.
LogLevel g_logLevel;
LogLevel g_logFlushLevel;

SoundSourceMediaFoundation::SoundSourceMediaFoundation(const QUrl& url)
: SoundSourcePlugin(url, "m4a"),
m_hrCoInitialize(E_FAIL),
Expand Down Expand Up @@ -803,9 +808,11 @@ SoundSourcePointer SoundSourceProviderMediaFoundation::newSoundSource(const QUrl
} // namespace mixxx

extern "C" MIXXX_SOUNDSOURCEPLUGINAPI_EXPORT
mixxx::SoundSourceProvider* Mixxx_SoundSourcePluginAPI_createSoundSourceProvider() {
mixxx::SoundSourceProvider* Mixxx_SoundSourcePluginAPI_createSoundSourceProvider(int logLevel, int logFlushLevel) {
// SoundSourceProviderMediaFoundation is stateless and a single instance
// can safely be shared
mixxx::g_logLevel = static_cast<mixxx::LogLevel>(logLevel);
mixxx::g_logFlushLevel = static_cast<mixxx::LogLevel>(logFlushLevel);
static mixxx::SoundSourceProviderMediaFoundation singleton;
return &singleton;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class SoundSourceProviderMediaFoundation: public SoundSourceProvider {


extern "C" MIXXX_SOUNDSOURCEPLUGINAPI_EXPORT
mixxx::SoundSourceProvider* Mixxx_SoundSourcePluginAPI_createSoundSourceProvider();
mixxx::SoundSourceProvider* Mixxx_SoundSourcePluginAPI_createSoundSourceProvider(int logLevel, int logFlushLevel);

extern "C" MIXXX_SOUNDSOURCEPLUGINAPI_EXPORT
void Mixxx_SoundSourcePluginAPI_destroySoundSourceProvider(mixxx::SoundSourceProvider*);
Expand Down
11 changes: 9 additions & 2 deletions plugins/soundsourcewv/soundsourcewv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

namespace mixxx {

// TODO(XXX): Remove this ugly "extern" hack after getting rid of
// the broken plugin architecture.
LogLevel g_logLevel;
LogLevel g_logFlushLevel;

namespace {

const Logger kLogger("SoundSourceWV");
Expand Down Expand Up @@ -62,7 +67,7 @@ SoundSource::OpenResult SoundSourceWV::tryOpen(
m_wpc = WavpackOpenFileInputEx(&s_streamReader, m_pWVFile, m_pWVCFile,
msg, openFlags, 0);
if (!m_wpc) {
kLogger.debug() << "failed to open file : " << msg;
kLogger.warning() << "failed to open file : " << msg;
return OpenResult::Failed;
}

Expand Down Expand Up @@ -267,9 +272,11 @@ int32_t SoundSourceWV::WriteBytesCallback(void* id, void* data, int32_t bcount)
} // namespace mixxx

extern "C" MIXXX_SOUNDSOURCEPLUGINAPI_EXPORT
mixxx::SoundSourceProvider* Mixxx_SoundSourcePluginAPI_createSoundSourceProvider() {
mixxx::SoundSourceProvider* Mixxx_SoundSourcePluginAPI_createSoundSourceProvider(int logLevel, int logFlushLevel) {
// SoundSourceProviderWV is stateless and a single instance
// can safely be shared
mixxx::g_logLevel = static_cast<mixxx::LogLevel>(logLevel);
mixxx::g_logFlushLevel = static_cast<mixxx::LogLevel>(logFlushLevel);
static mixxx::SoundSourceProviderWV singleton;
return &singleton;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/soundsourcewv/soundsourcewv.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class SoundSourceProviderWV: public SoundSourceProvider {
} // namespace mixxx

extern "C" MIXXX_SOUNDSOURCEPLUGINAPI_EXPORT
mixxx::SoundSourceProvider* Mixxx_SoundSourcePluginAPI_createSoundSourceProvider();
mixxx::SoundSourceProvider* Mixxx_SoundSourcePluginAPI_createSoundSourceProvider(int logLevel, int logFlushLevel);

extern "C" MIXXX_SOUNDSOURCEPLUGINAPI_EXPORT
void Mixxx_SoundSourcePluginAPI_destroySoundSourceProvider(mixxx::SoundSourceProvider*);
Expand Down
3 changes: 2 additions & 1 deletion res/skins/Deere/deck_tempo_column.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ObjectName>TempoControlButtons</ObjectName>
<Layout>vertical</Layout>
<Children>
<Template src="skin:left_2state_button.xml">
<Template src="skin:left_right_2state_button.xml">
<SetVariable name="TooltipId">sync_enabled</SetVariable>
<SetVariable name="ObjectName">DeckSync</SetVariable>
<SetVariable name="MinimumSize">-1,18</SetVariable>
Expand All @@ -28,6 +28,7 @@
<SetVariable name="state_1_pressed"></SetVariable>
<SetVariable name="state_1_unpressed"></SetVariable>
<SetVariable name="left_connection_control"><Variable name="group"/>,sync_enabled</SetVariable>
<SetVariable name="right_connection_control"><Variable name="group"/>,beatsync_phase</SetVariable>
</Template>

<WidgetGroup>
Expand Down
2 changes: 1 addition & 1 deletion res/skins/LateNight/deck.xml
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
<ButtonState>LeftButton</ButtonState>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,beatsync</ConfigKey>
<ConfigKey><Variable name="group"/>,beatsync_phase</ConfigKey>
<ButtonState>RightButton</ButtonState>
</Connection>
</PushButton>
Expand Down
2 changes: 1 addition & 1 deletion res/skins/Shade/deck.xml
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@
<ButtonState>LeftButton</ButtonState>
</Connection>
<Connection>
<ConfigKey>[Channel<Variable name="channum"/>],beatsync_tempo</ConfigKey>
<ConfigKey>[Channel<Variable name="channum"/>],beatsync_phase</ConfigKey>
<ButtonState>RightButton</ButtonState>
</Connection>
</PushButton>
Expand Down
2 changes: 1 addition & 1 deletion res/skins/Tango/rate_pitch_key.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Variables:
<SetVariable name="ObjectName">SyncButtonOverlay</SetVariable>
<SetVariable name="Size">50f,18min</SetVariable>
<SetVariable name="ConfigKey"><Variable name="group"/>,sync_enabled</SetVariable>
<SetVariable name="ConfigKeyRight"><Variable name="group"/>,rate_set_default</SetVariable>
<SetVariable name="ConfigKeyRight"><Variable name="group"/>,beatsync_phase</SetVariable>
</Template>
<Number>
<ObjectName>BpmLabel</ObjectName>
Expand Down
1 change: 1 addition & 0 deletions src/controllers/controlpickermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
tr("Sync mode 3-state toggle (OFF, FOLLOWER, MASTER)"), syncMenu);
addDeckAndSamplerControl("beatsync", tr("Beat Sync One-Shot"),
tr("One-time beat sync (tempo and phase)"), syncMenu);
// TODO: phase depends on quantize
addDeckAndSamplerControl("beatsync_tempo", tr("Sync Tempo One-Shot"),
tr("One-time beat sync (tempo only)"), syncMenu);
addDeckAndSamplerControl("beatsync_phase", tr("Sync Phase One-Shot"),
Expand Down
8 changes: 5 additions & 3 deletions src/database/schemamanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ SchemaManager::Result SchemaManager::upgradeToSchemaVersion(
}
}

kLogger.debug()
<< "Loading database schema migrations from"
<< schemaFilename;
if (kLogger.debugEnabled()) {
kLogger.debug()
<< "Loading database schema migrations from"
<< schemaFilename;
}
QDomElement schemaRoot = XmlParse::openXMLFile(schemaFilename, "schema");
if (schemaRoot.isNull()) {
kLogger.critical()
Expand Down
11 changes: 8 additions & 3 deletions src/engine/bpmcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,15 @@ void BpmControl::slotControlBeatSyncTempo(double v) {

void BpmControl::slotControlBeatSync(double v) {
if (!v) return;
if (!syncTempo()) {
// syncTempo failed, nothing else to do
return;
}

// If the player is playing, and adjusting its tempo succeeded, adjust its
// phase so that it plays in sync.
if (syncTempo() && m_pPlayButton->get() > 0) {
// Also sync phase if quantize is enabled.
// this is used from controller scripts, where the latching behaviour of
// the sync_enable CO cannot be used
if (m_pPlayButton->toBool() && m_pQuantize->toBool()) {
getEngineBuffer()->requestSyncPhase();
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/engine/enginebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ void EngineBuffer::slotControlPlayRequest(double v) {
bool verifiedPlay = updateIndicatorsAndModifyPlay(v > 0.0);

if (!oldPlay && verifiedPlay) {
if (m_pQuantize->get() > 0.0
if (m_pQuantize->toBool()
#ifdef __VINYLCONTROL__
&& m_pVinylControlControl && !m_pVinylControlControl->isEnabled()
#endif
Expand Down Expand Up @@ -900,7 +900,7 @@ void EngineBuffer::process(CSAMPLE* pOutput, const int iBufferSize) {
// we need to sync phase or we'll be totally out of whack and the sync
// adjuster will kick in and push the track back in to sync with the
// master.
if (m_scratching_old && !is_scratching && m_pQuantize->get() > 0.0
if (m_scratching_old && !is_scratching && m_pQuantize->toBool()
&& m_pSyncControl->getSyncMode() == SYNC_FOLLOWER && !paused) {
// TODO() The resulting seek is processed in the following callback
// That is to late
Expand Down Expand Up @@ -1179,7 +1179,7 @@ void EngineBuffer::processSeek(bool paused) {
return;
}

if ((seekType & SEEK_PHASE) && !paused && m_pQuantize->toBool()) {
if (!paused && ((seekType & SEEK_PHASE) || m_pQuantize->toBool())) {
position = m_pBpmControl->getNearestPositionInPhase(position, true, true);
}
if (position != m_filepos_play) {
Expand Down
5 changes: 2 additions & 3 deletions src/engine/sync/enginesync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ void EngineSync::requestEnableSync(Syncable* pSyncable, bool bEnabled) {
foundPlayingDeck = true;
}
activateFollower(pSyncable);
if (foundPlayingDeck && pSyncable->isPlaying()) {
// Users also expect phase to be aligned when they press the sync button.
pSyncable->requestSyncPhase();
if (foundPlayingDeck) {
pSyncable->requestSync();
}
} else {
// Already disabled? Do nothing.
Expand Down
2 changes: 1 addition & 1 deletion src/engine/sync/internalclock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void InternalClock::notifyOnlyPlayingSyncable() {
// No action necessary.
}

void InternalClock::requestSyncPhase() {
void InternalClock::requestSync() {
// TODO(owilliams): This should probably be how we reset the internal beat distance.
}

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 @@ -29,7 +29,7 @@ class InternalClock : public QObject, public Clock, public Syncable {

void notifySyncModeChanged(SyncMode mode);
void notifyOnlyPlayingSyncable();
void requestSyncPhase();
void requestSync();
SyncMode getSyncMode() const {
return m_mode;
}
Expand Down
2 changes: 1 addition & 1 deletion src/engine/sync/syncable.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Syncable {
virtual void notifyOnlyPlayingSyncable() = 0;

// Notify a Syncable that they should sync phase.
virtual void requestSyncPhase() = 0;
virtual void requestSync() = 0;

// Must NEVER return a mode that was not set directly via
// notifySyncModeChanged.
Expand Down
14 changes: 11 additions & 3 deletions src/engine/sync/synccontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ SyncControl::SyncControl(const QString& group, UserSettingsPointer pConfig,
m_pEjectButton->connectValueChanged(
SLOT(slotEjectPushed(double)), Qt::DirectConnection);

m_pQuantize = new ControlProxy(group, "quantize", this);

// BPMControl and RateControl will be initialized later.
}

Expand Down Expand Up @@ -161,12 +163,18 @@ void SyncControl::notifyOnlyPlayingSyncable() {
m_pBpmControl->resetSyncAdjustment();
}

void SyncControl::requestSyncPhase() {
m_pChannel->getEngineBuffer()->requestSyncPhase();
void SyncControl::requestSync() {
if (isPlaying() && m_pQuantize->toBool()) {
// only sync phase if the deck is playing and if quantize is enabled.
// this way the it is up to the user to decide if a seek is desired or not.
// This is helpful if the beatgrid of the track doe not fit at the current
// playposition
m_pChannel->getEngineBuffer()->requestSyncPhase();
}
}

bool SyncControl::isPlaying() const {
return m_pPlayButton->get() > 0.0;
return m_pPlayButton->toBool();
}

double SyncControl::getBeatDistance() const {
Expand Down
3 changes: 2 additions & 1 deletion src/engine/sync/synccontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SyncControl : public EngineControl, public Syncable {
SyncMode getSyncMode() const;
void notifySyncModeChanged(SyncMode mode);
void notifyOnlyPlayingSyncable();
void requestSyncPhase();
void requestSync();
bool isPlaying() const;

double getBeatDistance() const;
Expand Down Expand Up @@ -136,6 +136,7 @@ class SyncControl : public EngineControl, public Syncable {
ControlProxy* m_pPassthroughEnabled;
ControlProxy* m_pEjectButton;
ControlProxy* m_pSyncPhaseButton;
ControlProxy* m_pQuantize;
};


Expand Down
12 changes: 8 additions & 4 deletions src/library/basesqltablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QtAlgorithms>
#include <QtDebug>
#include <QUrl>
#include <QTableView>

#include "library/basesqltablemodel.h"

Expand Down Expand Up @@ -1049,14 +1050,17 @@ QMimeData* BaseSqlTableModel::mimeData(const QModelIndexList &indexes) const {
}

QAbstractItemDelegate* BaseSqlTableModel::delegateForColumn(const int i, QObject* pParent) {
QTableView* pTableView = qobject_cast<QTableView*>(pParent);
DEBUG_ASSERT(pTableView);

if (i == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_RATING)) {
return new StarDelegate(pParent);
return new StarDelegate(pTableView);
} else if (i == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_BPM)) {
return new BPMDelegate(pParent);
return new BPMDelegate(pTableView);
} else if (PlayerManager::numPreviewDecks() > 0 && i == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_PREVIEW)) {
return new PreviewButtonDelegate(pParent, i);
return new PreviewButtonDelegate(pTableView, i);
} else if (i == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_COVERART)) {
CoverArtDelegate* pCoverDelegate = new CoverArtDelegate(pParent);
CoverArtDelegate* pCoverDelegate = new CoverArtDelegate(pTableView);
connect(pCoverDelegate, SIGNAL(coverReadyForCell(int, int)),
this, SLOT(refreshCell(int, int)));
return pCoverDelegate;
Expand Down
12 changes: 7 additions & 5 deletions src/library/bpmdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <QDoubleSpinBox>
#include <QRect>
#include <QPalette>
#include <QTableView>
#include <QPainter>

#include "library/bpmdelegate.h"
#include "library/trackmodel.h"
Expand Down Expand Up @@ -30,9 +32,9 @@ class BpmEditorCreator : public QItemEditorCreatorBase {
}
};

BPMDelegate::BPMDelegate(QObject* parent)
: QStyledItemDelegate(parent),
m_pTableView(qobject_cast<QTableView*>(parent)),
BPMDelegate::BPMDelegate(QTableView* pTableView)
: TableItemDelegate(pTableView),
m_pTableView(pTableView),
m_pCheckBox(new QCheckBox(m_pTableView)) {
m_pCheckBox->setObjectName("LibraryBPMButton");
// NOTE(rryan): Without ensurePolished the first render of the QTableView
Expand All @@ -51,8 +53,8 @@ BPMDelegate::~BPMDelegate() {
delete m_pFactory;
}

void BPMDelegate::paint(QPainter* painter,const QStyleOptionViewItem &option,
const QModelIndex &index) const {
void BPMDelegate::paintItem(QPainter* painter,const QStyleOptionViewItem &option,
const QModelIndex& index) const {
// NOTE(rryan): Qt has a built-in limitation that we cannot style multiple
// CheckState indicators in the same QAbstractItemView. The CSS rule
// QTableView::indicator:checked applies to all columns with a
Expand Down
Loading

0 comments on commit 64bd9db

Please sign in to comment.