replace lrint with lround
lrint is a configurable version of lround that behaves either as round, floor, ceil, or trunc based on setting the proper FE_ macro using fset/getround. Given that it's not set at all and that it defaults to round behavior, simply replace with round. Also removed the util/Math defines. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
e41a52d909
commit
4fd0c84f46
@ -273,7 +273,7 @@ AlsaMixer::GetVolume()
|
|||||||
throw FormatRuntimeError("snd_mixer_handle_events() failed: %s",
|
throw FormatRuntimeError("snd_mixer_handle_events() failed: %s",
|
||||||
snd_strerror(err));
|
snd_strerror(err));
|
||||||
|
|
||||||
return lrint(100 * get_normalized_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT));
|
return lround(100 * get_normalized_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -282,7 +282,7 @@ AlsaMixer::SetVolume(unsigned volume)
|
|||||||
assert(handle != nullptr);
|
assert(handle != nullptr);
|
||||||
|
|
||||||
double cur = get_normalized_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT);
|
double cur = get_normalized_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT);
|
||||||
int delta = volume - lrint(100.*cur);
|
int delta = volume - lround(100.*cur);
|
||||||
int err = set_normalized_playback_volume(elem, cur + 0.01*delta, delta);
|
int err = set_normalized_playback_volume(elem, cur + 0.01*delta, delta);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
throw FormatRuntimeError("failed to set ALSA volume: %s",
|
throw FormatRuntimeError("failed to set ALSA volume: %s",
|
||||||
|
@ -32,12 +32,9 @@
|
|||||||
|
|
||||||
#ifdef __UCLIBC__
|
#ifdef __UCLIBC__
|
||||||
#include <boost/math/special_functions/round.hpp>
|
#include <boost/math/special_functions/round.hpp>
|
||||||
using boost::math::iround;
|
|
||||||
using boost::math::lround;
|
using boost::math::lround;
|
||||||
#define lrint iround
|
|
||||||
#else
|
#else
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
using std::lrint;
|
|
||||||
using std::lround;
|
using std::lround;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user