Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Stats.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "db/Stats.hxx"
#include "Log.hxx"
#include "time/ChronoUtil.hxx"
#include "util/Math.hxx"

#ifdef _WIN32
#include "system/Clock.hxx"
Expand Down Expand Up @@ -112,7 +111,7 @@ stats_print(Response &r, const Partition &partition)
r.Fmt("uptime: {}\n"
"playtime: {}\n",
std::chrono::duration_cast<std::chrono::seconds>(uptime).count(),
lround(partition.pc.GetTotalPlayTime().count()));
std::lround(partition.pc.GetTotalPlayTime().count()));

#ifdef ENABLE_DATABASE
const Database *db = partition.instance.GetDatabase();
Expand Down
3 changes: 1 addition & 2 deletions src/command/PlayerCommands.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "util/StringBuffer.hxx"
#include "util/ScopeExit.hxx"
#include "util/Exception.hxx"
#include "util/Math.hxx"

#include "db/Features.hxx" // for ENABLE_DATABASE
#ifdef ENABLE_DATABASE
Expand Down Expand Up @@ -152,7 +151,7 @@ handle_status(Client &client, [[maybe_unused]] Request args, Response &r)

if (pc.GetCrossFade() > FloatDuration::zero())
r.Fmt(COMMAND_STATUS_CROSSFADE ": {}\n",
lround(pc.GetCrossFade().count()));
std::lround(pc.GetCrossFade().count()));

if (pc.GetMixRampDelay() > FloatDuration::zero())
r.Fmt(COMMAND_STATUS_MIXRAMPDELAY ": {}\n",
Expand Down
4 changes: 2 additions & 2 deletions src/decoder/plugins/FaadDecoderPlugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#include "tag/Handler.hxx"
#include "util/ScopeExit.hxx"
#include "util/Domain.hxx"
#include "util/Math.hxx"
#include "util/SpanCast.hxx"
#include "Log.hxx"

#include <cassert>
#include <cmath>
#include <cstring>

#include <neaacdec.h>
Expand Down Expand Up @@ -368,7 +368,7 @@ faad_stream_decode(DecoderClient &client, InputStream &is,
/* update bit rate and position */

if (frame_info.samples > 0) {
bit_rate = lround(frame_info.bytesconsumed * 8.0 *
bit_rate = std::lround(frame_info.bytesconsumed * 8.0 *
frame_info.channels * audio_format.sample_rate /
frame_info.samples / 1000);
}
Expand Down
3 changes: 1 addition & 2 deletions src/decoder/plugins/WavpackDecoderPlugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "fs/Path.hxx"
#include "lib/fmt/PathFormatter.hxx"
#include "lib/fmt/RuntimeError.hxx"
#include "util/Math.hxx"
#include "util/ScopeExit.hxx"

#include <wavpack/wavpack.h>
Expand Down Expand Up @@ -218,7 +217,7 @@ wavpack_decode(DecoderClient &client, WavpackContext *wpc, bool can_seek)
if (n_frames == 0)
break;

int bitrate = lround(WavpackGetInstantBitrate(wpc) / 1000);
int bitrate = std::lround(WavpackGetInstantBitrate(wpc) / 1000);
format_samples(buffer, n_frames * audio_format.channels);

cmd = client.SubmitAudio(nullptr,
Expand Down
4 changes: 2 additions & 2 deletions src/mixer/plugins/AlsaMixerPlugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#include "event/Call.hxx"
#include "util/ASCII.hxx"
#include "util/Domain.hxx"
#include "util/Math.hxx"
#include "Log.hxx"

#include <alsa/asoundlib.h>
#include <cmath>

#define VOLUME_MIXER_ALSA_DEFAULT "default"
#define VOLUME_MIXER_ALSA_CONTROL_DEFAULT "PCM"
Expand Down Expand Up @@ -107,7 +107,7 @@ class AlsaMixer final : public Mixer {
private:
[[gnu::const]]
static unsigned NormalizedToPercent(double normalized) noexcept {
return lround(100 * normalized);
return std::lround(100 * normalized);
}

[[gnu::pure]]
Expand Down
6 changes: 3 additions & 3 deletions src/mixer/plugins/WinmmMixerPlugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#include "output/Features.h"
#include "output/OutputAPI.hxx"
#include "output/plugins/WinmmOutputPlugin.hxx"
#include "util/Math.hxx"

#include <mmsystem.h>

#include <cassert>
#include <cmath>
#include <stdexcept>

#include <windows.h>
Expand Down Expand Up @@ -38,13 +38,13 @@ class WinmmMixer final : public Mixer {
static inline int
winmm_volume_decode(DWORD volume)
{
return lround((volume & 0xFFFF) / 655.35);
return std::lround((volume & 0xFFFF) / 655.35);
}

static inline DWORD
winmm_volume_encode(int volume)
{
int value = lround(volume * 655.35);
int value = std::lround(volume * 655.35);
return MAKELONG(value, value);
}

Expand Down
3 changes: 1 addition & 2 deletions src/pcm/Mix.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "Clamp.hxx"
#include "Traits.hxx"
#include "util/Clamp.hxx"
#include "util/Math.hxx"

#include "Dither.cxx" // including the .cxx file to get inlined templates

Expand Down Expand Up @@ -208,7 +207,7 @@ pcm_mix(PcmDither &dither, void *buffer1, const void *buffer2, size_t size,
s = std::sin((float)M_PI_2 * portion1);
s *= s;

int vol1 = lround(s * PCM_VOLUME_1S);
int vol1 = std::lround(s * PCM_VOLUME_1S);
vol1 = Clamp<int>(vol1, 0, PCM_VOLUME_1S);

return pcm_add_vol(dither, buffer1, buffer2, size,
Expand Down
6 changes: 3 additions & 3 deletions src/player/CrossFade.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#include "pcm/AudioFormat.hxx"
#include "util/CNumberParser.hxx"
#include "util/Domain.hxx"
#include "util/Math.hxx"
#include "Log.hxx"

#include <cassert>
#include <cmath>

static constexpr Domain cross_fade_domain("cross_fade");

Expand Down Expand Up @@ -109,7 +109,7 @@ CrossFadeSettings::Calculate(float replay_gain_db, float replay_gain_prev_db,

if (!IsMixRampEnabled() ||
!mixramp_start || !mixramp_prev_end) {
chunks = lround(duration / chunk_duration);
chunks = std::lround(duration / chunk_duration);
} else {
/* Calculate mixramp overlap. */
const auto mixramp_overlap_current =
Expand All @@ -124,7 +124,7 @@ CrossFadeSettings::Calculate(float replay_gain_db, float replay_gain_prev_db,
if (mixramp_overlap_current >= FloatDuration::zero() &&
mixramp_overlap_prev >= FloatDuration::zero() &&
mixramp_delay <= mixramp_overlap) {
chunks = lround((mixramp_overlap - mixramp_delay)
chunks = std::lround((mixramp_overlap - mixramp_delay)
/ chunk_duration);
FmtDebug(cross_fade_domain,
"will overlap {} chunks, {}s", chunks,
Expand Down
2 changes: 2 additions & 0 deletions src/util/HexFormat.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ HexFormat(char *output, std::span<const std::byte> input) noexcept
* dump of the given fixed-size input.
*/
template<std::size_t size>
requires(size != std::dynamic_extent)
constexpr auto
HexFormat(std::span<const std::byte, size> input) noexcept
{
Expand All @@ -84,6 +85,7 @@ HexFormat(std::span<const std::byte, size> input) noexcept
}

template<std::size_t size>
requires(size != std::dynamic_extent)
constexpr auto
HexFormat(std::span<std::byte, size> input) noexcept
{
Expand Down
20 changes: 0 additions & 20 deletions src/util/Math.hxx

This file was deleted.

Loading