Skip to content

Commit

Permalink
Use simpler atomic int for audible status
Browse files Browse the repository at this point in the history
  • Loading branch information
ywwg committed Dec 2, 2023
1 parent 022f37f commit 105c3dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/engine/controls/bpmcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ BpmControl::BpmControl(const QString& group,
m_dSyncInstantaneousBpm(0.0),
m_dLastSyncAdjustment(1.0) {
m_dSyncTargetBeatDistance.setValue(0.0);
m_bSyncTargetAudible.setValue(false);
m_bSyncTargetAudible = false;
m_dUserOffset.setValue(0.0);

m_pPlayButton = new ControlProxy(group, "play", this);
Expand Down Expand Up @@ -348,7 +348,7 @@ double BpmControl::calcSyncedRate(double userTweak) {

// Now we have all we need to calculate the sync adjustment if any.
double adjustment = 1.0;
if (m_bSyncTargetAudible.getValue()) {
if (m_bSyncTargetAudible) {
adjustment = calcSyncAdjustment(userTweak != 0.0);
}
return (rate + userTweak) * adjustment;
Expand Down Expand Up @@ -584,7 +584,7 @@ mixxx::audio::FramePos BpmControl::getNearestPositionInPhase(
double otherBeatFraction;
if (isFollower(syncMode)) {
// Do not sync phase if the target is not audible.
if (!m_bSyncTargetAudible.getValue()) {
if (!m_bSyncTargetAudible) {
return thisPosition;
}
// If we're a follower, it's easy to get the other beat fraction
Expand Down Expand Up @@ -1072,7 +1072,7 @@ void BpmControl::notifyTargetAudible(bool audible) {
if (kLogger.traceEnabled()) {
qDebug() << getGroup() << "BpmControl::notifyTargetPlayingAudible:" << audible;
}
m_bSyncTargetAudible.setValue(audible);
m_bSyncTargetAudible = audible;
}

void BpmControl::updateInstantaneousBpm(double instantaneousBpm) {
Expand Down
2 changes: 1 addition & 1 deletion src/engine/controls/bpmcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class BpmControl : public EngineControl {

ControlProxy* m_pThisBeatDistance;
ControlValueAtomic<double> m_dSyncTargetBeatDistance;
ControlValueAtomic<bool> m_bSyncTargetAudible;
QAtomicInt m_bSyncTargetAudible;
// The user offset is a beat distance percentage value that the user has tweaked a deck
// to bring it in sync with the other decks. This value is added to the reported beat
// distance to get the virtual beat distance used for sync.
Expand Down

0 comments on commit 105c3dd

Please sign in to comment.