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
333a08eb
Commit
333a08eb
authored
Jan 07, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replay_gain_info, ...: use cmath instead of math.h in C++ mode
Fixes build problems with mingw32.
parent
989c9a73
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
8 deletions
+20
-8
CrossFade.cxx
src/CrossFade.cxx
+6
-4
PlayerControl.cxx
src/PlayerControl.cxx
+3
-2
PlayerThread.cxx
src/PlayerThread.cxx
+3
-1
ReplayGainConfig.cxx
src/ReplayGainConfig.cxx
+0
-1
replay_gain_info.h
src/replay_gain_info.h
+8
-0
No files found.
src/CrossFade.cxx
View file @
333a08eb
...
...
@@ -23,6 +23,8 @@
#include "audio_format.h"
#include "tag.h"
#include <cmath>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
...
...
@@ -82,9 +84,8 @@ static float mixramp_interpolate(char *ramp_list, float required_db)
}
/* If required db < any stored value, use the least. */
if
(
isnan
(
last_db
))
{
if
(
std
::
isnan
(
last_db
))
return
secs
;
}
/* Finally, interpolate linearly. */
secs
=
last_secs
+
(
required_db
-
last_db
)
*
(
secs
-
last_secs
)
/
(
db
-
last_db
);
...
...
@@ -114,13 +115,14 @@ unsigned cross_fade_calc(float duration, float total_time,
chunks_f
=
(
float
)
audio_format_time_to_size
(
af
)
/
(
float
)
CHUNK_SIZE
;
if
(
isnan
(
mixramp_delay
)
||
!
(
mixramp_start
)
||
!
(
mixramp_prev_end
)
)
{
if
(
std
::
isnan
(
mixramp_delay
)
||
!
mixramp_start
||
!
mixramp_prev_end
)
{
chunks
=
(
chunks_f
*
duration
+
0.5
);
}
else
{
/* Calculate mixramp overlap. */
mixramp_overlap
=
mixramp_interpolate
(
mixramp_start
,
mixramp_db
-
replay_gain_db
)
+
mixramp_interpolate
(
mixramp_prev_end
,
mixramp_db
-
replay_gain_prev_db
);
if
(
!
isnan
(
mixramp_overlap
)
&&
(
mixramp_delay
<=
mixramp_overlap
))
{
if
(
!
std
::
isnan
(
mixramp_overlap
)
&&
mixramp_delay
<=
mixramp_overlap
)
{
chunks
=
(
chunks_f
*
(
mixramp_overlap
-
mixramp_delay
));
g_debug
(
"will overlap %d chunks, %fs"
,
chunks
,
mixramp_overlap
-
mixramp_delay
);
...
...
src/PlayerControl.cxx
View file @
333a08eb
...
...
@@ -28,9 +28,10 @@ extern "C" {
#include "DecoderControl.hxx"
#include "Main.hxx"
#include <cmath>
#include <assert.h>
#include <stdio.h>
#include <math.h>
static
void
pc_enqueue_song_locked
(
struct
player_control
*
pc
,
struct
song
*
song
);
...
...
@@ -49,7 +50,7 @@ player_control::player_control(unsigned _buffer_chunks,
next_song
(
nullptr
),
cross_fade_seconds
(
0
),
mixramp_db
(
0
),
mixramp_delay_seconds
(
nanf
(
""
)),
mixramp_delay_seconds
(
std
::
nanf
(
""
)),
total_play_time
(
0
)
{
}
...
...
src/PlayerThread.cxx
View file @
333a08eb
...
...
@@ -37,6 +37,8 @@ extern "C" {
#include "idle.h"
}
#include <cmath>
#include <glib.h>
#undef G_LOG_DOMAIN
...
...
@@ -759,7 +761,7 @@ play_next_chunk(struct player *player)
other_chunk
->
tag
);
other_chunk
->
tag
=
NULL
;
if
(
isnan
(
pc
->
mixramp_delay_seconds
))
{
if
(
std
::
isnan
(
pc
->
mixramp_delay_seconds
))
{
chunk
->
mix_ratio
=
((
float
)
cross_fade_position
)
/
player
->
cross_fade_chunks
;
}
else
{
...
...
src/ReplayGainConfig.cxx
View file @
333a08eb
...
...
@@ -33,7 +33,6 @@ extern "C" {
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
enum
replay_gain_mode
replay_gain_mode
=
REPLAY_GAIN_OFF
;
...
...
src/replay_gain_info.h
View file @
333a08eb
...
...
@@ -22,8 +22,12 @@
#include "check.h"
#ifdef __cplusplus
#include <cmath>
#else
#include <stdbool.h>
#include <math.h>
#endif
enum
replay_gain_mode
{
REPLAY_GAIN_AUTO
=
-
2
,
...
...
@@ -58,7 +62,11 @@ replay_gain_info_init(struct replay_gain_info *info)
static
inline
bool
replay_gain_tuple_defined
(
const
struct
replay_gain_tuple
*
tuple
)
{
#ifdef __cplusplus
return
!
std
::
isinf
(
tuple
->
gain
);
#else
return
!
isinf
(
tuple
->
gain
);
#endif
}
#ifdef __cplusplus
...
...
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