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

BeatGrid: Fix wrong multiplication with kFrameSize #4127

Merged
merged 1 commit into from
Jul 20, 2021
Merged
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
9 changes: 4 additions & 5 deletions src/track/beatgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ struct BeatGridData {
double firstBeat;
};

constexpr int kFrameSize = 2;
constexpr double kBpmScaleRounding = 0.001;

} // namespace
Expand Down Expand Up @@ -349,8 +348,8 @@ BeatsPointer BeatGrid::scale(BpmScale scale) const {

bpm = BeatUtils::roundBpmWithinRange(bpm - kBpmScaleRounding, bpm, bpm + kBpmScaleRounding);
grid.mutable_bpm()->set_bpm(bpm.value());
double beatLength = (60.0 * m_sampleRate / bpm.value()) * kFrameSize;
return BeatsPointer(new BeatGrid(*this, grid, beatLength));
const mixxx::audio::FrameDiff_t beatLengthFrames = (60.0 * m_sampleRate / bpm.value());
return BeatsPointer(new BeatGrid(*this, grid, beatLengthFrames));
}

BeatsPointer BeatGrid::setBpm(mixxx::Bpm bpm) {
Expand All @@ -359,8 +358,8 @@ BeatsPointer BeatGrid::setBpm(mixxx::Bpm bpm) {
}
mixxx::track::io::BeatGrid grid = m_grid;
grid.mutable_bpm()->set_bpm(bpm.value());
double beatLength = (60.0 * m_sampleRate / bpm.value()) * kFrameSize;
return BeatsPointer(new BeatGrid(*this, grid, beatLength));
const mixxx::audio::FrameDiff_t beatLengthFrames = (60.0 * m_sampleRate / bpm.value());
return BeatsPointer(new BeatGrid(*this, grid, beatLengthFrames));
}

} // namespace mixxx