diff options
author | Max Kellermann <max@duempel.org> | 2013-10-29 00:14:27 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-29 00:14:27 +0100 |
commit | 03747ba93e29d76e664dcc493a21f320117d62d8 (patch) | |
tree | ca18def718b109554df01ca4a65ec7a0c8ba9b4e /src/CrossFade.hxx | |
parent | 095c390df736ebff74a0e2a982ef4a1220dea135 (diff) | |
download | mpd-03747ba93e29d76e664dcc493a21f320117d62d8.tar.gz mpd-03747ba93e29d76e664dcc493a21f320117d62d8.tar.xz mpd-03747ba93e29d76e664dcc493a21f320117d62d8.zip |
PlayerControl: move attributes to struct CrossFadeSettings
Diffstat (limited to 'src/CrossFade.hxx')
-rw-r--r-- | src/CrossFade.hxx | 73 |
1 files changed, 47 insertions, 26 deletions
diff --git a/src/CrossFade.hxx b/src/CrossFade.hxx index d30d06320..3bc1f707a 100644 --- a/src/CrossFade.hxx +++ b/src/CrossFade.hxx @@ -22,33 +22,54 @@ #include "Compiler.h" +#include <cmath> + struct AudioFormat; -struct music_chunk; -/** - * Calculate how many music pipe chunks should be used for crossfading. - * - * @param duration the requested crossfade duration - * @param total_time total_time the duration of the new song - * @param mixramp_db the current mixramp_db setting - * @param mixramp_delay the current mixramp_delay setting - * @param replay_gain_db the ReplayGain adjustment used for this song - * @param replay_gain_prev_db the ReplayGain adjustment used on the last song - * @param mixramp_start the next songs mixramp_start tag - * @param mixramp_prev_end the last songs mixramp_end setting - * @param af the audio format of the new song - * @param old_format the audio format of the current song - * @param max_chunks the maximum number of chunks - * @return the number of chunks for crossfading, or 0 if cross fading - * should be disabled for this song change - */ -gcc_pure -unsigned -cross_fade_calc(float duration, float total_time, - float mixramp_db, float mixramp_delay, - float replay_gain_db, float replay_gain_prev_db, - const char *mixramp_start, const char *mixramp_prev_end, - AudioFormat af, AudioFormat old_format, - unsigned max_chunks); +struct CrossFadeSettings { + /** + * The configured cross fade duration [s]. + */ + float duration; + + float mixramp_db; + + /** + * The configured MixRapm delay [s]. + */ + float mixramp_delay; + + CrossFadeSettings() + :duration(0), + mixramp_db(0), + mixramp_delay(std::nanf("")) + {} + + + /** + * Calculate how many music pipe chunks should be used for crossfading. + * + * @param duration the requested crossfade duration + * @param total_time total_time the duration of the new song + * @param mixramp_db the current mixramp_db setting + * @param mixramp_delay the current mixramp_delay setting + * @param replay_gain_db the ReplayGain adjustment used for this song + * @param replay_gain_prev_db the ReplayGain adjustment used on the last song + * @param mixramp_start the next songs mixramp_start tag + * @param mixramp_prev_end the last songs mixramp_end setting + * @param af the audio format of the new song + * @param old_format the audio format of the current song + * @param max_chunks the maximum number of chunks + * @return the number of chunks for crossfading, or 0 if cross fading + * should be disabled for this song change + */ + gcc_pure + unsigned Calculate(float total_time, + float replay_gain_db, float replay_gain_prev_db, + const char *mixramp_start, + const char *mixramp_prev_end, + AudioFormat af, AudioFormat old_format, + unsigned max_chunks) const; +}; #endif |