filter/ReplayGain: convert pointers to references

This commit is contained in:
Max Kellermann 2016-12-03 12:13:45 +01:00
parent 86e8b8c10d
commit bfb0897b54
4 changed files with 15 additions and 15 deletions

View File

@ -189,26 +189,26 @@ const FilterPlugin replay_gain_filter_plugin = {
}; };
void void
replay_gain_filter_set_mixer(PreparedFilter *_filter, Mixer *mixer, replay_gain_filter_set_mixer(PreparedFilter &_filter, Mixer *mixer,
unsigned base) unsigned base)
{ {
PreparedReplayGainFilter *filter = (PreparedReplayGainFilter *)_filter; auto &filter = (PreparedReplayGainFilter &)_filter;
filter->SetMixer(mixer, base); filter.SetMixer(mixer, base);
} }
void void
replay_gain_filter_set_info(Filter *_filter, const ReplayGainInfo *info) replay_gain_filter_set_info(Filter &_filter, const ReplayGainInfo *info)
{ {
ReplayGainFilter *filter = (ReplayGainFilter *)_filter; auto &filter = (ReplayGainFilter &)_filter;
filter->SetInfo(info); filter.SetInfo(info);
} }
void void
replay_gain_filter_set_mode(Filter *_filter, ReplayGainMode mode) replay_gain_filter_set_mode(Filter &_filter, ReplayGainMode mode)
{ {
ReplayGainFilter *filter = (ReplayGainFilter *)_filter; auto &filter = (ReplayGainFilter &)_filter;
filter->SetMode(mode); filter.SetMode(mode);
} }

View File

@ -35,7 +35,7 @@ class Mixer;
* (including). * (including).
*/ */
void void
replay_gain_filter_set_mixer(PreparedFilter *_filter, Mixer *mixer, replay_gain_filter_set_mixer(PreparedFilter &_filter, Mixer *mixer,
unsigned base); unsigned base);
/** /**
@ -45,9 +45,9 @@ replay_gain_filter_set_mixer(PreparedFilter *_filter, Mixer *mixer,
* gain data is available for the current song * gain data is available for the current song
*/ */
void void
replay_gain_filter_set_info(Filter *filter, const ReplayGainInfo *info); replay_gain_filter_set_info(Filter &filter, const ReplayGainInfo *info);
void void
replay_gain_filter_set_mode(Filter *filter, ReplayGainMode mode); replay_gain_filter_set_mode(Filter &filter, ReplayGainMode mode);
#endif #endif

View File

@ -249,7 +249,7 @@ audio_output_setup(EventLoop &event_loop, AudioOutput &ao,
if (strcmp(replay_gain_handler, "mixer") == 0) { if (strcmp(replay_gain_handler, "mixer") == 0) {
if (ao.mixer != nullptr) if (ao.mixer != nullptr)
replay_gain_filter_set_mixer(ao.prepared_replay_gain_filter, replay_gain_filter_set_mixer(*ao.prepared_replay_gain_filter,
ao.mixer, 100); ao.mixer, 100);
else else
FormatError(output_domain, FormatError(output_domain,

View File

@ -349,11 +349,11 @@ ao_chunk_data(AudioOutput *ao, const MusicChunk *chunk,
assert(data.size % ao->in_audio_format.GetFrameSize() == 0); assert(data.size % ao->in_audio_format.GetFrameSize() == 0);
if (!data.IsEmpty() && replay_gain_filter != nullptr) { if (!data.IsEmpty() && replay_gain_filter != nullptr) {
replay_gain_filter_set_mode(replay_gain_filter, replay_gain_filter_set_mode(*replay_gain_filter,
ao->replay_gain_mode); ao->replay_gain_mode);
if (chunk->replay_gain_serial != *replay_gain_serial_p) { if (chunk->replay_gain_serial != *replay_gain_serial_p) {
replay_gain_filter_set_info(replay_gain_filter, replay_gain_filter_set_info(*replay_gain_filter,
chunk->replay_gain_serial != 0 chunk->replay_gain_serial != 0
? &chunk->replay_gain_info ? &chunk->replay_gain_info
: nullptr); : nullptr);