diff options
author | Jan Holthuis <jholthuis@mixxx.org> | 2021-08-06 15:10:24 +0200 |
---|---|---|
committer | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2021-08-08 14:02:48 +0200 |
commit | 3beef8fe6de529480ad9217afd7d7b005cabb827 (patch) | |
tree | 639c1d85692770438736288b10145d09776b8416 /src/track | |
parent | c3480b68746ebc1687d8060c0f52b192bdd29742 (diff) |
Beats: Remove capabilities and add Beats::hasConstantTempo() method instead
Diffstat (limited to 'src/track')
-rw-r--r-- | src/track/beatgrid.h | 4 | ||||
-rw-r--r-- | src/track/beatmap.h | 4 | ||||
-rw-r--r-- | src/track/beats.h | 19 | ||||
-rw-r--r-- | src/track/track.cpp | 3 |
4 files changed, 12 insertions, 18 deletions
diff --git a/src/track/beatgrid.h b/src/track/beatgrid.h index 72c268e534..b004f237ea 100644 --- a/src/track/beatgrid.h +++ b/src/track/beatgrid.h @@ -31,8 +31,8 @@ class BeatGrid final : public Beats { // The following are all methods from the Beats interface, see method // comments in beats.h - Beats::CapabilitiesFlags getCapabilities() const override { - return BEATSCAP_SETBPM; + bool hasConstantTempo() const override { + return true; } QByteArray toByteArray() const override; diff --git a/src/track/beatmap.h b/src/track/beatmap.h index d96e2d0a8d..6d3e426ea5 100644 --- a/src/track/beatmap.h +++ b/src/track/beatmap.h @@ -33,8 +33,8 @@ class BeatMap final : public Beats { const QString& subVersion, const QVector<mixxx::audio::FramePos>& beats); - Beats::CapabilitiesFlags getCapabilities() const override { - return BEATSCAP_SETBPM; + bool hasConstantTempo() const override { + return false; } QByteArray toByteArray() const override; diff --git a/src/track/beats.h b/src/track/beats.h index e0cff13ffa..1a83339989 100644 --- a/src/track/beats.h +++ b/src/track/beats.h @@ -30,14 +30,6 @@ class Beats { public: virtual ~Beats() = default; - enum Capabilities { - BEATSCAP_NONE = 0, - /// Set new bpm, beat grid only - BEATSCAP_SETBPM = 1 - }; - /// Allows us to do ORing - typedef int CapabilitiesFlags; - enum class BpmScale { Double, Halve, @@ -47,8 +39,12 @@ class Beats { ThreeHalves, }; - /// Retrieve the capabilities supported by the beats implementation. - virtual Beats::CapabilitiesFlags getCapabilities() const = 0; + /// Returns false if the beats implementation supports non-const beats. + /// + /// TODO: This is only needed for the "Asumme Constant Tempo" checkbox in + /// `DlgTrackInfo`. This should probably be removed or reimplemented to + /// check if all neighboring beats in this object have the same distance. + virtual bool hasConstantTempo() const = 0; /// Serialize beats to QByteArray. virtual QByteArray toByteArray() const = 0; @@ -151,8 +147,7 @@ class Beats { /// Scale the position of every beat in the song by `scale`. virtual BeatsPointer scale(BpmScale scale) const = 0; - /// Adjust the beats so the global average BPM matches `bpm`. The `Beats` - /// class must have the capability `BEATSCAP_SET`. + /// Adjust the beats so the global average BPM matches `bpm`. virtual BeatsPointer setBpm(mixxx::Bpm bpm) = 0; }; diff --git a/src/track/track.cpp b/src/track/track.cpp index da3f4ccae8..f50794351e 100644 --- a/src/track/track.cpp +++ b/src/track/track.cpp @@ -359,8 +359,7 @@ bool Track::trySetBpmWhileLocked(mixxx::Bpm bpm) { bpm, cuePosition); return trySetBeatsWhileLocked(std::move(pBeats)); - } else if ((m_pBeats->getCapabilities() & mixxx::Beats::BEATSCAP_SETBPM) && - m_pBeats->getBpm() != bpm) { + } else if (m_pBeats->getBpm() != bpm) { // Continue with the regular cases if (kLogger.debugEnabled()) { kLogger.debug() << "Updating BPM:" << getLocation(); |