Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/track/beatgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ BeatGrid::BeatGrid(
}

BeatGrid::BeatGrid(const BeatGrid& other)
: QObject(),
m_mutex(QMutex::Recursive),
: m_mutex(QMutex::Recursive),
m_subVersion(other.m_subVersion),
m_iSampleRate(other.m_iSampleRate),
m_grid(other.m_grid),
Expand Down
7 changes: 1 addition & 6 deletions src/track/beatgrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define BEATGRID_H

#include <QMutex>
#include <QObject>

#include "track/track.h"
#include "track/beats.h"
Expand All @@ -14,8 +13,7 @@
// BeatGrid is an implementation of the Beats interface that implements an
// infinite grid of beats, aligned to a song simply by a starting offset of the
// first beat and the song's average beats-per-minute.
class BeatGrid : public QObject, public virtual Beats {
Q_OBJECT
class BeatGrid final : public Beats {
public:
// Construct a BeatGrid. If a more accurate sample rate is known, provide it
// in the iSampleRate parameter -- otherwise pass 0.
Expand Down Expand Up @@ -73,9 +71,6 @@ class BeatGrid : public QObject, public virtual Beats {
virtual void scale(enum BPMScale scale);
virtual void setBpm(double dBpm);

signals:
void updated();

private:
BeatGrid(const BeatGrid& other);
double firstBeatSample() const;
Expand Down
3 changes: 1 addition & 2 deletions src/track/beatmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ BeatMap::BeatMap(const Track& track, SINT iSampleRate,
}

BeatMap::BeatMap (const BeatMap& other)
: QObject(),
m_mutex(QMutex::Recursive),
: m_mutex(QMutex::Recursive),
m_subVersion(other.m_subVersion),
m_iSampleRate(other.m_iSampleRate),
m_dCachedBpm(other.m_dCachedBpm),
Expand Down
7 changes: 1 addition & 6 deletions src/track/beatmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#ifndef BEATMAP_H_
#define BEATMAP_H_

#include <QObject>
#include <QMutex>

#include "track/track.h"
Expand All @@ -19,8 +18,7 @@

typedef QList<mixxx::track::io::Beat> BeatList;

class BeatMap : public QObject, public Beats {
Q_OBJECT
class BeatMap final : public Beats {
public:
// Construct a BeatMap. iSampleRate may be provided if a more accurate
// sample rate is known than the one associated with the Track.
Expand Down Expand Up @@ -82,9 +80,6 @@ class BeatMap : public QObject, public Beats {
virtual void scale(enum BPMScale scale);
virtual void setBpm(double dBpm);

signals:
void updated();

private:
BeatMap(const BeatMap& other);
bool readByteArray(const QByteArray& byteArray);
Expand Down
7 changes: 6 additions & 1 deletion src/track/beats.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef BEATS_H
#define BEATS_H

#include <QObject>
#include <QString>
#include <QList>
#include <QByteArray>
Expand All @@ -25,7 +26,8 @@ class BeatIterator {
// Beats is a pure abstract base class for BPM and beat management classes. It
// provides a specification of all methods a beat-manager class must provide, as
// well as a capability model for representing optional features.
class Beats {
class Beats : public QObject {
Q_OBJECT
public:
Beats() { }
virtual ~Beats() { }
Expand Down Expand Up @@ -161,6 +163,9 @@ class Beats {
// Adjust the beats so the global average BPM matches dBpm. Beats class must
// have the capability BEATSCAP_SET.
virtual void setBpm(double dBpm) = 0;

signals:
void updated();
};

#endif /* BEATS_H */
14 changes: 3 additions & 11 deletions src/track/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,23 +353,15 @@ void Track::setBeatsAndUnlock(QMutexLocker* pLock, BeatsPointer pBeats) {
}

if (m_pBeats) {
auto pObject = dynamic_cast<QObject*>(m_pBeats.data());
if (pObject) {
disconnect(pObject, SIGNAL(updated()),
this, SLOT(slotBeatsUpdated()));
}
disconnect(m_pBeats.data(), &Beats::updated, this, &Track::slotBeatsUpdated);
}

m_pBeats = pBeats;
m_pBeats = std::move(pBeats);

auto bpmValue = mixxx::Bpm::kValueUndefined;
if (m_pBeats) {
bpmValue = m_pBeats->getBpm();
auto pObject = dynamic_cast<QObject*>(m_pBeats.data());
if (pObject) {
connect(pObject, SIGNAL(updated()),
this, SLOT(slotBeatsUpdated()));
}
connect(m_pBeats.data(), &Beats::updated, this, &Track::slotBeatsUpdated);
}
m_record.refMetadata().refTrackInfo().setBpm(mixxx::Bpm(bpmValue));

Expand Down