ReplayGain{Config,Global}: move to config/
This commit is contained in:
parent
95a155b10d
commit
dda521a150
|
@ -281,6 +281,7 @@ sources = [
|
|||
'src/command/CommandListBuilder.cxx',
|
||||
'src/config/PartitionConfig.cxx',
|
||||
'src/config/PlayerConfig.cxx',
|
||||
'src/config/ReplayGainConfig.cxx',
|
||||
'src/Idle.cxx',
|
||||
'src/IdleFlags.cxx',
|
||||
'src/decoder/Thread.cxx',
|
||||
|
@ -336,7 +337,6 @@ sources = [
|
|||
'src/queue/PlaylistEdit.cxx',
|
||||
'src/queue/PlaylistTag.cxx',
|
||||
'src/queue/PlaylistState.cxx',
|
||||
'src/ReplayGainGlobal.cxx',
|
||||
'src/LocateUri.cxx',
|
||||
'src/SongUpdate.cxx',
|
||||
'src/SongLoader.cxx',
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Copyright 2003-2021 The Music Player Daemon Project
|
||||
* http://www.musicpd.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef MPD_REPLAY_GAIN_GLOBAL_HXX
|
||||
#define MPD_REPLAY_GAIN_GLOBAL_HXX
|
||||
|
||||
struct ConfigData;
|
||||
struct ReplayGainConfig;
|
||||
|
||||
ReplayGainConfig
|
||||
LoadReplayGainConfig(const ConfigData &config);
|
||||
|
||||
#endif
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
#include "ReplayGainInfo.hxx"
|
||||
#include "ReplayGainConfig.hxx"
|
||||
#include "config/ReplayGainConfig.hxx"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
#include "util/RuntimeError.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "MusicChunk.hxx"
|
||||
#include "ReplayGainGlobal.hxx"
|
||||
|
||||
static constexpr
|
||||
size_t MIN_BUFFER_SIZE = std::max(CHUNK_SIZE * 32,
|
||||
64 * KILOBYTE);
|
||||
|
||||
PlayerConfig::PlayerConfig(const ConfigData &config)
|
||||
:replay_gain(config)
|
||||
{
|
||||
size_t buffer_size = PlayerConfig::DEFAULT_BUFFER_SIZE;
|
||||
if (auto *param = config.GetParam(ConfigOption::AUDIO_BUFFER_SIZE)) {
|
||||
|
@ -62,6 +62,4 @@ PlayerConfig::PlayerConfig(const ConfigData &config)
|
|||
|
||||
return ParseAudioFormat(s, true);
|
||||
});
|
||||
|
||||
replay_gain = LoadReplayGainConfig(config);
|
||||
}
|
||||
|
|
|
@ -17,9 +17,8 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "ReplayGainGlobal.hxx"
|
||||
#include "ReplayGainConfig.hxx"
|
||||
#include "config/Data.hxx"
|
||||
#include "Data.hxx"
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
@ -42,25 +41,18 @@ ParsePreamp(const char *s)
|
|||
return std::pow(10.0f, f / 20.0f);
|
||||
}
|
||||
|
||||
ReplayGainConfig
|
||||
LoadReplayGainConfig(const ConfigData &config)
|
||||
ReplayGainConfig::ReplayGainConfig(const ConfigData &config)
|
||||
:preamp(config.With(ConfigOption::REPLAYGAIN_PREAMP, [](const char *s){
|
||||
return s != nullptr
|
||||
? ParsePreamp(s)
|
||||
: 1.0f;
|
||||
})),
|
||||
missing_preamp(config.With(ConfigOption::REPLAYGAIN_MISSING_PREAMP, [](const char *s){
|
||||
return s != nullptr
|
||||
? ParsePreamp(s)
|
||||
: 1.0f;
|
||||
})),
|
||||
limit(config.GetBool(ConfigOption::REPLAYGAIN_LIMIT,
|
||||
ReplayGainConfig::DEFAULT_LIMIT))
|
||||
{
|
||||
ReplayGainConfig replay_gain_config;
|
||||
|
||||
replay_gain_config.preamp = config.With(ConfigOption::REPLAYGAIN_PREAMP, [](const char *s){
|
||||
return s != nullptr
|
||||
? ParsePreamp(s)
|
||||
: 1.0f;
|
||||
});
|
||||
|
||||
replay_gain_config.missing_preamp = config.With(ConfigOption::REPLAYGAIN_MISSING_PREAMP, [](const char *s){
|
||||
return s != nullptr
|
||||
? ParsePreamp(s)
|
||||
: 1.0f;
|
||||
});
|
||||
|
||||
replay_gain_config.limit = config.GetBool(ConfigOption::REPLAYGAIN_LIMIT,
|
||||
ReplayGainConfig::DEFAULT_LIMIT);
|
||||
|
||||
return replay_gain_config;
|
||||
}
|
|
@ -17,8 +17,9 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef MPD_REPLAY_GAIN_CONFIG_HXX
|
||||
#define MPD_REPLAY_GAIN_CONFIG_HXX
|
||||
#pragma once
|
||||
|
||||
struct ConfigData;
|
||||
|
||||
struct ReplayGainConfig {
|
||||
static constexpr bool DEFAULT_LIMIT = true;
|
||||
|
@ -28,6 +29,8 @@ struct ReplayGainConfig {
|
|||
float missing_preamp = 1.0;
|
||||
|
||||
bool limit = DEFAULT_LIMIT;
|
||||
};
|
||||
|
||||
#endif
|
||||
ReplayGainConfig() = default;
|
||||
|
||||
explicit ReplayGainConfig(const ConfigData &config);
|
||||
};
|
|
@ -28,7 +28,7 @@
|
|||
#include "thread/Cond.hxx"
|
||||
#include "thread/Thread.hxx"
|
||||
#include "Chrono.hxx"
|
||||
#include "ReplayGainConfig.hxx"
|
||||
#include "config/ReplayGainConfig.hxx"
|
||||
#include "ReplayGainMode.hxx"
|
||||
|
||||
#include <cassert>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "filter/Filter.hxx"
|
||||
#include "filter/Prepared.hxx"
|
||||
#include "ReplayGainInfo.hxx"
|
||||
#include "ReplayGainConfig.hxx"
|
||||
#include "config/ReplayGainConfig.hxx"
|
||||
#include "mixer/MixerControl.hxx"
|
||||
#include "pcm/AudioFormat.hxx"
|
||||
#include "pcm/Volume.hxx"
|
||||
|
|
Loading…
Reference in New Issue