diff --git a/src/analyzers/analyzerbase.cpp b/src/analyzers/analyzerbase.cpp index 4f70c66e5..5346694a1 100644 --- a/src/analyzers/analyzerbase.cpp +++ b/src/analyzers/analyzerbase.cpp @@ -25,6 +25,7 @@ #include "analyzerbase.h" #include +#include #include #include @@ -184,13 +185,13 @@ void Analyzer::interpolate(const Scope& inVec, Scope& outVec) { for (uint i = 0; i < outVec.size(); ++i, pos += step) { const double error = pos - std::floor(pos); - const unsigned int64 offset = static_cast(pos); + const uint64_t offset = static_cast(pos); - unsigned int64 indexLeft = offset + 0; + uint64_t indexLeft = offset + 0; if (indexLeft >= inVec.size()) indexLeft = inVec.size() - 1; - unsigned int64 indexRight = offset + 1; + uint64_t indexRight = offset + 1; if (indexRight >= inVec.size()) indexRight = inVec.size() - 1; diff --git a/src/analyzers/baranalyzer.cpp b/src/analyzers/baranalyzer.cpp index f5f69486a..effa439be 100644 --- a/src/analyzers/baranalyzer.cpp +++ b/src/analyzers/baranalyzer.cpp @@ -87,7 +87,7 @@ void BarAnalyzer::init() { for (int x = 0, r = rgb.red(), g = rgb.green(), b = rgb.blue(), r2 = 255 - r; x < height(); ++x) { for (int y = x; y > 0; --y) { - const double fraction = static_casty / height(); + const double fraction = static_cast(y) / height(); // p.setPen( QColor( r + (int)(r2 * fraction), g, b - (int)(255 * // fraction) ) ); @@ -137,8 +137,8 @@ void BarAnalyzer::analyze(QPainter& p, const Scope& s, bool new_frame) { MAX_DOWN) y2 = barVector[i] + MAX_DOWN; - if (static_casty2 > roofVector[i]) { - roofVector[i] = static_casty2; + if (static_cast(y2) > roofVector[i]) { + roofVector[i] = static_cast(y2); roofVelocityVector[i] = 1; } diff --git a/src/analyzers/blockanalyzer.cpp b/src/analyzers/blockanalyzer.cpp index 506f068de..7ff0830c0 100644 --- a/src/analyzers/blockanalyzer.cpp +++ b/src/analyzers/blockanalyzer.cpp @@ -172,7 +172,7 @@ void BlockAnalyzer::analyze(QPainter& p, const Analyzer::Scope& s, // this is opposite to what you'd think, higher than y // means the bar is lower than y (physically) - if (static_casty > m_store[x]) + if (static_cast(y) > m_store[x]) y = static_cast(m_store[x] += m_step); else m_store[x] = y; @@ -339,7 +339,7 @@ void BlockAnalyzer::paletteChange(const QPalette&) { bar()->fill(bg); QPainter p(bar()); - for (int y = 0; static_casty < m_rows; ++y) + for (int y = 0; static_cast(y) < m_rows; ++y) // graduate the fg color p.fillRect(0, y * (HEIGHT + 1), WIDTH, HEIGHT, QColor(r + static_cast(dr * y), g + static_cast(dg * y), @@ -363,7 +363,7 @@ void BlockAnalyzer::paletteChange(const QPalette&) { for (uint y = 0; y < FADE_SIZE; ++y) { m_fade_bars[y].fill(palette().color(QPalette::Background)); QPainter f(&m_fade_bars[y]); - for (int z = 0; static_castz < m_rows; ++z) { + for (int z = 0; static_cast(z) < m_rows; ++z) { const double Y = 1.0 - (log10(FADE_SIZE - y) / log10(FADE_SIZE)); f.fillRect(0, z * (HEIGHT + 1), WIDTH, HEIGHT, QColor(r + static_cast(dr * Y), g + static_cast(dg * Y), b + static_cast(db * Y))); diff --git a/src/analyzers/boomanalyzer.cpp b/src/analyzers/boomanalyzer.cpp index c9f66ee9a..94c8dfc86 100644 --- a/src/analyzers/boomanalyzer.cpp +++ b/src/analyzers/boomanalyzer.cpp @@ -44,11 +44,11 @@ BoomAnalyzer::BoomAnalyzer(QWidget* parent) barPixmap(COLUMN_WIDTH, 50) {} void BoomAnalyzer::changeK_barHeight(int newValue) { - K_barHeight = static_castnewValue / 1000; + K_barHeight = static_cast(newValue) / 1000; } void BoomAnalyzer::changeF_peakSpeed(int newValue) { - F_peakSpeed = static_castnewValue / 1000; + F_peakSpeed = static_cast(newValue) / 1000; } void BoomAnalyzer::resizeEvent(QResizeEvent*) { init(); } @@ -65,7 +65,7 @@ void BoomAnalyzer::init() { QPainter p(&barPixmap); for (uint y = 0; y < HEIGHT; ++y) { - const double F = static_casty * h; + const double F = static_cast(y) * h; p.setPen(QColor(qMax(0, 255 - static_cast(229.0 * F)), qMax(0, 255 - static_cast(229.0 * F)), diff --git a/src/analyzers/glanalyzer2.cpp b/src/analyzers/glanalyzer2.cpp index a952dd146..16538bab9 100644 --- a/src/analyzers/glanalyzer2.cpp +++ b/src/analyzers/glanalyzer2.cpp @@ -77,7 +77,7 @@ void GLAnalyzer2::resizeGL(int w, int h) { glOrtho(-10.0f, 10.0f, -10.0f, 10.0f, -5.0f, 5.0f); // Get the aspect ratio of the screen to draw 'cicular' particles - float ratio = static_castw / static_casth, eqPixH = 60, eqPixW = 80; + float ratio = static_cast(w) / static_cast(h), eqPixH = 60, eqPixW = 80; if (ratio >= (4.0 / 3.0)) { unitX = 10.0 / (eqPixH * ratio); unitY = 10.0 / eqPixH; @@ -89,7 +89,7 @@ void GLAnalyzer2::resizeGL(int w, int h) { // Get current timestamp. timeval tv; gettimeofday(&tv, nullptr); - show.timeStamp = static_casttv.tv_sec + static_casttv.tv_usec / 1000000.0; + show.timeStamp = static_cast(tv.tv_sec) + static_cast(tv.tv_usec) / 1000000.0; } void GLAnalyzer2::paused() { analyze(Scope()); } @@ -109,13 +109,13 @@ void GLAnalyzer2::analyze(const Scope& s) { for (int i = 0; i < bands; i++) { float value = s[i]; currentEnergy += value; - currentMeanBand += static_casti * value; + currentMeanBand += static_cast(i) * value; if (value > maxValue) maxValue = value; } frame.silence = currentEnergy < 0.001; if (!frame.silence) { frame.meanBand = 100.0 * currentMeanBand / (currentEnergy * bands); - currentEnergy = 100.0 * currentEnergy / static_castbands; + currentEnergy = 100.0 * currentEnergy / static_cast(bands); frame.dEnergy = currentEnergy - frame.energy; frame.energy = currentEnergy; // printf( "%d [%f :: %f ]\t%f \n", bands, frame.energy, @@ -133,7 +133,7 @@ void GLAnalyzer2::paintGL() { // Compute the dT since the last call to paintGL and update timings timeval tv; gettimeofday(&tv, nullptr); - double currentTime = static_casttv.tv_sec + static_casttv.tv_usec / 1000000.0; + double currentTime = static_cast(tv.tv_sec) + static_cast(tv.tv_usec) / 1000000.0; show.dT = currentTime - show.timeStamp; show.timeStamp = currentTime; diff --git a/src/analyzers/glanalyzer3.cpp b/src/analyzers/glanalyzer3.cpp index 41b676a3b..f4788cdf3 100644 --- a/src/analyzers/glanalyzer3.cpp +++ b/src/analyzers/glanalyzer3.cpp @@ -163,7 +163,7 @@ void GLAnalyzer3::resizeGL(int w, int h) { glFrustum(-0.5f, 0.5f, -0.5f, 0.5f, 0.5f, 4.5f); // Get the aspect ratio of the screen to draw 'circular' particles - float ratio = static_castw / static_casth; + float ratio = static_cast(w) / static_cast(h); if (ratio >= 1.0) { unitX = 0.34 / ratio; unitY = 0.34; @@ -175,7 +175,7 @@ void GLAnalyzer3::resizeGL(int w, int h) { // Get current timestamp. timeval tv; gettimeofday(&tv, nullptr); - show.timeStamp = static_casttv.tv_sec + static_casttv.tv_usec / 1000000.0; + show.timeStamp = static_cast(tv.tv_sec) + static_cast(tv.tv_usec) / 1000000.0; } void GLAnalyzer3::paused() { analyze(Scope()); } @@ -184,7 +184,7 @@ void GLAnalyzer3::analyze(const Scope& s) { // compute the dTime since the last call timeval tv; gettimeofday(&tv, nullptr); - double currentTime = static_casttv.tv_sec + static_casttv.tv_usec / 1000000.0; + double currentTime = static_cast(tv.tv_sec) + static_cast(tv.tv_usec) / 1000000.0; show.dT = currentTime - show.timeStamp; show.timeStamp = currentTime; @@ -198,7 +198,7 @@ void GLAnalyzer3::analyze(const Scope& s) { currentEnergy += value; if (value > maxValue) maxValue = value; } - currentEnergy *= 100.0 / static_castbands; + currentEnergy *= 100.0 / static_cast(bands); // emulate a peak detector: currentEnergy -> peakEnergy (3tau = 30 seconds) show.peakEnergy = 1.0 + (show.peakEnergy - 1.0) * exp(-show.dT / 10.0); if (currentEnergy > show.peakEnergy) show.peakEnergy = currentEnergy; diff --git a/src/analyzers/turbine.cpp b/src/analyzers/turbine.cpp index d212fbeca..7d409a5d9 100644 --- a/src/analyzers/turbine.cpp +++ b/src/analyzers/turbine.cpp @@ -87,7 +87,7 @@ void TurbineAnalyzer::analyze(QPainter& p, const Scope& scope, bool new_frame) { canvas_painter.setPen(palette().color(QPalette::Highlight)); if (bar_height[i] > 0) canvas_painter.drawRect(x, y, COLUMN_WIDTH - 1, - static_castbar_height[i] * 2 - 1); + static_cast(bar_height[i]) * 2 - 1); const uint x2 = x + COLUMN_WIDTH - 1; canvas_painter.setPen(palette().color(QPalette::Base));