summaryrefslogtreecommitdiff
path: root/src/model/pulsemodel.cpp
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@pobox.com>2026-05-17 10:14:22 -0400
committerCalvin Morrison <calvin@pobox.com>2026-05-17 10:14:22 -0400
commit311b69c14203860ab6d98bd11633eea287c8f04e (patch)
treebad243b12d3e5935af1cf4c214bd39e90a984b94 /src/model/pulsemodel.cpp
parent83ff745b43ebda7b33c52ac1a80a1408c59bfa70 (diff)
cleanups
Diffstat (limited to 'src/model/pulsemodel.cpp')
-rw-r--r--src/model/pulsemodel.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/model/pulsemodel.cpp b/src/model/pulsemodel.cpp
index bf9f9ee..de91831 100644
--- a/src/model/pulsemodel.cpp
+++ b/src/model/pulsemodel.cpp
@@ -3,6 +3,8 @@
#include <tqapplication.h>
#include <tqtimer.h>
+#include <algorithm>
+#include <cmath>
// Custom events posted from the PA thread to the main thread.
static const int PA_EVENT = TQEvent::User + 1;
@@ -132,7 +134,7 @@ static TQString paAppIcon( pa_proplist *pl )
static int paVolumeToPercent( const pa_cvolume &cv )
{
pa_volume_t mx = pa_cvolume_max( &cv );
- return (int)( (double)mx / PA_VOLUME_NORM * 100.0 + 0.5 );
+ return (int)std::lround( (double)mx / PA_VOLUME_NORM * 100.0 );
}
// Derive pan -50..+50 from the first two channels of a cvolume.
@@ -141,7 +143,7 @@ static int cvolumeToPan( const pa_cvolume &cv )
if ( cv.channels < 2 ) return 0;
double l = cv.values[0];
double r = cv.values[1];
- double mx = ( l > r ) ? l : r;
+ double mx = std::max( l, r );
if ( mx < 1.0 ) return 0;
return (int)( ( r - l ) / mx * 50.0 );
}