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
efda73c7
Commit
efda73c7
authored
Jul 17, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add replaygain preamp
git-svn-id:
https://svn.musicpd.org/mpd/trunk@1873
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
3edf3315
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
conf.c
src/conf.c
+3
-2
conf.h
src/conf.h
+1
-0
replayGain.c
src/replayGain.c
+24
-1
No files found.
src/conf.c
View file @
efda73c7
...
...
@@ -37,7 +37,7 @@
#define CONF_COMMENT '#'
#define CONF_NUMBER_OF_PARAMS 3
3
#define CONF_NUMBER_OF_PARAMS 3
4
#define CONF_NUMBER_OF_PATHS 6
#define CONF_NUMBER_OF_REQUIRED 5
#define CONF_NUMBER_OF_ALLOW_CATS 1
...
...
@@ -129,7 +129,8 @@ char ** readConf(char * file) {
"http_proxy_host"
,
"http_proxy_port"
,
"http_proxy_user"
,
"http_proxy_password"
"http_proxy_password"
,
"replaygain_preamp"
};
int
conf_absolutePaths
[
CONF_NUMBER_OF_PATHS
]
=
{
...
...
src/conf.h
View file @
efda73c7
...
...
@@ -54,6 +54,7 @@
#define CONF_HTTP_PROXY_PORT 30
#define CONF_HTTP_PROXY_USER 31
#define CONF_HTTP_PROXY_PASSWORD 32
#define CONF_REPLAYGAIN_PREAMP 33
#define CONF_CAT_CHAR "\n"
...
...
src/replayGain.c
View file @
efda73c7
...
...
@@ -29,6 +29,8 @@
/* Added 4/14/2004 by AliasMrJones */
static
int
replayGainState
=
REPLAYGAIN_OFF
;
static
float
replayGainPreamp
=
1
.
0
;
void
initReplayGainState
()
{
if
(
!
getConf
()[
CONF_REPLAYGAIN
])
return
;
...
...
@@ -43,17 +45,38 @@ void initReplayGainState() {
getConf
()[
CONF_REPLAYGAIN
]);
exit
(
EXIT_FAILURE
);
}
if
(
getConf
()[
CONF_REPLAYGAIN_PREAMP
])
{
char
*
test
;
float
f
=
strtod
(
getConf
()[
CONF_REPLAYGAIN_PREAMP
],
&
test
);
if
(
*
test
!=
'\0'
)
{
ERROR
(
"Replaygain preamp
\"
%s
\"
is not a number
\n
"
,
getConf
()[
CONF_REPLAYGAIN_PREAMP
]);
exit
(
EXIT_FAILURE
);
}
if
(
f
<
-
15
||
f
>
15
)
{
ERROR
(
"Replaygain preamp
\"
%s
\"
is not between -15 and"
"15
\n
"
,
getConf
()[
CONF_REPLAYGAIN_PREAMP
]);
exit
(
EXIT_FAILURE
);
}
replayGainPreamp
=
pow
(
10
,
f
/
20
.
0
);
}
}
int
getReplayGainState
()
{
return
replayGainState
;
}
float
computeReplayGainScale
(
float
gain
,
float
peak
){
float
computeReplayGainScale
(
float
gain
,
float
peak
)
{
float
scale
;
if
(
gain
==
0
.
0
)
return
(
1
);
scale
=
pow
(
10
.
0
,
gain
/
20
.
0
);
scale
*=
replayGainPreamp
;
if
(
scale
>
15
.
0
)
scale
=
15
.
0
;
if
(
scale
*
peak
>
1
.
0
)
{
...
...
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