summaryrefslogtreecommitdiff
path: root/src/mixer/plugins
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-02-03 15:50:46 -0800
committerRosen Penev <rosenp@gmail.com>2020-03-15 20:22:07 -0700
commit177371a00395c37f965714b2191bda12cb6af846 (patch)
tree0cc83cddbbcb25783a75bc4e580569fc63964e3c /src/mixer/plugins
parenta78841d6a953c4f40e8196e51bdd4aad995b9104 (diff)
treewide: get rid of C math function usage
Boost does not seem to offer an overload for lrint. Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src/mixer/plugins')
-rw-r--r--src/mixer/plugins/AlsaMixerPlugin.cxx3
-rw-r--r--src/mixer/plugins/SoftwareMixerPlugin.cxx5
2 files changed, 4 insertions, 4 deletions
diff --git a/src/mixer/plugins/AlsaMixerPlugin.cxx b/src/mixer/plugins/AlsaMixerPlugin.cxx
index e3d774194..4b916319b 100644
--- a/src/mixer/plugins/AlsaMixerPlugin.cxx
+++ b/src/mixer/plugins/AlsaMixerPlugin.cxx
@@ -26,6 +26,7 @@
#include "event/Call.hxx"
#include "util/ASCII.hxx"
#include "util/Domain.hxx"
+#include "util/Math.hxx"
#include "util/RuntimeError.hxx"
#include "Log.hxx"
@@ -35,8 +36,6 @@ extern "C" {
#include <alsa/asoundlib.h>
-#include <math.h>
-
#define VOLUME_MIXER_ALSA_DEFAULT "default"
#define VOLUME_MIXER_ALSA_CONTROL_DEFAULT "PCM"
static constexpr unsigned VOLUME_MIXER_ALSA_INDEX_DEFAULT = 0;
diff --git a/src/mixer/plugins/SoftwareMixerPlugin.cxx b/src/mixer/plugins/SoftwareMixerPlugin.cxx
index cb9649017..c62fea986 100644
--- a/src/mixer/plugins/SoftwareMixerPlugin.cxx
+++ b/src/mixer/plugins/SoftwareMixerPlugin.cxx
@@ -23,8 +23,9 @@
#include "pcm/Volume.hxx"
#include <cassert>
+#include <cmath>
-#include <math.h>
+#include <assert.h>
class SoftwareMixer final : public Mixer {
Filter *filter = nullptr;
@@ -74,7 +75,7 @@ PercentVolumeToSoftwareVolume(unsigned volume) noexcept
if (volume >= 100)
return PCM_VOLUME_1;
else if (volume > 0)
- return pcm_float_to_volume((exp(volume / 25.0) - 1) /
+ return pcm_float_to_volume((std::exp(volume / 25.0) - 1) /
(54.5981500331F - 1));
else
return 0;