@ -1,8 +1,7 @@
From bffc5cde6d71556f143500a12c53c1835deebe07 Mon Sep 17 00:00:00 2001
From 769cd0ee9f0cf8ceb026aa751b5d4a390bb5dbdc Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Sun, 2 Feb 2020 21:21:57 -0800
Subject: [PATCH 1/3] treewide: use boost::lround when std::round is
unavailable
Subject: [PATCH] treewide: use boost::lround when std::round is unavailable
This is the case with uClibc-ng currently.
@ -13,12 +12,14 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
src/decoder/plugins/FaadDecoderPlugin.cxx | 3 +-
src/mixer/plugins/WinmmMixerPlugin.cxx | 2 +-
src/output/plugins/HaikuOutputPlugin.cxx | 3 +-
src/pcm/Mix.cxx | 5 ++-
src/pcm/Pcm Mix.cxx | 5 ++-
src/player/CrossFade.cxx | 5 ++-
src/util/Math.hxx | 41 +++++++++++++++++++++++
8 files changed, 52 insertions(+), 16 deletions(-)
create mode 100644 src/util/Math.hxx
diff --git a/src/Stats.cxx b/src/Stats.cxx
index 2208312d7..7467a3a17 100644
--- a/src/Stats.cxx
+++ b/src/Stats.cxx
@@ -29,9 +29,9 @@
@ -41,6 +42,8 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
#ifdef ENABLE_DATABASE
const Database *db = partition.instance.GetDatabase();
diff --git a/src/command/PlayerCommands.cxx b/src/command/PlayerCommands.cxx
index 7f3b4f296..4acb8f2ad 100644
--- a/src/command/PlayerCommands.cxx
+++ b/src/command/PlayerCommands.cxx
@@ -34,13 +34,12 @@
@ -67,6 +70,25 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
if (pc.GetMixRampDelay() > FloatDuration::zero())
r.Format(COMMAND_STATUS_MIXRAMPDELAY ": %f\n",
diff --git a/src/decoder/plugins/FaadDecoderPlugin.cxx b/src/decoder/plugins/FaadDecoderPlugin.cxx
index 983103e0e..e1c9576d3 100644
--- a/src/decoder/plugins/FaadDecoderPlugin.cxx
+++ b/src/decoder/plugins/FaadDecoderPlugin.cxx
@@ -26,11 +26,11 @@
#include "util/ScopeExit.hxx"
#include "util/ConstBuffer.hxx"
#include "util/Domain.hxx"
+#include "util/Math.hxx"
#include "Log.hxx"
#include <neaacdec.h>
-#include <cmath>
#include <exception>
#include <assert.h>
diff --git a/src/mixer/plugins/WinmmMixerPlugin.cxx b/src/mixer/plugins/WinmmMixerPlugin.cxx
index 9661d6551..905e650ef 100644
--- a/src/mixer/plugins/WinmmMixerPlugin.cxx
+++ b/src/mixer/plugins/WinmmMixerPlugin.cxx
@@ -20,13 +20,13 @@
@ -84,6 +106,8 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
#include <windows.h>
class WinmmMixer final : public Mixer {
diff --git a/src/output/plugins/HaikuOutputPlugin.cxx b/src/output/plugins/HaikuOutputPlugin.cxx
index 952fb0c2f..01240aca9 100644
--- a/src/output/plugins/HaikuOutputPlugin.cxx
+++ b/src/output/plugins/HaikuOutputPlugin.cxx
@@ -22,6 +22,7 @@
@ -103,6 +127,8 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
#include <string.h>
#define UTF8_PLAY "\xE2\x96\xB6"
diff --git a/src/pcm/PcmMix.cxx b/src/pcm/PcmMix.cxx
index 17e34b005..59179f54e 100644
--- a/src/pcm/PcmMix.cxx
+++ b/src/pcm/PcmMix.cxx
@@ -22,11 +22,10 @@
@ -127,6 +153,8 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
vol1 = Clamp<int>(vol1, 0, PCM_VOLUME_1S);
return pcm_add_vol(dither, buffer1, buffer2, size,
diff --git a/src/player/CrossFade.cxx b/src/player/CrossFade.cxx
index ce86d3f0a..8a91516f1 100644
--- a/src/player/CrossFade.cxx
+++ b/src/player/CrossFade.cxx
@@ -23,10 +23,9 @@
@ -150,11 +178,14 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
} else {
/* Calculate mixramp overlap. */
const auto mixramp_overlap_current =
diff --git a/src/util/Math.hxx b/src/util/Math.hxx
new file mode 100644
index 000000000..bd856f5a9
--- /dev/null
+++ b/src/util/Math.hxx
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2020 Rosen Penev <rosenp @gmail.com>
+ * Copyright (C) 2018 Max Kellermann <max.kellermann @gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions