Merge remote-tracking branch 'neheb/h'
This commit is contained in:
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -20,13 +20,13 @@
|
||||
#include "mixer/MixerInternal.hxx"
|
||||
#include "output/OutputAPI.hxx"
|
||||
#include "output/plugins/WinmmOutputPlugin.hxx"
|
||||
#include "util/Math.hxx"
|
||||
|
||||
#include <mmsystem.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <math.h>
|
||||
#include <windows.h>
|
||||
|
||||
class WinmmMixer final : public Mixer {
|
||||
|
@@ -34,11 +34,6 @@
|
||||
#include <stdbool.h>
|
||||
#include "volume_mapping.h"
|
||||
|
||||
#ifdef __UCLIBC__
|
||||
/* 10^x = 10^(log e^x) = (e^x)^log10 = e^(x * log 10) */
|
||||
#define exp10(x) (exp((x) * log(10)))
|
||||
#endif /* __UCLIBC__ */
|
||||
|
||||
#define MAX_LINEAR_DB_SCALE 24
|
||||
|
||||
static inline bool use_linear_dB_scale(long dBmin, long dBmax)
|
||||
@@ -111,9 +106,9 @@ static double get_normalized_volume(snd_mixer_elem_t *elem,
|
||||
if (use_linear_dB_scale(min, max))
|
||||
return (value - min) / (double)(max - min);
|
||||
|
||||
normalized = exp10((value - max) / 6000.0);
|
||||
normalized = pow(10, (value - max) / 6000.0);
|
||||
if (min != SND_CTL_TLV_DB_GAIN_MUTE) {
|
||||
min_norm = exp10((min - max) / 6000.0);
|
||||
min_norm = pow(10, (min - max) / 6000.0);
|
||||
normalized = (normalized - min_norm) / (1 - min_norm);
|
||||
}
|
||||
|
||||
@@ -159,7 +154,7 @@ static int set_normalized_volume(snd_mixer_elem_t *elem,
|
||||
}
|
||||
|
||||
if (min != SND_CTL_TLV_DB_GAIN_MUTE) {
|
||||
min_norm = exp10((min - max) / 6000.0);
|
||||
min_norm = pow(10, (min - max) / 6000.0);
|
||||
volume = volume * (1 - min_norm) + min_norm;
|
||||
}
|
||||
value = lrint_dir(6000.0 * log10(volume), dir) + max;
|
||||
|
Reference in New Issue
Block a user