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

Tempo locking controls #13041

Merged
merged 1 commit into from
Apr 10, 2024
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
4 changes: 4 additions & 0 deletions src/controllers/controlpickermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
tr("Adjust Beatgrid - Match Alignment"),
tr("Adjust beatgrid to match another playing deck."),
pBpmMenu);
addDeckAndSamplerControl("bpm_toggle_lock",
tr("Toggle the BPM/beatgrid lock"),
tr("Toggle the BPM/beatgrid lock"),
pBpmMenu);
pBpmMenu->addSeparator();
addDeckAndSamplerControl("quantize", tr("Quantize Mode"), tr("Toggle quantize mode"), pBpmMenu);

Expand Down
21 changes: 21 additions & 0 deletions src/engine/controls/bpmcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ BpmControl::BpmControl(const QString& group,
this, &BpmControl::slotTapFilter,
Qt::DirectConnection);

m_pToggleBpmLock = std::make_unique<ControlPushButton>(
ConfigKey(group, "bpm_toggle_lock"), false);
m_pToggleBpmLock->setKbdRepeatable(true);
ronso0 marked this conversation as resolved.
Show resolved Hide resolved
connect(m_pToggleBpmLock.get(),
&ControlObject::valueChanged,
this,
&BpmControl::slotToggleBpmLock,
Qt::DirectConnection);

// Measures distance from last beat in percentage: 0.5 = half-beat away.
m_pThisBeatDistance = new ControlProxy(group, "beat_distance", this);
m_pSyncMode = new ControlProxy(group, "sync_mode", this);
Expand Down Expand Up @@ -1021,6 +1030,18 @@ void BpmControl::slotBeatsTranslateMatchAlignment(double v) {
}
}

void BpmControl::slotToggleBpmLock(double v) {
if (v <= 0) {
return;
}
const TrackPointer pTrack = getEngineBuffer()->getLoadedTrack();
if (!pTrack) {
return;
}
bool locked = pTrack->isBpmLocked();
pTrack->setBpmLocked(!locked);
}

mixxx::Bpm BpmControl::updateLocalBpm() {
mixxx::Bpm prevLocalBpm = mixxx::Bpm(m_pLocalBpm->get());
mixxx::Bpm localBpm;
Expand Down
3 changes: 3 additions & 0 deletions src/engine/controls/bpmcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class BpmControl : public EngineControl {
void slotUpdateEngineBpm(double v = 0.0);
void slotBeatsTranslate(double);
void slotBeatsTranslateMatchAlignment(double);
void slotToggleBpmLock(double);

private:
SyncMode getSyncMode() const {
Expand Down Expand Up @@ -145,6 +146,8 @@ class BpmControl : public EngineControl {
ControlPushButton* m_pTranslateBeatsLater;
ControlEncoder* m_pTranslateBeatsMove;

std::unique_ptr<ControlPushButton> m_pToggleBpmLock;

// The current effective BPM of the engine
ControlLinPotmeter* m_pEngineBpm;

Expand Down
Loading