Skip to content

Commit

Permalink
DEBUG BpmFilterNode
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Oct 12, 2023
1 parent 78406ba commit b2d1f25
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/library/searchquery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,18 +533,21 @@ void BpmFilterNode::init(QString argument) {
m_bNullQuery = true;
return;
}
qWarning() << " .BpmFilter:" << argument;

QRegularExpressionMatch opMatch = kNumericOperatorRegex.match(argument);
if (opMatch.hasMatch()) {
m_operator = opMatch.captured(1);
argument = opMatch.captured(2);
qWarning() << " .opMatch:" << m_operator;
}

bool parsed = false;
const double bpm = parse(argument, &parsed);
if (parsed) {
if (m_fuzzy) {
if (opMatch.hasMatch()) {
qWarning() << " .fuzzy but op";
// invalid arg
return;
}
Expand All @@ -554,6 +557,7 @@ void BpmFilterNode::init(QString argument) {
m_bRangeQuery = true;
} else if (!opMatch.hasMatch() && !m_negate && s_halfDoubleSearchEnabled) {
// include half/double BPM
qWarning() << " .halfDouble";
m_bpm = bpm;
m_bpmHalf = bpm / 2;
m_bpmHalfIsInt = doubleIsIntElseSetRange(m_bpmHalf, &m_bpmHalfLow, &m_bpmHalfHigh);
Expand All @@ -562,7 +566,10 @@ void BpmFilterNode::init(QString argument) {
m_bpmDouble, &m_bpmDoubleLow, &m_bpmDoubleHigh);
m_bHalfDoubleQuery = true;
} else {
qWarning() << " .op/exact/negate";
qWarning() << " op:" << m_operator;
// exact / op / negate
// if there was no opMatch, m_operator is still the initial '='
m_bpm = bpm;
m_bOperatorQuery = true;
}
Expand Down Expand Up @@ -631,9 +638,15 @@ QString BpmFilterNode::toSql() const {
}

if (m_bOperatorQuery) {
qWarning() << " #op/exact/negate";
if (m_fuzzy) {
qWarning() << " #also fuzzy, return ()";
return QString();
}
qWarning() << " #op:" << m_operator;
qWarning()
<< " #toSql:"
<< QString("bpm %1 %2").arg(m_operator, QString::number(m_bpm));
return QString("bpm %1 %2").arg(m_operator, QString::number(m_bpm));
}

Expand Down
1 change: 1 addition & 0 deletions src/library/searchqueryparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ void SearchQueryParser::parseTokens(QStringList tokens,
QString argument = getTextArgument(
specialFilterMatch.captured(2), &tokens, false)
.argument;
qWarning() << " #special:" << argument;
if (!argument.isEmpty()) {
if (field == "key") {
mixxx::track::io::key::ChromaticKey key =
Expand Down
1 change: 1 addition & 0 deletions src/preferences/dialog/dlgprefdeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "widget/wnumberpos.h"

namespace {
// TODO(ronso0) make this accessible for DlgPrefLibrary
constexpr int kDefaultRateRangePercent = 8;
constexpr double kRateDirectionInverted = -1;
constexpr RateControl::RampMode kDefaultRampingMode = RateControl::RampMode::Stepping;
Expand Down
7 changes: 7 additions & 0 deletions src/preferences/dialog/dlgpreflibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,13 @@ void DlgPrefLibrary::slotBpmRangeSelected(int index) {
m_pConfig->set(kSearchBpmFuzzyRangeConfigKey, ConfigValue{bpmRange});
const int rateRangePercent =
m_pConfig->getValue(ConfigKey("[Controls]", "RateRangePercent"), 8);
qWarning() << " .";
qWarning() << " Pref fuzzy range selected:";
qWarning().nospace() << " " << bpmRange << "%";
qWarning().nospace() << " of " << rateRangePercent << "%";
qWarning() << " =" << bpmRange * rateRangePercent / 10000.0;
qWarning() << " .";
// 75% / 100 * 8% / 100
BpmFilterNode::setBpmRelativeRange(bpmRange * rateRangePercent / 10000.0);
}

Expand Down

0 comments on commit b2d1f25

Please sign in to comment.