From 311b69c14203860ab6d98bd11633eea287c8f04e Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Sun, 17 May 2026 10:14:22 -0400 Subject: cleanups --- src/model/pulsemodel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/model/pulsemodel.cpp') 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 #include +#include +#include // 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 ); } -- cgit v1.2.3