Commit 7c567e3c authored by Max Kellermann's avatar Max Kellermann

CrossFade: pass total_time as SignedSongTime instance

parent 58352ea6
......@@ -19,6 +19,7 @@
#include "config.h"
#include "CrossFade.hxx"
#include "Chrono.hxx"
#include "MusicChunk.hxx"
#include "AudioFormat.hxx"
#include "util/NumberParser.hxx"
......@@ -85,7 +86,7 @@ mixramp_interpolate(const char *ramp_list, float required_db)
}
unsigned
CrossFadeSettings::Calculate(float total_time,
CrossFadeSettings::Calculate(SignedSongTime total_time,
float replay_gain_db, float replay_gain_prev_db,
const char *mixramp_start, const char *mixramp_prev_end,
const AudioFormat af,
......@@ -95,7 +96,8 @@ CrossFadeSettings::Calculate(float total_time,
unsigned int chunks = 0;
float chunks_f;
if (duration < 0 || duration >= total_time ||
if (total_time.IsNegative() ||
duration < 0 || duration >= total_time.ToDoubleS() ||
/* we can't crossfade when the audio formats are different */
af != old_format)
return 0;
......
......@@ -23,6 +23,7 @@
#include "Compiler.h"
struct AudioFormat;
class SignedSongTime;
struct CrossFadeSettings {
/**
......@@ -60,7 +61,7 @@ struct CrossFadeSettings {
* should be disabled for this song change
*/
gcc_pure
unsigned Calculate(float total_time,
unsigned Calculate(SignedSongTime total_time,
float replay_gain_db, float replay_gain_prev_db,
const char *mixramp_start,
const char *mixramp_prev_end,
......
......@@ -1001,7 +1001,7 @@ Player::Run()
calculate how many chunks will be required
for it */
cross_fade_chunks =
pc.cross_fade.Calculate(dc.total_time.ToDoubleS(),
pc.cross_fade.Calculate(dc.total_time,
dc.replay_gain_db,
dc.replay_gain_prev_db,
dc.GetMixRampStart(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment