{decoder,player}/Control: add ReplayGain{Config,Mode} attributes
Don't use the global variables in class DecoderBridge; instead, forward these values to the decoder thread via PlayerControl and DecoderControl.
This commit is contained in:
@@ -30,7 +30,6 @@
|
||||
#include "pcm/PcmConvert.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
#include "AudioConfig.hxx"
|
||||
#include "ReplayGainGlobal.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "input/InputStream.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
@@ -592,14 +591,14 @@ DecoderBridge::SubmitReplayGain(const ReplayGainInfo *new_replay_gain_info)
|
||||
if (++serial == 0)
|
||||
serial = 1;
|
||||
|
||||
if (ReplayGainMode::OFF != replay_gain_mode) {
|
||||
ReplayGainMode rgm = replay_gain_mode;
|
||||
if (ReplayGainMode::OFF != dc.replay_gain_mode) {
|
||||
ReplayGainMode rgm = dc.replay_gain_mode;
|
||||
if (rgm != ReplayGainMode::ALBUM)
|
||||
rgm = ReplayGainMode::TRACK;
|
||||
|
||||
const auto &tuple = new_replay_gain_info->Get(rgm);
|
||||
const auto scale =
|
||||
tuple.CalculateScale(replay_gain_config);
|
||||
tuple.CalculateScale(dc.replay_gain_config);
|
||||
dc.replay_gain_db = 20.0 * log10f(scale);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "thread/Cond.hxx"
|
||||
#include "thread/Thread.hxx"
|
||||
#include "Chrono.hxx"
|
||||
#include "ReplayGainConfig.hxx"
|
||||
#include "ReplayGainMode.hxx"
|
||||
|
||||
#include <exception>
|
||||
|
||||
@@ -156,6 +158,9 @@ struct DecoderControl {
|
||||
*/
|
||||
MusicPipe *pipe;
|
||||
|
||||
ReplayGainConfig replay_gain_config;
|
||||
ReplayGainMode replay_gain_mode = ReplayGainMode::OFF;
|
||||
|
||||
float replay_gain_db = 0;
|
||||
float replay_gain_prev_db = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user