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

DlgTrackInfo: ensure Beats pointer before scaling beats #4587

Merged
merged 2 commits into from
Dec 28, 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
87 changes: 24 additions & 63 deletions src/library/dlgtrackinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,30 +98,24 @@ void DlgTrackInfo::init() {
this,
&DlgTrackInfo::slotCancel);

connect(bpmDouble,
&QPushButton::clicked,
this,
&DlgTrackInfo::slotBpmDouble);
connect(bpmHalve,
&QPushButton::clicked,
this,
&DlgTrackInfo::slotBpmHalve);
connect(bpmTwoThirds,
&QPushButton::clicked,
this,
&DlgTrackInfo::slotBpmTwoThirds);
connect(bpmThreeFourth,
&QPushButton::clicked,
this,
&DlgTrackInfo::slotBpmThreeFourth);
connect(bpmFourThirds,
&QPushButton::clicked,
this,
&DlgTrackInfo::slotBpmFourThirds);
connect(bpmThreeHalves,
&QPushButton::clicked,
this,
&DlgTrackInfo::slotBpmThreeHalves);
connect(bpmDouble, &QPushButton::clicked, this, [this] {
slotScaleBpm(mixxx::Beats::DOUBLE);
});
connect(bpmHalve, &QPushButton::clicked, this, [this] {
slotScaleBpm(mixxx::Beats::HALVE);
});
connect(bpmTwoThirds, &QPushButton::clicked, this, [this] {
slotScaleBpm(mixxx::Beats::TWOTHIRDS);
});
connect(bpmThreeFourth, &QPushButton::clicked, this, [this] {
slotScaleBpm(mixxx::Beats::THREEFOURTHS);
});
connect(bpmFourThirds, &QPushButton::clicked, this, [this] {
slotScaleBpm(mixxx::Beats::FOURTHIRDS);
});
connect(bpmThreeHalves, &QPushButton::clicked, this, [this] {
slotScaleBpm(mixxx::Beats::THREEHALVES);
});
connect(bpmClear,
&QPushButton::clicked,
this,
Expand Down Expand Up @@ -468,46 +462,13 @@ void DlgTrackInfo::clear() {
m_pWCoverArtLabel->setCoverArt(m_loadedCoverInfo, QPixmap());
}

void DlgTrackInfo::slotBpmDouble() {
m_pBeatsClone = m_pBeatsClone->scale(mixxx::Beats::DOUBLE);
// read back the actual value
double newValue = m_pBeatsClone->getBpm();
spinBpm->setValue(newValue);
}

void DlgTrackInfo::slotBpmHalve() {
m_pBeatsClone = m_pBeatsClone->scale(mixxx::Beats::HALVE);
// read back the actual value
double newValue = m_pBeatsClone->getBpm();
spinBpm->setValue(newValue);
}

void DlgTrackInfo::slotBpmTwoThirds() {
m_pBeatsClone = m_pBeatsClone->scale(mixxx::Beats::TWOTHIRDS);
// read back the actual value
double newValue = m_pBeatsClone->getBpm();
spinBpm->setValue(newValue);
}

void DlgTrackInfo::slotBpmThreeFourth() {
m_pBeatsClone = m_pBeatsClone->scale(mixxx::Beats::THREEFOURTHS);
// read back the actual value
double newValue = m_pBeatsClone->getBpm();
spinBpm->setValue(newValue);
}

void DlgTrackInfo::slotBpmFourThirds() {
m_pBeatsClone = m_pBeatsClone->scale(mixxx::Beats::FOURTHIRDS);
// read back the actual value
double newValue = m_pBeatsClone->getBpm();
spinBpm->setValue(newValue);
}

void DlgTrackInfo::slotBpmThreeHalves() {
m_pBeatsClone = m_pBeatsClone->scale(mixxx::Beats::THREEHALVES);
void DlgTrackInfo::slotScaleBpm(mixxx::Beats::BPMScale scale) {
if (!m_pBeatsClone) {
return;
}
m_pBeatsClone = m_pBeatsClone->scale(scale);
uklotzde marked this conversation as resolved.
Show resolved Hide resolved
// read back the actual value
double newValue = m_pBeatsClone->getBpm();
spinBpm->setValue(newValue);
spinBpm->setValue(m_pBeatsClone->getBpm());
}

void DlgTrackInfo::slotBpmClear() {
Expand Down
8 changes: 1 addition & 7 deletions src/library/dlgtrackinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,7 @@ class DlgTrackInfo : public QDialog, public Ui::DlgTrackInfo {
void slotCancel();

void trackUpdated();

void slotBpmDouble();
void slotBpmHalve();
void slotBpmTwoThirds();
void slotBpmThreeFourth();
void slotBpmFourThirds();
void slotBpmThreeHalves();
void slotScaleBpm(mixxx::Beats::BPMScale scale);
void slotBpmClear();
void slotBpmConstChanged(int state);
void slotBpmTap(double averageLength, int numSamples);
Expand Down