ReplayGainGlobal: use struct ConfigData

This commit is contained in:
Max Kellermann 2018-07-17 22:32:56 +02:00
parent dd57b81989
commit 0209bc4ba7
3 changed files with 11 additions and 10 deletions

View File

@ -135,9 +135,9 @@ struct Config {
};
static Config
LoadConfig()
LoadConfig(const ConfigData &config)
{
return {LoadReplayGainConfig()};
return {LoadReplayGainConfig(config)};
}
#ifdef ENABLE_DAEMON
@ -494,7 +494,7 @@ try {
ParseCommandLine(argc, argv, options);
#endif
const auto config = LoadConfig();
const auto config = LoadConfig(GetGlobalConfig());
#ifdef ENABLE_DAEMON
glue_daemonize_init(&options);

View File

@ -21,7 +21,7 @@
#include "ReplayGainGlobal.hxx"
#include "ReplayGainConfig.hxx"
#include "config/Param.hxx"
#include "config/Global.hxx"
#include "config/Data.hxx"
#include "util/RuntimeError.hxx"
#include <assert.h>
@ -56,20 +56,20 @@ ParsePreamp(const ConfigParam &p)
}
ReplayGainConfig
LoadReplayGainConfig()
LoadReplayGainConfig(const ConfigData &config)
{
ReplayGainConfig replay_gain_config;
const auto *param = config_get_param(ConfigOption::REPLAYGAIN_PREAMP);
const auto *param = config.GetParam(ConfigOption::REPLAYGAIN_PREAMP);
if (param)
replay_gain_config.preamp = ParsePreamp(*param);
param = config_get_param(ConfigOption::REPLAYGAIN_MISSING_PREAMP);
param = config.GetParam(ConfigOption::REPLAYGAIN_MISSING_PREAMP);
if (param)
replay_gain_config.missing_preamp = ParsePreamp(*param);
replay_gain_config.limit = config_get_bool(ConfigOption::REPLAYGAIN_LIMIT,
ReplayGainConfig::DEFAULT_LIMIT);
replay_gain_config.limit = config.GetBool(ConfigOption::REPLAYGAIN_LIMIT,
ReplayGainConfig::DEFAULT_LIMIT);
return replay_gain_config;
}

View File

@ -22,9 +22,10 @@
#include "check.h"
struct ConfigData;
struct ReplayGainConfig;
ReplayGainConfig
LoadReplayGainConfig();
LoadReplayGainConfig(const ConfigData &config);
#endif