player/Control: make ReplayGainConfig const

This commit is contained in:
Max Kellermann 2016-12-03 13:07:33 +01:00
parent e443513996
commit cd4bb444ff
4 changed files with 17 additions and 12 deletions

View File

@ -33,7 +33,8 @@ Partition::Partition(Instance &_instance,
global_events(instance.event_loop, BIND_THIS_METHOD(OnGlobalEvent)),
playlist(max_length, *this),
outputs(*this),
pc(*this, outputs, buffer_chunks, buffered_before_play)
pc(*this, outputs, buffer_chunks, buffered_before_play,
replay_gain_config)
{
}
@ -51,7 +52,7 @@ Partition::UpdateEffectiveReplayGainMode(ReplayGainMode mode)
? ReplayGainMode::TRACK
: ReplayGainMode::ALBUM;
pc.LockSetReplayGain(replay_gain_config, mode);
pc.LockSetReplayGainMode(mode);
outputs.SetReplayGainMode(mode);
}

View File

@ -29,10 +29,12 @@
PlayerControl::PlayerControl(PlayerListener &_listener,
MultipleOutputs &_outputs,
unsigned _buffer_chunks,
unsigned _buffered_before_play)
unsigned _buffered_before_play,
const ReplayGainConfig &_replay_gain_config)
:listener(_listener), outputs(_outputs),
buffer_chunks(_buffer_chunks),
buffered_before_play(_buffered_before_play)
buffered_before_play(_buffered_before_play),
replay_gain_config(_replay_gain_config)
{
}

View File

@ -169,7 +169,7 @@ struct PlayerControl {
CrossFadeSettings cross_fade;
ReplayGainConfig replay_gain_config;
const ReplayGainConfig replay_gain_config;
ReplayGainMode replay_gain_mode = ReplayGainMode::OFF;
double total_play_time = 0;
@ -186,7 +186,8 @@ struct PlayerControl {
PlayerControl(PlayerListener &_listener,
MultipleOutputs &_outputs,
unsigned buffer_chunks,
unsigned buffered_before_play);
unsigned buffered_before_play,
const ReplayGainConfig &_replay_gain_config);
~PlayerControl();
/**
@ -468,10 +469,8 @@ public:
return cross_fade.mixramp_delay;
}
void LockSetReplayGain(const ReplayGainConfig &_config,
ReplayGainMode _mode) {
void LockSetReplayGainMode(ReplayGainMode _mode) {
const ScopeLock protect(mutex);
replay_gain_config = _config;
replay_gain_mode = _mode;
}

View File

@ -53,10 +53,12 @@ filter_plugin_by_name(gcc_unused const char *name)
PlayerControl::PlayerControl(PlayerListener &_listener,
MultipleOutputs &_outputs,
unsigned _buffer_chunks,
unsigned _buffered_before_play)
unsigned _buffered_before_play,
const ReplayGainConfig &_replay_gain_config)
:listener(_listener), outputs(_outputs),
buffer_chunks(_buffer_chunks),
buffered_before_play(_buffered_before_play) {}
buffered_before_play(_buffered_before_play),
replay_gain_config(_replay_gain_config) {}
PlayerControl::~PlayerControl() {}
static AudioOutput *
@ -70,7 +72,8 @@ load_audio_output(EventLoop &event_loop, const char *name)
static struct PlayerControl dummy_player_control(*(PlayerListener *)nullptr,
*(MultipleOutputs *)nullptr,
32, 4);
32, 4,
ReplayGainConfig());
return audio_output_new(event_loop, ReplayGainConfig(), *param,
*(MixerListener *)nullptr,