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
b21e4d9a
Commit
b21e4d9a
authored
Feb 15, 2010
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replay_gain_state: moved code to replay_gain_tuple_scale()
Moved (and renamed) the function calc_replay_gain_scale() to replay_gain_info.c.
parent
eeef501e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
19 deletions
+21
-19
replay_gain_info.c
src/replay_gain_info.c
+17
-0
replay_gain_info.h
src/replay_gain_info.h
+3
-0
replay_gain_state.c
src/replay_gain_state.c
+1
-19
No files found.
src/replay_gain_info.c
View file @
b21e4d9a
...
...
@@ -21,6 +21,7 @@
#include "replay_gain_info.h"
#include <glib.h>
#include <math.h>
struct
replay_gain_info
*
replay_gain_info_new
(
void
)
...
...
@@ -46,3 +47,19 @@ replay_gain_info_free(struct replay_gain_info *info)
{
g_free
(
info
);
}
float
replay_gain_tuple_scale
(
const
struct
replay_gain_tuple
*
tuple
,
float
preamp
)
{
float
scale
;
scale
=
pow
(
10
.
0
,
tuple
->
gain
/
20
.
0
);
scale
*=
preamp
;
if
(
scale
>
15
.
0
)
scale
=
15
.
0
;
if
(
scale
*
tuple
->
peak
>
1
.
0
)
scale
=
1
.
0
/
tuple
->
peak
;
return
scale
;
}
src/replay_gain_info.h
View file @
b21e4d9a
...
...
@@ -57,4 +57,7 @@ replay_gain_tuple_defined(const struct replay_gain_tuple *tuple)
return
tuple
->
gain
>
0
.
0
;
}
float
replay_gain_tuple_scale
(
const
struct
replay_gain_tuple
*
tuple
,
float
preamp
);
#endif
src/replay_gain_state.c
View file @
b21e4d9a
...
...
@@ -24,7 +24,6 @@
#include <glib.h>
#include <assert.h>
#include <math.h>
struct
replay_gain_state
{
float
preamp
,
missing_preamp
;
...
...
@@ -60,22 +59,6 @@ replay_gain_state_free(struct replay_gain_state *state)
g_free
(
state
);
}
static
float
calc_replay_gain_scale
(
float
gain
,
float
peak
,
float
preamp
)
{
float
scale
;
scale
=
pow
(
10
.
0
,
gain
/
20
.
0
);
scale
*=
preamp
;
if
(
scale
>
15
.
0
)
scale
=
15
.
0
;
if
(
scale
*
peak
>
1
.
0
)
{
scale
=
1
.
0
/
peak
;
}
return
(
scale
);
}
static
void
replay_gain_state_calc_scale
(
struct
replay_gain_state
*
state
)
{
...
...
@@ -90,8 +73,7 @@ replay_gain_state_calc_scale(struct replay_gain_state *state)
g_debug
(
"computing ReplayGain scale with gain %f, peak %f"
,
tuple
->
gain
,
tuple
->
peak
);
state
->
scale
=
calc_replay_gain_scale
(
tuple
->
gain
,
tuple
->
peak
,
state
->
preamp
);
state
->
scale
=
replay_gain_tuple_scale
(
tuple
,
state
->
preamp
);
}
else
state
->
scale
=
state
->
missing_preamp
;
}
...
...
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