AnalyzerBase: Add missing parameter names
This commit is contained in:
@@ -50,9 +50,9 @@
|
|||||||
// Make an INSTRUCTIONS file
|
// Make an INSTRUCTIONS file
|
||||||
// can't mod scope in analyze you have to use transform for 2D use setErasePixmap Qt function insetead of m_background
|
// can't mod scope in analyze you have to use transform for 2D use setErasePixmap Qt function insetead of m_background
|
||||||
|
|
||||||
AnalyzerBase::AnalyzerBase(QWidget *parent, const uint scopeSize)
|
AnalyzerBase::AnalyzerBase(QWidget *parent, const uint scope_size)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
fht_(new FHT(scopeSize)),
|
fht_(new FHT(scope_size)),
|
||||||
engine_(nullptr),
|
engine_(nullptr),
|
||||||
lastscope_(512),
|
lastscope_(512),
|
||||||
new_frame_(false),
|
new_frame_(false),
|
||||||
@@ -211,28 +211,28 @@ void AnalyzerBase::demo(QPainter &p) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerBase::interpolate(const Scope &inVec, Scope &outVec) {
|
void AnalyzerBase::interpolate(const Scope &in_scope, Scope &out_scope) {
|
||||||
|
|
||||||
double pos = 0.0;
|
double pos = 0.0;
|
||||||
const double step = static_cast<double>(inVec.size()) / static_cast<double>(outVec.size());
|
const double step = static_cast<double>(in_scope.size()) / static_cast<double>(out_scope.size());
|
||||||
|
|
||||||
for (uint i = 0; i < outVec.size(); ++i, pos += step) {
|
for (uint i = 0; i < out_scope.size(); ++i, pos += step) {
|
||||||
const double error = pos - std::floor(pos);
|
const double error = pos - std::floor(pos);
|
||||||
const uint64_t offset = static_cast<uint64_t>(pos);
|
const uint64_t offset = static_cast<uint64_t>(pos);
|
||||||
|
|
||||||
uint64_t indexLeft = offset + 0;
|
uint64_t indexLeft = offset + 0;
|
||||||
|
|
||||||
if (indexLeft >= inVec.size()) {
|
if (indexLeft >= in_scope.size()) {
|
||||||
indexLeft = inVec.size() - 1;
|
indexLeft = in_scope.size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t indexRight = offset + 1;
|
uint64_t indexRight = offset + 1;
|
||||||
|
|
||||||
if (indexRight >= inVec.size()) {
|
if (indexRight >= in_scope.size()) {
|
||||||
indexRight = inVec.size() - 1;
|
indexRight = in_scope.size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
outVec[i] = inVec[indexLeft] * (1.0F - static_cast<float>(error)) + inVec[indexRight] * static_cast<float>(error);
|
out_scope[i] = in_scope[indexLeft] * (1.0F - static_cast<float>(error)) + in_scope[indexRight] * static_cast<float>(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class AnalyzerBase : public QWidget {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
using Scope = std::vector<float>;
|
using Scope = std::vector<float>;
|
||||||
explicit AnalyzerBase(QWidget*, const uint scopeSize = 7);
|
explicit AnalyzerBase(QWidget *parent, const uint scope_size = 7);
|
||||||
|
|
||||||
void hideEvent(QHideEvent *e) override;
|
void hideEvent(QHideEvent *e) override;
|
||||||
void showEvent(QShowEvent *e) override;
|
void showEvent(QShowEvent *e) override;
|
||||||
@@ -71,12 +71,12 @@ class AnalyzerBase : public QWidget {
|
|||||||
int resizeExponent(int exp);
|
int resizeExponent(int exp);
|
||||||
int resizeForBands(const int bands);
|
int resizeForBands(const int bands);
|
||||||
virtual void init() {}
|
virtual void init() {}
|
||||||
virtual void transform(Scope&);
|
virtual void transform(Scope &scope);
|
||||||
virtual void analyze(QPainter &p, const Scope&, const bool new_frame) = 0;
|
virtual void analyze(QPainter &p, const Scope &s, const bool new_frame) = 0;
|
||||||
virtual void demo(QPainter &p);
|
virtual void demo(QPainter &p);
|
||||||
|
|
||||||
void interpolate(const Scope&, Scope&);
|
void interpolate(const Scope &in_scope, Scope &out_scope);
|
||||||
void initSin(Scope&, const uint = 6000);
|
void initSin(Scope &v, const uint size = 6000);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QBasicTimer timer_;
|
QBasicTimer timer_;
|
||||||
|
|||||||
Reference in New Issue
Block a user