From 17c6db6c33b9b14a8627b3f9b3da8580a5f932a2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 2 Oct 2013 12:22:12 +0200 Subject: replay_gain_*.h: rename to *.hxx --- Makefile.am | 6 +-- src/DecoderAPI.cxx | 2 +- src/DecoderAPI.hxx | 2 +- src/DecoderInternal.hxx | 2 +- src/Main.cxx | 2 +- src/MusicChunk.hxx | 2 +- src/OutputAll.hxx | 2 +- src/OutputControl.hxx | 2 +- src/PlayerCommands.cxx | 8 +--- src/ReplayGainConfig.cxx | 2 +- src/ReplayGainConfig.hxx | 53 +++++++++++++++++++++ src/ReplayGainInfo.cxx | 2 +- src/ReplayGainInfo.hxx | 73 ++++++++++++++++++++++++++++ src/decoder/FlacMetadata.cxx | 2 +- src/decoder/VorbisComments.cxx | 3 +- src/filter/ReplayGainFilterPlugin.cxx | 4 +- src/filter/ReplayGainFilterPlugin.hxx | 2 +- src/replay_gain_config.h | 63 ------------------------ src/replay_gain_info.h | 90 ----------------------------------- src/tag/ApeReplayGain.cxx | 2 +- src/tag/TagRva2.cxx | 2 +- test/FakeReplayGainConfig.cxx | 2 +- test/dump_rva2.cxx | 2 +- 23 files changed, 148 insertions(+), 182 deletions(-) create mode 100644 src/ReplayGainConfig.hxx create mode 100644 src/ReplayGainInfo.hxx delete mode 100644 src/replay_gain_config.h delete mode 100644 src/replay_gain_info.h diff --git a/Makefile.am b/Makefile.am index e3cfd9d89..eca519b01 100644 --- a/Makefile.am +++ b/Makefile.am @@ -62,8 +62,6 @@ mpd_headers = \ src/open.h \ src/Playlist.hxx \ src/poison.h \ - src/replay_gain_config.h \ - src/replay_gain_info.h \ src/TimePrint.cxx src/TimePrint.hxx \ src/Timer.hxx @@ -192,8 +190,8 @@ src_mpd_SOURCES = \ src/Queue.cxx src/Queue.hxx \ src/QueuePrint.cxx src/QueuePrint.hxx \ src/QueueSave.cxx src/QueueSave.hxx \ - src/ReplayGainConfig.cxx \ - src/ReplayGainInfo.cxx \ + src/ReplayGainConfig.cxx src/ReplayGainConfig.hxx \ + src/ReplayGainInfo.cxx src/ReplayGainInfo.hxx \ src/SignalHandlers.cxx src/SignalHandlers.hxx \ src/Song.cxx src/Song.hxx \ src/SongUpdate.cxx \ diff --git a/src/DecoderAPI.cxx b/src/DecoderAPI.cxx index 3f38a0b5e..f7716a584 100644 --- a/src/DecoderAPI.cxx +++ b/src/DecoderAPI.cxx @@ -21,7 +21,7 @@ #include "DecoderAPI.hxx" #include "DecoderError.hxx" #include "AudioConfig.hxx" -#include "replay_gain_config.h" +#include "ReplayGainConfig.hxx" #include "MusicChunk.hxx" #include "MusicBuffer.hxx" #include "MusicPipe.hxx" diff --git a/src/DecoderAPI.hxx b/src/DecoderAPI.hxx index f96aa596a..8bd38545f 100644 --- a/src/DecoderAPI.hxx +++ b/src/DecoderAPI.hxx @@ -30,7 +30,7 @@ #include "check.h" #include "DecoderCommand.hxx" #include "DecoderPlugin.hxx" -#include "replay_gain_info.h" +#include "ReplayGainInfo.hxx" #include "tag/Tag.hxx" #include "AudioFormat.hxx" #include "ConfigData.hxx" diff --git a/src/DecoderInternal.hxx b/src/DecoderInternal.hxx index 3715ef427..5e0570c62 100644 --- a/src/DecoderInternal.hxx +++ b/src/DecoderInternal.hxx @@ -22,7 +22,7 @@ #include "DecoderCommand.hxx" #include "pcm/PcmConvert.hxx" -#include "replay_gain_info.h" +#include "ReplayGainInfo.hxx" struct input_stream; struct Tag; diff --git a/src/Main.cxx b/src/Main.cxx index 6857970cf..8509abcfb 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -39,7 +39,7 @@ #include "Volume.hxx" #include "OutputAll.hxx" #include "tag/TagConfig.hxx" -#include "replay_gain_config.h" +#include "ReplayGainConfig.hxx" #include "Idle.hxx" #include "SignalHandlers.hxx" #include "Log.hxx" diff --git a/src/MusicChunk.hxx b/src/MusicChunk.hxx index a35684a1d..3365b0bea 100644 --- a/src/MusicChunk.hxx +++ b/src/MusicChunk.hxx @@ -20,7 +20,7 @@ #ifndef MPD_MUSIC_CHUNK_HXX #define MPD_MUSIC_CHUNK_HXX -#include "replay_gain_info.h" +#include "ReplayGainInfo.hxx" #ifndef NDEBUG #include "AudioFormat.hxx" diff --git a/src/OutputAll.hxx b/src/OutputAll.hxx index a01109e56..7053c0580 100644 --- a/src/OutputAll.hxx +++ b/src/OutputAll.hxx @@ -26,7 +26,7 @@ #ifndef OUTPUT_ALL_H #define OUTPUT_ALL_H -#include "replay_gain_info.h" +#include "ReplayGainInfo.hxx" #include "gcc.h" struct AudioFormat; diff --git a/src/OutputControl.hxx b/src/OutputControl.hxx index 165afb28c..25fbec1e7 100644 --- a/src/OutputControl.hxx +++ b/src/OutputControl.hxx @@ -20,7 +20,7 @@ #ifndef MPD_OUTPUT_CONTROL_HXX #define MPD_OUTPUT_CONTROL_HXX -#include "replay_gain_info.h" +#include "ReplayGainInfo.hxx" #include diff --git a/src/PlayerCommands.cxx b/src/PlayerCommands.cxx index b9f6c7446..1a2580ee3 100644 --- a/src/PlayerCommands.cxx +++ b/src/PlayerCommands.cxx @@ -29,14 +29,8 @@ #include "Partition.hxx" #include "protocol/Result.hxx" #include "protocol/ArgParser.hxx" - -extern "C" { #include "AudioFormat.hxx" -} - -#include "replay_gain_config.h" - -#include +#include "ReplayGainConfig.hxx" #define COMMAND_STATUS_STATE "state" #define COMMAND_STATUS_REPEAT "repeat" diff --git a/src/ReplayGainConfig.cxx b/src/ReplayGainConfig.cxx index 3442628b3..9665c8fcf 100644 --- a/src/ReplayGainConfig.cxx +++ b/src/ReplayGainConfig.cxx @@ -18,7 +18,7 @@ */ #include "config.h" -#include "replay_gain_config.h" +#include "ReplayGainConfig.hxx" #include "Idle.hxx" #include "ConfigData.hxx" #include "ConfigGlobal.hxx" diff --git a/src/ReplayGainConfig.hxx b/src/ReplayGainConfig.hxx new file mode 100644 index 000000000..5b81d1cc1 --- /dev/null +++ b/src/ReplayGainConfig.hxx @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2003-2013 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_CONFIG_HXX +#define MPD_REPLAY_GAIN_CONFIG_HXX + +#include "check.h" +#include "ReplayGainInfo.hxx" + +extern enum replay_gain_mode replay_gain_mode; +extern float replay_gain_preamp; +extern float replay_gain_missing_preamp; +extern bool replay_gain_limit; + +void replay_gain_global_init(void); + +/** + * Returns the current replay gain mode as a machine-readable string. + */ +const char * +replay_gain_get_mode_string(void); + +/** + * Sets the replay gain mode, parsed from a string. + * + * @return true on success, false if the string could not be parsed + */ +bool +replay_gain_set_mode_string(const char *p); + +/** + * Returns the "real" mode according to the "auto" setting" + */ +enum replay_gain_mode +replay_gain_get_real_mode(bool random_mode); + +#endif diff --git a/src/ReplayGainInfo.cxx b/src/ReplayGainInfo.cxx index b9d1b82c6..ac1c13822 100644 --- a/src/ReplayGainInfo.cxx +++ b/src/ReplayGainInfo.cxx @@ -18,7 +18,7 @@ */ #include "config.h" -#include "replay_gain_info.h" +#include "ReplayGainInfo.hxx" float replay_gain_tuple_scale(const struct replay_gain_tuple *tuple, float preamp, float missing_preamp, bool peak_limit) diff --git a/src/ReplayGainInfo.hxx b/src/ReplayGainInfo.hxx new file mode 100644 index 000000000..bfc5f68a7 --- /dev/null +++ b/src/ReplayGainInfo.hxx @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2003-2013 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_INFO_HXX +#define MPD_REPLAY_GAIN_INFO_HXX + +#include "check.h" + +#include + +enum replay_gain_mode { + REPLAY_GAIN_AUTO = -2, + REPLAY_GAIN_OFF, + REPLAY_GAIN_ALBUM, + REPLAY_GAIN_TRACK, +}; + +struct replay_gain_tuple { + float gain; + float peak; +}; + +struct replay_gain_info { + struct replay_gain_tuple tuples[2]; +}; + +static inline void +replay_gain_tuple_init(struct replay_gain_tuple *tuple) +{ + tuple->gain = INFINITY; + tuple->peak = 0.0; +} + +static inline void +replay_gain_info_init(struct replay_gain_info *info) +{ + replay_gain_tuple_init(&info->tuples[REPLAY_GAIN_ALBUM]); + replay_gain_tuple_init(&info->tuples[REPLAY_GAIN_TRACK]); +} + +static inline bool +replay_gain_tuple_defined(const struct replay_gain_tuple *tuple) +{ + return !std::isinf(tuple->gain); +} + +float +replay_gain_tuple_scale(const struct replay_gain_tuple *tuple, float preamp, float missing_preamp, bool peak_limit); + +/** + * Attempt to auto-complete missing data. In particular, if album + * information is missing, track gain is used. + */ +void +replay_gain_info_complete(struct replay_gain_info *info); + +#endif diff --git a/src/decoder/FlacMetadata.cxx b/src/decoder/FlacMetadata.cxx index 49e4851e8..078d0c081 100644 --- a/src/decoder/FlacMetadata.cxx +++ b/src/decoder/FlacMetadata.cxx @@ -24,7 +24,7 @@ #include "tag/TagHandler.hxx" #include "tag/TagTable.hxx" #include "tag/TagBuilder.hxx" -#include "replay_gain_info.h" +#include "ReplayGainInfo.hxx" #include diff --git a/src/decoder/VorbisComments.cxx b/src/decoder/VorbisComments.cxx index c8eeb09cd..402ee7c2b 100644 --- a/src/decoder/VorbisComments.cxx +++ b/src/decoder/VorbisComments.cxx @@ -24,9 +24,10 @@ #include "tag/TagTable.hxx" #include "tag/TagHandler.hxx" #include "tag/TagBuilder.hxx" -#include "replay_gain_info.h" +#include "ReplayGainInfo.hxx" #include + #include #include #include diff --git a/src/filter/ReplayGainFilterPlugin.cxx b/src/filter/ReplayGainFilterPlugin.cxx index d22a5232e..5ac9840b1 100644 --- a/src/filter/ReplayGainFilterPlugin.cxx +++ b/src/filter/ReplayGainFilterPlugin.cxx @@ -23,8 +23,8 @@ #include "FilterInternal.hxx" #include "FilterRegistry.hxx" #include "AudioFormat.hxx" -#include "replay_gain_info.h" -#include "replay_gain_config.h" +#include "ReplayGainInfo.hxx" +#include "ReplayGainConfig.hxx" #include "MixerControl.hxx" #include "pcm/PcmVolume.hxx" #include "pcm/PcmBuffer.hxx" diff --git a/src/filter/ReplayGainFilterPlugin.hxx b/src/filter/ReplayGainFilterPlugin.hxx index 06b778f8f..89cbe6c96 100644 --- a/src/filter/ReplayGainFilterPlugin.hxx +++ b/src/filter/ReplayGainFilterPlugin.hxx @@ -20,7 +20,7 @@ #ifndef MPD_REPLAY_GAIN_FILTER_PLUGIN_HXX #define MPD_REPLAY_GAIN_FILTER_PLUGIN_HXX -#include "replay_gain_info.h" +#include "ReplayGainInfo.hxx" class Filter; class Mixer; diff --git a/src/replay_gain_config.h b/src/replay_gain_config.h deleted file mode 100644 index 4b59334c0..000000000 --- a/src/replay_gain_config.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2003-2011 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_CONFIG_H -#define MPD_REPLAY_GAIN_CONFIG_H - -#include "check.h" -#include "replay_gain_info.h" - -#include - -extern enum replay_gain_mode replay_gain_mode; -extern float replay_gain_preamp; -extern float replay_gain_missing_preamp; -extern bool replay_gain_limit; - -#ifdef __cplusplus -extern "C" { -#endif - -void replay_gain_global_init(void); - -/** - * Returns the current replay gain mode as a machine-readable string. - */ -const char * -replay_gain_get_mode_string(void); - -/** - * Sets the replay gain mode, parsed from a string. - * - * @return true on success, false if the string could not be parsed - */ -bool -replay_gain_set_mode_string(const char *p); - -/** - * Returns the "real" mode according to the "auto" setting" - */ -enum replay_gain_mode -replay_gain_get_real_mode(bool random_mode); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/replay_gain_info.h b/src/replay_gain_info.h deleted file mode 100644 index b06dc6cf0..000000000 --- a/src/replay_gain_info.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2003-2011 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_INFO_H -#define MPD_REPLAY_GAIN_INFO_H - -#include "check.h" - -#ifdef __cplusplus -#include -#else -#include -#include -#endif - -enum replay_gain_mode { - REPLAY_GAIN_AUTO = -2, - REPLAY_GAIN_OFF, - REPLAY_GAIN_ALBUM, - REPLAY_GAIN_TRACK, -}; - -struct replay_gain_tuple { - float gain; - float peak; -}; - -struct replay_gain_info { - struct replay_gain_tuple tuples[2]; -}; - -static inline void -replay_gain_tuple_init(struct replay_gain_tuple *tuple) -{ - tuple->gain = INFINITY; - tuple->peak = 0.0; -} - -static inline void -replay_gain_info_init(struct replay_gain_info *info) -{ - replay_gain_tuple_init(&info->tuples[REPLAY_GAIN_ALBUM]); - replay_gain_tuple_init(&info->tuples[REPLAY_GAIN_TRACK]); -} - -static inline bool -replay_gain_tuple_defined(const struct replay_gain_tuple *tuple) -{ -#ifdef __cplusplus - return !std::isinf(tuple->gain); -#else - return !isinf(tuple->gain); -#endif -} - -#ifdef __cplusplus -extern "C" { -#endif - -float -replay_gain_tuple_scale(const struct replay_gain_tuple *tuple, float preamp, float missing_preamp, bool peak_limit); - -/** - * Attempt to auto-complete missing data. In particular, if album - * information is missing, track gain is used. - */ -void -replay_gain_info_complete(struct replay_gain_info *info); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/tag/ApeReplayGain.cxx b/src/tag/ApeReplayGain.cxx index 0135d1b61..817eca349 100644 --- a/src/tag/ApeReplayGain.cxx +++ b/src/tag/ApeReplayGain.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "ApeReplayGain.hxx" #include "ApeLoader.hxx" -#include "replay_gain_info.h" +#include "ReplayGainInfo.hxx" #include diff --git a/src/tag/TagRva2.cxx b/src/tag/TagRva2.cxx index f41119c35..071e3a443 100644 --- a/src/tag/TagRva2.cxx +++ b/src/tag/TagRva2.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "TagRva2.hxx" -#include "replay_gain_info.h" +#include "ReplayGainInfo.hxx" #include #include diff --git a/test/FakeReplayGainConfig.cxx b/test/FakeReplayGainConfig.cxx index 9c2431bf2..3305b79a3 100644 --- a/test/FakeReplayGainConfig.cxx +++ b/test/FakeReplayGainConfig.cxx @@ -18,7 +18,7 @@ */ #include "config.h" -#include "replay_gain_config.h" +#include "ReplayGainConfig.hxx" float replay_gain_preamp = 1.0; float replay_gain_missing_preamp = 1.0; diff --git a/test/dump_rva2.cxx b/test/dump_rva2.cxx index bbc6f471a..3206f970a 100644 --- a/test/dump_rva2.cxx +++ b/test/dump_rva2.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "tag/TagId3.hxx" #include "tag/TagRva2.hxx" -#include "replay_gain_info.h" +#include "ReplayGainInfo.hxx" #include "ConfigGlobal.hxx" #include "util/Error.hxx" -- cgit v1.2.3