Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
6d91b5c7
Unverified
Commit
6d91b5c7
authored
Mar 15, 2020
by
Rosen Penev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix double promotions
Found with -Wdouble-promotion Signed-off-by:
Rosen Penev
<
rosenp@gmail.com
>
parent
fd715140
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
53 additions
and
54 deletions
+53
-54
ReplayGainGlobal.cxx
src/ReplayGainGlobal.cxx
+6
-7
ReplayGainInfo.cxx
src/ReplayGainInfo.cxx
+5
-5
PlayerCommands.cxx
src/command/PlayerCommands.cxx
+1
-1
Bridge.cxx
src/decoder/Bridge.cxx
+1
-1
MadDecoderPlugin.cxx
src/decoder/plugins/MadDecoderPlugin.cxx
+6
-6
OpusTags.cxx
src/decoder/plugins/OpusTags.cxx
+2
-2
LameEncoderPlugin.cxx
src/encoder/plugins/LameEncoderPlugin.cxx
+4
-4
TwolameEncoderPlugin.cxx
src/encoder/plugins/TwolameEncoderPlugin.cxx
+3
-3
VorbisEncoderPlugin.cxx
src/encoder/plugins/VorbisEncoderPlugin.cxx
+4
-4
PulseMixerPlugin.cxx
src/mixer/plugins/PulseMixerPlugin.cxx
+5
-5
SoftwareMixerPlugin.cxx
src/mixer/plugins/SoftwareMixerPlugin.cxx
+6
-7
Source.cxx
src/output/Source.cxx
+1
-1
Dsd2Pcm.cxx
src/pcm/Dsd2Pcm.cxx
+3
-3
FloatConvert.hxx
src/pcm/FloatConvert.hxx
+1
-1
Mix.cxx
src/pcm/Mix.cxx
+1
-1
SoxrResampler.cxx
src/pcm/SoxrResampler.cxx
+1
-1
Volume.hxx
src/pcm/Volume.hxx
+1
-1
PlaylistState.cxx
src/queue/PlaylistState.cxx
+2
-1
No files found.
src/ReplayGainGlobal.cxx
View file @
6d91b5c7
...
@@ -23,24 +23,23 @@
...
@@ -23,24 +23,23 @@
#include "util/Math.hxx"
#include "util/Math.hxx"
#include <cassert>
#include <cassert>
#include <cstdlib>
#include <stdexcept>
#include <stdexcept>
#include <stdlib.h>
static
float
static
float
ParsePreamp
(
const
char
*
s
)
ParsePreamp
(
const
char
*
s
)
{
{
assert
(
s
!=
nullptr
);
assert
(
s
!=
nullptr
);
char
*
endptr
;
char
*
endptr
;
float
f
=
st
rtod
(
s
,
&
endptr
);
float
f
=
st
d
::
strtof
(
s
,
&
endptr
);
if
(
endptr
==
s
||
*
endptr
!=
'\0'
)
if
(
endptr
==
s
||
*
endptr
!=
'\0'
)
throw
std
::
invalid_argument
(
"Not a numeric value"
);
throw
std
::
invalid_argument
(
"Not a numeric value"
);
if
(
f
<
-
15
||
f
>
15
)
if
(
f
<
-
15
.0
f
||
f
>
15.0
f
)
throw
std
::
invalid_argument
(
"Number must be between -15 and 15"
);
throw
std
::
invalid_argument
(
"Number must be between -15 and 15"
);
return
pow
(
10
,
f
/
20.0
);
return
std
::
pow
(
10.0
f
,
f
/
20.0
f
);
}
}
ReplayGainConfig
ReplayGainConfig
...
@@ -51,13 +50,13 @@ LoadReplayGainConfig(const ConfigData &config)
...
@@ -51,13 +50,13 @@ LoadReplayGainConfig(const ConfigData &config)
replay_gain_config
.
preamp
=
config
.
With
(
ConfigOption
::
REPLAYGAIN_PREAMP
,
[](
const
char
*
s
){
replay_gain_config
.
preamp
=
config
.
With
(
ConfigOption
::
REPLAYGAIN_PREAMP
,
[](
const
char
*
s
){
return
s
!=
nullptr
return
s
!=
nullptr
?
ParsePreamp
(
s
)
?
ParsePreamp
(
s
)
:
1.0
;
:
1.0
f
;
});
});
replay_gain_config
.
missing_preamp
=
config
.
With
(
ConfigOption
::
REPLAYGAIN_MISSING_PREAMP
,
[](
const
char
*
s
){
replay_gain_config
.
missing_preamp
=
config
.
With
(
ConfigOption
::
REPLAYGAIN_MISSING_PREAMP
,
[](
const
char
*
s
){
return
s
!=
nullptr
return
s
!=
nullptr
?
ParsePreamp
(
s
)
?
ParsePreamp
(
s
)
:
1.0
;
:
1.0
f
;
});
});
replay_gain_config
.
limit
=
config
.
GetBool
(
ConfigOption
::
REPLAYGAIN_LIMIT
,
replay_gain_config
.
limit
=
config
.
GetBool
(
ConfigOption
::
REPLAYGAIN_LIMIT
,
...
...
src/ReplayGainInfo.cxx
View file @
6d91b5c7
...
@@ -27,13 +27,13 @@ ReplayGainTuple::CalculateScale(const ReplayGainConfig &config) const noexcept
...
@@ -27,13 +27,13 @@ ReplayGainTuple::CalculateScale(const ReplayGainConfig &config) const noexcept
float
scale
;
float
scale
;
if
(
IsDefined
())
{
if
(
IsDefined
())
{
scale
=
pow
(
10.0
,
gain
/
20.0
);
scale
=
std
::
pow
(
10.0
f
,
gain
/
20.0
f
);
scale
*=
config
.
preamp
;
scale
*=
config
.
preamp
;
if
(
scale
>
15.0
)
if
(
scale
>
15.0
f
)
scale
=
15.0
;
scale
=
15.0
f
;
if
(
config
.
limit
&&
scale
*
peak
>
1.0
)
if
(
config
.
limit
&&
scale
*
peak
>
1.0
f
)
scale
=
1.0
/
peak
;
scale
=
1.0
f
/
peak
;
}
else
}
else
scale
=
config
.
missing_preamp
;
scale
=
config
.
missing_preamp
;
...
...
src/command/PlayerCommands.cxx
View file @
6d91b5c7
...
@@ -149,7 +149,7 @@ handle_status(Client &client, [[maybe_unused]] Request args, Response &r)
...
@@ -149,7 +149,7 @@ handle_status(Client &client, [[maybe_unused]] Request args, Response &r)
partition
.
name
.
c_str
(),
partition
.
name
.
c_str
(),
(
unsigned
long
)
playlist
.
GetVersion
(),
(
unsigned
long
)
playlist
.
GetVersion
(),
playlist
.
GetLength
(),
playlist
.
GetLength
(),
pc
.
GetMixRampDb
(),
(
double
)
pc
.
GetMixRampDb
(),
state
);
state
);
if
(
pc
.
GetCrossFade
()
>
FloatDuration
::
zero
())
if
(
pc
.
GetCrossFade
()
>
FloatDuration
::
zero
())
...
...
src/decoder/Bridge.cxx
View file @
6d91b5c7
...
@@ -611,7 +611,7 @@ DecoderBridge::SubmitReplayGain(const ReplayGainInfo *new_replay_gain_info) noex
...
@@ -611,7 +611,7 @@ DecoderBridge::SubmitReplayGain(const ReplayGainInfo *new_replay_gain_info) noex
const
auto
&
tuple
=
new_replay_gain_info
->
Get
(
rgm
);
const
auto
&
tuple
=
new_replay_gain_info
->
Get
(
rgm
);
const
auto
scale
=
const
auto
scale
=
tuple
.
CalculateScale
(
dc
.
replay_gain_config
);
tuple
.
CalculateScale
(
dc
.
replay_gain_config
);
dc
.
replay_gain_db
=
20.0
*
std
::
log10
(
scale
);
dc
.
replay_gain_db
=
20.0
f
*
std
::
log10
(
scale
);
}
}
replay_gain_info
=
*
new_replay_gain_info
;
replay_gain_info
=
*
new_replay_gain_info
;
...
...
src/decoder/plugins/MadDecoderPlugin.cxx
View file @
6d91b5c7
...
@@ -585,8 +585,8 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
...
@@ -585,8 +585,8 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
mad_bit_skip
(
ptr
,
16
);
mad_bit_skip
(
ptr
,
16
);
lame
->
peak
=
mad_f_todouble
(
mad_bit_read
(
ptr
,
32
)
<<
5
);
/* peak */
lame
->
peak
=
MAD_F
(
mad_bit_read
(
ptr
,
32
)
<<
5
);
/* peak */
FormatDebug
(
mad_domain
,
"LAME peak found: %f"
,
lame
->
peak
);
FormatDebug
(
mad_domain
,
"LAME peak found: %f"
,
double
(
lame
->
peak
)
);
lame
->
track_gain
=
0
;
lame
->
track_gain
=
0
;
unsigned
name
=
mad_bit_read
(
ptr
,
3
);
/* gain name */
unsigned
name
=
mad_bit_read
(
ptr
,
3
);
/* gain name */
...
@@ -594,9 +594,9 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
...
@@ -594,9 +594,9 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
unsigned
sign
=
mad_bit_read
(
ptr
,
1
);
/* sign bit */
unsigned
sign
=
mad_bit_read
(
ptr
,
1
);
/* sign bit */
int
gain
=
mad_bit_read
(
ptr
,
9
);
/* gain*10 */
int
gain
=
mad_bit_read
(
ptr
,
9
);
/* gain*10 */
if
(
gain
&&
name
==
1
&&
orig
!=
0
)
{
if
(
gain
&&
name
==
1
&&
orig
!=
0
)
{
lame
->
track_gain
=
((
sign
?
-
gain
:
gain
)
/
10.0
)
+
adj
;
lame
->
track_gain
=
((
sign
?
-
gain
:
gain
)
/
10.0
f
)
+
adj
;
FormatDebug
(
mad_domain
,
"LAME track gain found: %f"
,
FormatDebug
(
mad_domain
,
"LAME track gain found: %f"
,
lame
->
track_gain
);
double
(
lame
->
track_gain
)
);
}
}
/* tmz reports that this isn't currently written by any version of lame
/* tmz reports that this isn't currently written by any version of lame
...
@@ -612,7 +612,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
...
@@ -612,7 +612,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
if (gain && name == 2 && orig != 0) {
if (gain && name == 2 && orig != 0) {
lame->album_gain = ((sign ? -gain : gain) / 10.0) + adj;
lame->album_gain = ((sign ? -gain : gain) / 10.0) + adj;
FormatDebug(mad_domain, "LAME album gain found: %f",
FormatDebug(mad_domain, "LAME album gain found: %f",
lame->track_gain
);
double(lame->track_gain)
);
}
}
#else
#else
mad_bit_skip
(
ptr
,
16
);
mad_bit_skip
(
ptr
,
16
);
...
@@ -746,7 +746,7 @@ MadDecoder::DecodeFirstFrame(Tag *tag) noexcept
...
@@ -746,7 +746,7 @@ MadDecoder::DecodeFirstFrame(Tag *tag) noexcept
/* Album gain isn't currently used. See comment in
/* Album gain isn't currently used. See comment in
* parse_lame() for details. -- jat */
* parse_lame() for details. -- jat */
if
(
client
!=
nullptr
&&
!
found_replay_gain
&&
if
(
client
!=
nullptr
&&
!
found_replay_gain
&&
lame
.
track_gain
)
{
lame
.
track_gain
>
0.0
f
)
{
ReplayGainInfo
rgi
;
ReplayGainInfo
rgi
;
rgi
.
Clear
();
rgi
.
Clear
();
rgi
.
track
.
gain
=
lame
.
track_gain
;
rgi
.
track
.
gain
=
lame
.
track_gain
;
...
...
src/decoder/plugins/OpusTags.cxx
View file @
6d91b5c7
...
@@ -61,7 +61,7 @@ ScanOneOpusTag(StringView name, StringView value,
...
@@ -61,7 +61,7 @@ ScanOneOpusTag(StringView name, StringView value,
const
char
*
endptr
;
const
char
*
endptr
;
const
auto
l
=
ParseInt64
(
value
,
&
endptr
,
10
);
const
auto
l
=
ParseInt64
(
value
,
&
endptr
,
10
);
if
(
endptr
>
value
.
begin
()
&&
endptr
==
value
.
end
())
if
(
endptr
>
value
.
begin
()
&&
endptr
==
value
.
end
())
rgi
->
track
.
gain
=
double
(
l
)
/
256.
;
rgi
->
track
.
gain
=
float
(
l
)
/
256.0
f
;
}
else
if
(
rgi
!=
nullptr
&&
}
else
if
(
rgi
!=
nullptr
&&
name
.
EqualsIgnoreCase
(
"R128_ALBUM_GAIN"
))
{
name
.
EqualsIgnoreCase
(
"R128_ALBUM_GAIN"
))
{
/* R128_ALBUM_GAIN is a Q7.8 fixed point number in
/* R128_ALBUM_GAIN is a Q7.8 fixed point number in
...
@@ -70,7 +70,7 @@ ScanOneOpusTag(StringView name, StringView value,
...
@@ -70,7 +70,7 @@ ScanOneOpusTag(StringView name, StringView value,
const
char
*
endptr
;
const
char
*
endptr
;
const
auto
l
=
ParseInt64
(
value
,
&
endptr
,
10
);
const
auto
l
=
ParseInt64
(
value
,
&
endptr
,
10
);
if
(
endptr
>
value
.
begin
()
&&
endptr
==
value
.
end
())
if
(
endptr
>
value
.
begin
()
&&
endptr
==
value
.
end
())
rgi
->
album
.
gain
=
double
(
l
)
/
256.
;
rgi
->
album
.
gain
=
float
(
l
)
/
256.0
f
;
}
}
handler
.
OnPair
(
name
,
value
);
handler
.
OnPair
(
name
,
value
);
...
...
src/encoder/plugins/LameEncoderPlugin.cxx
View file @
6d91b5c7
...
@@ -76,9 +76,9 @@ PreparedLameEncoder::PreparedLameEncoder(const ConfigBlock &block)
...
@@ -76,9 +76,9 @@ PreparedLameEncoder::PreparedLameEncoder(const ConfigBlock &block)
if
(
value
!=
nullptr
)
{
if
(
value
!=
nullptr
)
{
/* a quality was configured (VBR) */
/* a quality was configured (VBR) */
quality
=
ParseDouble
(
value
,
&
endptr
);
quality
=
float
(
ParseDouble
(
value
,
&
endptr
)
);
if
(
*
endptr
!=
'\0'
||
quality
<
-
1.0
||
quality
>
10.0
)
if
(
*
endptr
!=
'\0'
||
quality
<
-
1.0
f
||
quality
>
10.0
f
)
throw
FormatRuntimeError
(
"quality
\"
%s
\"
is not a number in the "
throw
FormatRuntimeError
(
"quality
\"
%s
\"
is not a number in the "
"range -1 to 10"
,
"range -1 to 10"
,
value
);
value
);
...
@@ -110,13 +110,13 @@ static void
...
@@ -110,13 +110,13 @@ static void
lame_encoder_setup
(
lame_global_flags
*
gfp
,
float
quality
,
int
bitrate
,
lame_encoder_setup
(
lame_global_flags
*
gfp
,
float
quality
,
int
bitrate
,
const
AudioFormat
&
audio_format
)
const
AudioFormat
&
audio_format
)
{
{
if
(
quality
>=
-
1.0
)
{
if
(
quality
>=
-
1.0
f
)
{
/* a quality was configured (VBR) */
/* a quality was configured (VBR) */
if
(
0
!=
lame_set_VBR
(
gfp
,
vbr_rh
))
if
(
0
!=
lame_set_VBR
(
gfp
,
vbr_rh
))
throw
std
::
runtime_error
(
"error setting lame VBR mode"
);
throw
std
::
runtime_error
(
"error setting lame VBR mode"
);
if
(
0
!=
lame_set_VBR_q
(
gfp
,
quality
))
if
(
0
!=
lame_set_VBR_q
(
gfp
,
int
(
quality
)
))
throw
std
::
runtime_error
(
"error setting lame VBR quality"
);
throw
std
::
runtime_error
(
"error setting lame VBR quality"
);
}
else
{
}
else
{
/* a bit rate was configured */
/* a bit rate was configured */
...
...
src/encoder/plugins/TwolameEncoderPlugin.cxx
View file @
6d91b5c7
...
@@ -94,9 +94,9 @@ PreparedTwolameEncoder::PreparedTwolameEncoder(const ConfigBlock &block)
...
@@ -94,9 +94,9 @@ PreparedTwolameEncoder::PreparedTwolameEncoder(const ConfigBlock &block)
if
(
value
!=
nullptr
)
{
if
(
value
!=
nullptr
)
{
/* a quality was configured (VBR) */
/* a quality was configured (VBR) */
quality
=
ParseDouble
(
value
,
&
endptr
);
quality
=
float
(
ParseDouble
(
value
,
&
endptr
)
);
if
(
*
endptr
!=
'\0'
||
quality
<
-
1.0
||
quality
>
10.0
)
if
(
*
endptr
!=
'\0'
||
quality
<
-
1.0
f
||
quality
>
10.0
f
)
throw
FormatRuntimeError
(
"quality
\"
%s
\"
is not a number in the "
throw
FormatRuntimeError
(
"quality
\"
%s
\"
is not a number in the "
"range -1 to 10"
,
"range -1 to 10"
,
value
);
value
);
...
@@ -131,7 +131,7 @@ static void
...
@@ -131,7 +131,7 @@ static void
twolame_encoder_setup
(
twolame_options
*
options
,
float
quality
,
int
bitrate
,
twolame_encoder_setup
(
twolame_options
*
options
,
float
quality
,
int
bitrate
,
const
AudioFormat
&
audio_format
)
const
AudioFormat
&
audio_format
)
{
{
if
(
quality
>=
-
1.0
)
{
if
(
quality
>=
-
1.0
f
)
{
/* a quality was configured (VBR) */
/* a quality was configured (VBR) */
if
(
0
!=
twolame_set_VBR
(
options
,
true
))
if
(
0
!=
twolame_set_VBR
(
options
,
true
))
...
...
src/encoder/plugins/VorbisEncoderPlugin.cxx
View file @
6d91b5c7
...
@@ -84,7 +84,7 @@ PreparedVorbisEncoder::PreparedVorbisEncoder(const ConfigBlock &block)
...
@@ -84,7 +84,7 @@ PreparedVorbisEncoder::PreparedVorbisEncoder(const ConfigBlock &block)
char
*
endptr
;
char
*
endptr
;
quality
=
ParseDouble
(
value
,
&
endptr
);
quality
=
ParseDouble
(
value
,
&
endptr
);
if
(
*
endptr
!=
'\0'
||
quality
<
-
1.0
||
quality
>
10.0
)
if
(
*
endptr
!=
'\0'
||
quality
<
-
1.0
f
||
quality
>
10.0
f
)
throw
FormatRuntimeError
(
"quality
\"
%s
\"
is not a number in the "
throw
FormatRuntimeError
(
"quality
\"
%s
\"
is not a number in the "
"range -1 to 10"
,
"range -1 to 10"
,
value
);
value
);
...
@@ -122,13 +122,13 @@ VorbisEncoder::VorbisEncoder(float quality, int bitrate,
...
@@ -122,13 +122,13 @@ VorbisEncoder::VorbisEncoder(float quality, int bitrate,
_audio_format
.
format
=
SampleFormat
::
FLOAT
;
_audio_format
.
format
=
SampleFormat
::
FLOAT
;
audio_format
=
_audio_format
;
audio_format
=
_audio_format
;
if
(
quality
>=
-
1.0
)
{
if
(
quality
>=
-
1.0
f
)
{
/* a quality was configured (VBR) */
/* a quality was configured (VBR) */
if
(
0
!=
vorbis_encode_init_vbr
(
&
vi
,
if
(
0
!=
vorbis_encode_init_vbr
(
&
vi
,
audio_format
.
channels
,
audio_format
.
channels
,
audio_format
.
sample_rate
,
audio_format
.
sample_rate
,
quality
*
0.1
))
{
quality
*
0.1
f
))
{
vorbis_info_clear
(
&
vi
);
vorbis_info_clear
(
&
vi
);
throw
std
::
runtime_error
(
"error initializing vorbis vbr"
);
throw
std
::
runtime_error
(
"error initializing vorbis vbr"
);
}
}
...
@@ -138,7 +138,7 @@ VorbisEncoder::VorbisEncoder(float quality, int bitrate,
...
@@ -138,7 +138,7 @@ VorbisEncoder::VorbisEncoder(float quality, int bitrate,
if
(
0
!=
vorbis_encode_init
(
&
vi
,
if
(
0
!=
vorbis_encode_init
(
&
vi
,
audio_format
.
channels
,
audio_format
.
channels
,
audio_format
.
sample_rate
,
-
1.0
,
audio_format
.
sample_rate
,
-
1.0
,
bitrate
*
1000
,
-
1.0
))
{
bitrate
*
1000
,
-
1.0
f
))
{
vorbis_info_clear
(
&
vi
);
vorbis_info_clear
(
&
vi
);
throw
std
::
runtime_error
(
"error initializing vorbis encoder"
);
throw
std
::
runtime_error
(
"error initializing vorbis encoder"
);
}
}
...
...
src/mixer/plugins/PulseMixerPlugin.cxx
View file @
6d91b5c7
...
@@ -49,7 +49,7 @@ public:
...
@@ -49,7 +49,7 @@ public:
double
_volume_scale_factor
)
double
_volume_scale_factor
)
:
Mixer
(
pulse_mixer_plugin
,
_listener
),
:
Mixer
(
pulse_mixer_plugin
,
_listener
),
output
(
_output
),
output
(
_output
),
volume_scale_factor
(
_volume_scale_factor
)
volume_scale_factor
(
float
(
_volume_scale_factor
)
)
{
{
}
}
...
@@ -173,7 +173,7 @@ parse_volume_scale_factor(const char *value) {
...
@@ -173,7 +173,7 @@ parse_volume_scale_factor(const char *value) {
char
*
endptr
;
char
*
endptr
;
float
factor
=
ParseFloat
(
value
,
&
endptr
);
float
factor
=
ParseFloat
(
value
,
&
endptr
);
if
(
endptr
==
value
||
*
endptr
!=
'\0'
||
factor
<
0.5
||
factor
>
5.0
)
if
(
endptr
==
value
||
*
endptr
!=
'\0'
||
factor
<
0.5
f
||
factor
>
5.0
f
)
throw
FormatRuntimeError
(
"
\"
%s
\"
is not a number in the "
throw
FormatRuntimeError
(
"
\"
%s
\"
is not a number in the "
"range 0.5 to 5.0"
,
"range 0.5 to 5.0"
,
value
);
value
);
...
@@ -188,7 +188,7 @@ pulse_mixer_init([[maybe_unused]] EventLoop &event_loop, AudioOutput &ao,
...
@@ -188,7 +188,7 @@ pulse_mixer_init([[maybe_unused]] EventLoop &event_loop, AudioOutput &ao,
{
{
auto
&
po
=
(
PulseOutput
&
)
ao
;
auto
&
po
=
(
PulseOutput
&
)
ao
;
float
scale
=
parse_volume_scale_factor
(
block
.
GetBlockValue
(
"scale_volume"
));
float
scale
=
parse_volume_scale_factor
(
block
.
GetBlockValue
(
"scale_volume"
));
auto
*
pm
=
new
PulseMixer
(
po
,
listener
,
scale
);
auto
*
pm
=
new
PulseMixer
(
po
,
listener
,
(
double
)
scale
);
pulse_output_set_mixer
(
po
,
*
pm
);
pulse_output_set_mixer
(
po
,
*
pm
);
...
@@ -214,7 +214,7 @@ PulseMixer::GetVolume()
...
@@ -214,7 +214,7 @@ PulseMixer::GetVolume()
int
int
PulseMixer
::
GetVolumeInternal
()
PulseMixer
::
GetVolumeInternal
()
{
{
pa_volume_t
max_pa_volume
=
volume_scale_factor
*
PA_VOLUME_NORM
;
pa_volume_t
max_pa_volume
=
pa_volume_t
(
volume_scale_factor
*
PA_VOLUME_NORM
)
;
return
online
?
return
online
?
(
int
)((
100
*
(
pa_cvolume_avg
(
&
volume
)
+
1
))
/
max_pa_volume
)
(
int
)((
100
*
(
pa_cvolume_avg
(
&
volume
)
+
1
))
/
max_pa_volume
)
:
-
1
;
:
-
1
;
...
@@ -228,7 +228,7 @@ PulseMixer::SetVolume(unsigned new_volume)
...
@@ -228,7 +228,7 @@ PulseMixer::SetVolume(unsigned new_volume)
if
(
!
online
)
if
(
!
online
)
throw
std
::
runtime_error
(
"disconnected"
);
throw
std
::
runtime_error
(
"disconnected"
);
pa_volume_t
max_pa_volume
=
volume_scale_factor
*
PA_VOLUME_NORM
;
pa_volume_t
max_pa_volume
=
pa_volume_t
(
volume_scale_factor
*
PA_VOLUME_NORM
)
;
struct
pa_cvolume
cvolume
;
struct
pa_cvolume
cvolume
;
pa_cvolume_set
(
&
cvolume
,
volume
.
channels
,
pa_cvolume_set
(
&
cvolume
,
volume
.
channels
,
...
...
src/mixer/plugins/SoftwareMixerPlugin.cxx
View file @
6d91b5c7
...
@@ -25,8 +25,6 @@
...
@@ -25,8 +25,6 @@
#include <cassert>
#include <cassert>
#include <cmath>
#include <cmath>
#include <assert.h>
class
SoftwareMixer
final
:
public
Mixer
{
class
SoftwareMixer
final
:
public
Mixer
{
Filter
*
filter
=
nullptr
;
Filter
*
filter
=
nullptr
;
...
@@ -72,13 +70,14 @@ PercentVolumeToSoftwareVolume(unsigned volume) noexcept
...
@@ -72,13 +70,14 @@ PercentVolumeToSoftwareVolume(unsigned volume) noexcept
{
{
assert
(
volume
<=
100
);
assert
(
volume
<=
100
);
if
(
volume
>
=
100
)
if
(
volume
=
=
100
)
return
PCM_VOLUME_1
;
return
PCM_VOLUME_1
;
else
if
(
volume
>
0
)
return
pcm_float_to_volume
((
std
::
exp
(
volume
/
25.0
)
-
1
)
/
if
(
volume
>
0
)
return
pcm_float_to_volume
((
std
::
exp
(
volume
/
25.0
f
)
-
1
)
/
(
54.5981500331
F
-
1
));
(
54.5981500331
F
-
1
));
else
return
0
;
return
0
;
}
}
void
void
...
...
src/output/Source.cxx
View file @
6d91b5c7
...
@@ -195,7 +195,7 @@ AudioOutputSource::FilterChunk(const MusicChunk &chunk)
...
@@ -195,7 +195,7 @@ AudioOutputSource::FilterChunk(const MusicChunk &chunk)
only if the mix ratio is non-negative; a
only if the mix ratio is non-negative; a
negative mix ratio is a MixRamp special
negative mix ratio is a MixRamp special
case */
case */
mix_ratio
=
1.0
-
mix_ratio
;
mix_ratio
=
1.0
f
-
mix_ratio
;
void
*
dest
=
cross_fade_buffer
.
Get
(
other_data
.
size
);
void
*
dest
=
cross_fade_buffer
.
Get
(
other_data
.
size
);
memcpy
(
dest
,
other_data
.
data
,
other_data
.
size
);
memcpy
(
dest
,
other_data
.
data
,
other_data
.
size
);
...
...
src/pcm/Dsd2Pcm.cxx
View file @
6d91b5c7
...
@@ -127,7 +127,7 @@ CalculateCtableValue(size_t t, int k, int e) noexcept
...
@@ -127,7 +127,7 @@ CalculateCtableValue(size_t t, int k, int e) noexcept
acc
+=
(((
e
>>
(
7
-
m
))
&
1
)
*
2
-
1
)
*
htaps
[
t
*
8
+
m
];
acc
+=
(((
e
>>
(
7
-
m
))
&
1
)
*
2
-
1
)
*
htaps
[
t
*
8
+
m
];
}
}
return
acc
;
return
float
(
acc
)
;
}
}
/* this needs to be a struct because GCC 6 doesn't have constexpr
/* this needs to be a struct because GCC 6 doesn't have constexpr
...
@@ -204,9 +204,9 @@ Dsd2Pcm::CalcOutputSample(size_t ffp) const noexcept
...
@@ -204,9 +204,9 @@ Dsd2Pcm::CalcOutputSample(size_t ffp) const noexcept
for
(
size_t
i
=
0
;
i
<
CTABLES
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
CTABLES
;
++
i
)
{
uint8_t
bite1
=
fifo
[(
ffp
-
i
)
&
FIFOMASK
];
uint8_t
bite1
=
fifo
[(
ffp
-
i
)
&
FIFOMASK
];
uint8_t
bite2
=
fifo
[(
ffp
-
(
CTABLES
*
2
-
1
)
+
i
)
&
FIFOMASK
];
uint8_t
bite2
=
fifo
[(
ffp
-
(
CTABLES
*
2
-
1
)
+
i
)
&
FIFOMASK
];
acc
+=
ctables
[
i
][
bite1
]
+
ctables
[
i
][
bite2
]
;
acc
+=
double
(
ctables
[
i
][
bite1
]
+
ctables
[
i
][
bite2
])
;
}
}
return
acc
;
return
float
(
acc
)
;
}
}
inline
float
inline
float
...
...
src/pcm/FloatConvert.hxx
View file @
6d91b5c7
...
@@ -54,7 +54,7 @@ struct IntegerToFloatSampleConvert {
...
@@ -54,7 +54,7 @@ struct IntegerToFloatSampleConvert {
typedef
typename
SrcTraits
::
value_type
SV
;
typedef
typename
SrcTraits
::
value_type
SV
;
typedef
typename
DstTraits
::
value_type
DV
;
typedef
typename
DstTraits
::
value_type
DV
;
static
constexpr
DV
factor
=
1.0
/
FloatToIntegerSampleConvert
<
F
,
Traits
>::
factor
;
static
constexpr
DV
factor
=
1.0
f
/
FloatToIntegerSampleConvert
<
F
,
Traits
>::
factor
;
static_assert
(
factor
>
0
,
"Wrong factor"
);
static_assert
(
factor
>
0
,
"Wrong factor"
);
static
constexpr
DV
Convert
(
SV
src
)
noexcept
{
static
constexpr
DV
Convert
(
SV
src
)
noexcept
{
...
...
src/pcm/Mix.cxx
View file @
6d91b5c7
...
@@ -221,7 +221,7 @@ pcm_mix(PcmDither &dither, void *buffer1, const void *buffer2, size_t size,
...
@@ -221,7 +221,7 @@ pcm_mix(PcmDither &dither, void *buffer1, const void *buffer2, size_t size,
if
(
portion1
<
0
)
if
(
portion1
<
0
)
return
pcm_add
(
buffer1
,
buffer2
,
size
,
format
);
return
pcm_add
(
buffer1
,
buffer2
,
size
,
format
);
s
=
s
in
(
M_PI_2
*
portion1
);
s
=
s
td
::
sin
((
float
)
M_PI_2
*
portion1
);
s
*=
s
;
s
*=
s
;
int
vol1
=
lround
(
s
*
PCM_VOLUME_1S
);
int
vol1
=
lround
(
s
*
PCM_VOLUME_1S
);
...
...
src/pcm/SoxrResampler.cxx
View file @
6d91b5c7
...
@@ -123,7 +123,7 @@ SoxrPcmResampler::Open(AudioFormat &af, unsigned new_sample_rate)
...
@@ -123,7 +123,7 @@ SoxrPcmResampler::Open(AudioFormat &af, unsigned new_sample_rate)
ratio
=
float
(
new_sample_rate
)
/
float
(
af
.
sample_rate
);
ratio
=
float
(
new_sample_rate
)
/
float
(
af
.
sample_rate
);
FormatDebug
(
soxr_domain
,
FormatDebug
(
soxr_domain
,
"samplerate conversion ratio to %.2lf"
,
"samplerate conversion ratio to %.2lf"
,
ratio
);
double
(
ratio
)
);
/* libsoxr works with floating point samples */
/* libsoxr works with floating point samples */
af
.
format
=
SampleFormat
::
FLOAT
;
af
.
format
=
SampleFormat
::
FLOAT
;
...
...
src/pcm/Volume.hxx
View file @
6d91b5c7
...
@@ -48,7 +48,7 @@ static constexpr int PCM_VOLUME_1S = PCM_VOLUME_1;
...
@@ -48,7 +48,7 @@ static constexpr int PCM_VOLUME_1S = PCM_VOLUME_1;
constexpr
int
constexpr
int
pcm_float_to_volume
(
float
volume
)
noexcept
pcm_float_to_volume
(
float
volume
)
noexcept
{
{
return
volume
*
PCM_VOLUME_1
+
0.5
;
return
int
(
volume
*
PCM_VOLUME_1
+
0.5
f
)
;
}
}
constexpr
float
constexpr
float
...
...
src/queue/PlaylistState.cxx
View file @
6d91b5c7
...
@@ -92,7 +92,8 @@ playlist_state_save(BufferedOutputStream &os, const struct playlist &playlist,
...
@@ -92,7 +92,8 @@ playlist_state_save(BufferedOutputStream &os, const struct playlist &playlist,
os
.
Format
(
PLAYLIST_STATE_FILE_CONSUME
"%i
\n
"
,
playlist
.
queue
.
consume
);
os
.
Format
(
PLAYLIST_STATE_FILE_CONSUME
"%i
\n
"
,
playlist
.
queue
.
consume
);
os
.
Format
(
PLAYLIST_STATE_FILE_CROSSFADE
"%i
\n
"
,
os
.
Format
(
PLAYLIST_STATE_FILE_CROSSFADE
"%i
\n
"
,
(
int
)
pc
.
GetCrossFade
().
count
());
(
int
)
pc
.
GetCrossFade
().
count
());
os
.
Format
(
PLAYLIST_STATE_FILE_MIXRAMPDB
"%f
\n
"
,
pc
.
GetMixRampDb
());
os
.
Format
(
PLAYLIST_STATE_FILE_MIXRAMPDB
"%f
\n
"
,
(
double
)
pc
.
GetMixRampDb
());
os
.
Format
(
PLAYLIST_STATE_FILE_MIXRAMPDELAY
"%f
\n
"
,
os
.
Format
(
PLAYLIST_STATE_FILE_MIXRAMPDELAY
"%f
\n
"
,
pc
.
GetMixRampDelay
().
count
());
pc
.
GetMixRampDelay
().
count
());
os
.
Write
(
PLAYLIST_STATE_FILE_PLAYLIST_BEGIN
"
\n
"
);
os
.
Write
(
PLAYLIST_STATE_FILE_PLAYLIST_BEGIN
"
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment