mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 03:40:30 +00:00
GUI/vuMeter: Simplify a bit
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user