Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeatFactory: Remove makeBeatGrid function #4258

Merged
merged 5 commits into from
Sep 3, 2021
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: 2 additions & 1 deletion src/analyzer/analyzerbeats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "analyzer/plugins/analyzersoundtouchbeats.h"
#include "library/rekordbox/rekordboxconstants.h"
#include "track/beatfactory.h"
#include "track/beatgrid.h"
#include "track/beatmap.h"
#include "track/beatutils.h"
#include "track/track.h"
Expand Down Expand Up @@ -234,7 +235,7 @@ void AnalyzerBeats::storeResults(TrackPointer pTrack) {
} else {
mixxx::Bpm bpm = m_pPlugin->getBpm();
qDebug() << "AnalyzerBeats plugin detected constant BPM: " << bpm;
pBeats = BeatFactory::makeBeatGrid(m_sampleRate, bpm, mixxx::audio::kStartFramePos);
pBeats = mixxx::BeatGrid::makeBeatGrid(m_sampleRate, bpm, mixxx::audio::kStartFramePos);
}

pTrack->trySetBeats(pBeats);
Expand Down
1 change: 0 additions & 1 deletion src/engine/enginebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "engine/sync/synccontrol.h"
#include "moc_enginebuffer.cpp"
#include "preferences/usersettings.h"
#include "track/beatfactory.h"
#include "track/keyutils.h"
#include "track/track.h"
#include "util/assert.h"
Expand Down
1 change: 0 additions & 1 deletion src/library/banshee/bansheeplaylistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "library/trackcollectionmanager.h"
#include "mixer/playermanager.h"
#include "moc_bansheeplaylistmodel.cpp"
#include "track/beatfactory.h"
#include "track/beats.h"
#include "track/track.h"

Expand Down
8 changes: 5 additions & 3 deletions src/library/dao/trackdao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "library/trackset/crate/cratestorage.h"
#include "moc_trackdao.cpp"
#include "sources/soundsourceproxy.h"
#include "track/beatfactory.h"
#include "track/beatgrid.h"
#include "track/beats.h"
#include "track/globaltrackcache.h"
#include "track/keyfactory.h"
Expand Down Expand Up @@ -1243,11 +1243,13 @@ bool setTrackBeats(const QSqlRecord& record, const int column, Track* pTrack) {
} else {
pTrack->trySetBeats(pBeats);
}
} else {
} else if (bpm.isValid()) {
// Load a temporary beat grid without offset that will be replaced by the analyzer.
const auto pBeats = BeatFactory::makeBeatGrid(
const auto pBeats = mixxx::BeatGrid::makeBeatGrid(
pTrack->getSampleRate(), bpm, mixxx::audio::kStartFramePos);
pTrack->trySetBeats(pBeats);
} else {
pTrack->trySetBeats(nullptr);
}
return false;
}
Expand Down
12 changes: 6 additions & 6 deletions src/library/dlgtrackinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "moc_dlgtrackinfo.cpp"
#include "preferences/colorpalettesettings.h"
#include "sources/soundsourceproxy.h"
#include "track/beatfactory.h"
#include "track/beatgrid.h"
#include "track/beatutils.h"
#include "track/keyfactory.h"
#include "track/keyutils.h"
Expand Down Expand Up @@ -571,10 +571,10 @@ void DlgTrackInfo::slotBpmConstChanged(int state) {
// The cue point should be set on a beat, so this seems
// to be a good alternative
const mixxx::audio::FramePos cuePosition = m_pLoadedTrack->getMainCuePosition();
m_pBeatsClone =
BeatFactory::makeBeatGrid(m_pLoadedTrack->getSampleRate(),
bpm,
cuePosition);
m_pBeatsClone = mixxx::BeatGrid::makeBeatGrid(
m_pLoadedTrack->getSampleRate(),
bpm,
cuePosition);
} else {
m_pBeatsClone.clear();
}
Expand Down Expand Up @@ -610,7 +610,7 @@ void DlgTrackInfo::slotSpinBpmValueChanged(double value) {

if (!m_pBeatsClone) {
const mixxx::audio::FramePos cuePosition = m_pLoadedTrack->getMainCuePosition();
m_pBeatsClone = BeatFactory::makeBeatGrid(
m_pBeatsClone = mixxx::BeatGrid::makeBeatGrid(
m_pLoadedTrack->getSampleRate(),
bpm,
cuePosition);
Expand Down
1 change: 0 additions & 1 deletion src/library/serato/seratofeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "library/trackcollectionmanager.h"
#include "library/treeitem.h"
#include "moc_seratofeature.cpp"
#include "track/beatfactory.h"
#include "track/cue.h"
#include "track/keyfactory.h"
#include "util/assert.h"
Expand Down
3 changes: 0 additions & 3 deletions src/test/beatgridtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ TEST(BeatGridTest, Scale) {
pTrack->trySetBpm(bpm.value());

auto pGrid = BeatGrid::makeBeatGrid(pTrack->getSampleRate(),
QString(),
mixxx::Bpm(bpm),
mixxx::audio::kStartFramePos);

Expand Down Expand Up @@ -63,7 +62,6 @@ TEST(BeatGridTest, TestNthBeatWhenOnBeat) {
constexpr mixxx::audio::FrameDiff_t beatLengthFrames = 60.0 * sampleRate / bpm;

auto pGrid = BeatGrid::makeBeatGrid(pTrack->getSampleRate(),
QString(),
mixxx::Bpm(bpm),
mixxx::audio::kStartFramePos);
// Pretend we're on the 20th beat;
Expand Down Expand Up @@ -108,7 +106,6 @@ TEST(BeatGridTest, TestNthBeatWhenNotOnBeat) {
const mixxx::audio::FrameDiff_t beatLengthFrames = 60.0 * sampleRate / bpm.value();

auto pGrid = BeatGrid::makeBeatGrid(pTrack->getSampleRate(),
QString(),
bpm,
mixxx::audio::kStartFramePos);

Expand Down
4 changes: 2 additions & 2 deletions src/test/beatstranslatetest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ TEST_F(BeatsTranslateTest, SimpleTranslateMatch) {
const auto bpm = mixxx::Bpm(60.0);
constexpr auto firstBeat = mixxx::audio::kStartFramePos;
auto grid1 = mixxx::BeatGrid::makeBeatGrid(
m_pTrack1->getSampleRate(), QString(), bpm, firstBeat);
m_pTrack1->getSampleRate(), bpm, firstBeat);
m_pTrack1->trySetBeats(grid1);
ASSERT_DOUBLE_EQ(firstBeat.value(),
grid1->findClosestBeat(mixxx::audio::kStartFramePos).value());

auto grid2 = mixxx::BeatGrid::makeBeatGrid(
m_pTrack2->getSampleRate(), QString(), bpm, firstBeat);
m_pTrack2->getSampleRate(), bpm, firstBeat);
m_pTrack2->trySetBeats(grid2);
ASSERT_DOUBLE_EQ(firstBeat.value(),
grid2->findClosestBeat(mixxx::audio::kStartFramePos).value());
Expand Down
3 changes: 1 addition & 2 deletions src/test/bpmcontrol_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "control/controlobject.h"
#include "control/controlpushbutton.h"
#include "engine/controls/bpmcontrol.h"
#include "track/beatfactory.h"
#include "track/beatgrid.h"
#include "track/beatmap.h"
#include "track/track.h"
Expand Down Expand Up @@ -36,7 +35,7 @@ TEST_F(BpmControlTest, BeatContext_BeatGrid) {
const auto bpm = mixxx::Bpm(60.0);
const mixxx::audio::FrameDiff_t expectedBeatLengthFrames = (60.0 * sampleRate / bpm.value());

const mixxx::BeatsPointer pBeats = BeatFactory::makeBeatGrid(
const mixxx::BeatsPointer pBeats = mixxx::BeatGrid::makeBeatGrid(
pTrack->getSampleRate(), bpm, mixxx::audio::kStartFramePos);

// On a beat.
Expand Down
Loading