merge shank-rewrite-config changes

git-svn-id: https://svn.musicpd.org/mpd/trunk@2375 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Warren Dukes
2004-10-28 05:14:55 +00:00
parent 8f40569aee
commit 58dbe4bb5d
24 changed files with 947 additions and 625 deletions

View File

@@ -32,34 +32,38 @@ static int replayGainState = REPLAYGAIN_OFF;
static float replayGainPreamp = 1.0;
void initReplayGainState() {
if(!getConf()[CONF_REPLAYGAIN]) return;
ConfigParam * param = getConfigParam(CONF_REPLAYGAIN);
if(strcmp(getConf()[CONF_REPLAYGAIN],"track")==0) {
if(!param) return;
if(strcmp(param->value, "track") == 0) {
replayGainState = REPLAYGAIN_TRACK;
}
else if(strcmp(getConf()[CONF_REPLAYGAIN],"album")==0) {
else if(strcmp(param->value, "album") == 0) {
replayGainState = REPLAYGAIN_ALBUM;
}
else {
ERROR("replaygain value \"%s\" is invalid\n",
getConf()[CONF_REPLAYGAIN]);
ERROR("replaygain value \"%s\" at line %i is invalid\n",
param->value, param->line);
exit(EXIT_FAILURE);
}
if(getConf()[CONF_REPLAYGAIN_PREAMP]) {
param = getConfigParam(CONF_REPLAYGAIN_PREAMP);
if(param) {
char * test;
float f = strtod(getConf()[CONF_REPLAYGAIN_PREAMP], &test);
float f = strtod(param->value, &test);
if(*test != '\0') {
ERROR("Replaygain preamp \"%s\" is not a number\n",
getConf()[CONF_REPLAYGAIN_PREAMP]);
ERROR("Replaygain preamp \"%s\" is not a number at "
"line %i\n", param->value, param->line);
exit(EXIT_FAILURE);
}
if(f < -15 || f > 15) {
ERROR("Replaygain preamp \"%s\" is not between -15 and"
"15\n",
getConf()[CONF_REPLAYGAIN_PREAMP]);
"15 at line %i\n",
param->value, param->line);
exit(EXIT_FAILURE);
}