GUI/vuMeter: Simplify a bit

This commit is contained in:
Martin Piatka
2022-03-24 14:32:52 +01:00
parent 243c7e112a
commit 588ce18c52
2 changed files with 4 additions and 9 deletions

View File

@@ -25,9 +25,11 @@ ug_connection *connectLoop(int port){
return connection;
}
static constexpr int meterVerticalPad = 5;
static constexpr int meterBarPad = 2;
static constexpr double zeroLevel = -40.0;
}//anon namespace
constexpr double VuMeterWidget::zeroLevel;
void VuMeterWidget::updateVal(){
updateVolumes();
@@ -39,12 +41,9 @@ void VuMeterWidget::updateVal(){
barLevel[i] = std::max(barLevel[i] - fallSpeed / updatesPerSecond, 0.0);
rmsLevel[i] = std::max(rmsLevel[i] - fallSpeed / updatesPerSecond, 0.0);
#if 1
double newPeakHeight = 100 - std::max(peak[i], zeroLevel) * (100 / zeroLevel);
double newRmsHeight = 100 - std::max(rms[i], zeroLevel) * (100 / zeroLevel);
#else
double newHeight = pow(10.0, peak[i] / 20.0) * 100;
#endif
barLevel[i] = std::max(barLevel[i], newPeakHeight);
rmsLevel[i] = std::max(rmsLevel[i], newRmsHeight);
}

View File

@@ -63,10 +63,6 @@ private:
std::chrono::system_clock::time_point last_connect;
static const int meterVerticalPad = 5;
static const int meterBarPad = 2;
static constexpr double zeroLevel = -40.0;
void paintMeter(QPainter&, int x, int y, int width, int height, double peak, double rms);
void paintScale(QPainter&, int x, int y, int width, int height);