-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Looping: update loopsize spinbox when recalling loop with any size #12509
base: main
Are you sure you want to change the base?
Changes from all commits
28327e7
533ccdc
9175fec
9884336
feb5fea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,16 @@ class FramePos final { | |
return util_isfinite(m_framePosition); | ||
} | ||
|
||
// returns true if a is valid and is fairly close to target (within +/- 1 frame). | ||
bool isNear(mixxx::audio::FramePos target) const { | ||
VERIFY_OR_DEBUG_ASSERT(isValid()) { | ||
return false; | ||
} | ||
return target.isValid() && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this isValid() also an debug assert? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO the caller is responsible for testing the position. It may be possible this is called with an invalid FramePos and in that case we simply return |
||
value() > target.value() - 1.0 && | ||
value() < target.value() + 1.0; | ||
}; | ||
|
||
void setValue(value_t framePosition) { | ||
m_framePosition = framePosition; | ||
} | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -4,7 +4,6 @@ | |||
|
||||
#include "control/controlobject.h" | ||||
#include "control/controlpushbutton.h" | ||||
#include "engine/controls/bpmcontrol.h" | ||||
#include "engine/controls/enginecontrol.h" | ||||
#include "engine/controls/ratecontrol.h" | ||||
#include "engine/enginebuffer.h" | ||||
|
@@ -17,11 +16,6 @@ | |||
|
||||
namespace { | ||||
constexpr mixxx::audio::FrameDiff_t kMinimumAudibleLoopSizeFrames = 150; | ||||
|
||||
// returns true if a is valid and is fairly close to target (within +/- 1 frame). | ||||
bool positionNear(mixxx::audio::FramePos a, mixxx::audio::FramePos target) { | ||||
return a.isValid() && a > target - 1 && a < target + 1; | ||||
} | ||||
} // namespace | ||||
|
||||
double LoopingControl::s_dBeatSizes[] = { 0.03125, 0.0625, 0.125, 0.25, 0.5, | ||||
|
@@ -1400,7 +1394,7 @@ bool LoopingControl::currentLoopMatchesBeatloopSize(const LoopInfo& loopInfo) co | |||
const auto loopEndPosition = pBeats->findNBeatsFromPosition( | ||||
loopInfo.startPosition, m_pCOBeatLoopSize->get()); | ||||
|
||||
return positionNear(loopInfo.endPosition, loopEndPosition); | ||||
return loopEndPosition.isNear(loopInfo.endPosition); | ||||
} | ||||
|
||||
bool LoopingControl::quantizeEnabledAndHasTrueTrackBeats() const { | ||||
|
@@ -1423,7 +1417,9 @@ double LoopingControl::findBeatloopSizeForLoop( | |||
} | ||||
} | ||||
} | ||||
return -1; | ||||
|
||||
// No hit. Calculate the fractional beat length | ||||
return pBeats->numFractionalBeatsInRange(startPosition, endPosition); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder why numBeatsInRange() does not returns factions in the first place. mixxx/src/engine/controls/loopingcontrol.cpp Line 768 in fe0c530
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This branch is for when quantize is enabled, we don't need fractional lengths then. |
||||
} | ||||
|
||||
void LoopingControl::updateBeatLoopingControls() { | ||||
|
@@ -1646,8 +1642,8 @@ void LoopingControl::slotBeatLoop(double beats, | |||
// or if the endpoints are nearly the same, do not seek forward into the adjusted loop. | ||||
if (!keepSetPoint || | ||||
!(enable || m_bLoopingEnabled) || | ||||
(positionNear(newloopInfo.startPosition, loopInfo.startPosition) && | ||||
positionNear(newloopInfo.endPosition, loopInfo.endPosition))) { | ||||
(newloopInfo.startPosition.isNear(loopInfo.startPosition) && | ||||
newloopInfo.endPosition.isNear(loopInfo.endPosition))) { | ||||
newloopInfo.seekMode = LoopSeekMode::MovedOut; | ||||
} else { | ||||
newloopInfo.seekMode = LoopSeekMode::Changed; | ||||
|
@@ -1806,7 +1802,7 @@ void LoopingControl::slotLoopMove(double beats) { | |||
} | ||||
|
||||
FrameInfo info = frameInfo(); | ||||
if (BpmControl::getBeatContext(pBeats, | ||||
if (pBeats->getContext( | ||||
info.currentPosition, | ||||
nullptr, | ||||
nullptr, | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.