player/CrossFade: use std::chrono::duration

This commit is contained in:
Max Kellermann
2018-09-22 19:24:34 +02:00
parent 863722545f
commit 224400074c
8 changed files with 56 additions and 54 deletions

View File

@@ -152,13 +152,13 @@ handle_status(Client &client, gcc_unused Request args, Response &r)
pc.GetMixRampDb(),
state);
if (pc.GetCrossFade() > 0)
if (pc.GetCrossFade() > FloatDuration::zero())
r.Format(COMMAND_STATUS_CROSSFADE ": %lu\n",
std::lround(pc.GetCrossFade()));
std::lround(pc.GetCrossFade().count()));
if (pc.GetMixRampDelay() > 0)
if (pc.GetMixRampDelay() > FloatDuration::zero())
r.Format(COMMAND_STATUS_MIXRAMPDELAY ": %f\n",
pc.GetMixRampDelay());
pc.GetMixRampDelay().count());
song = playlist.GetCurrentPosition();
if (song >= 0) {
@@ -316,8 +316,8 @@ handle_seekcur(Client &client, Request args, gcc_unused Response &r)
CommandResult
handle_crossfade(Client &client, Request args, gcc_unused Response &r)
{
unsigned xfade_time = args.ParseUnsigned(0);
client.GetPlayerControl().SetCrossFade(xfade_time);
FloatDuration duration{args.ParseUnsigned(0)};
client.GetPlayerControl().SetCrossFade(duration);
return CommandResult::OK;
}
@@ -332,7 +332,7 @@ handle_mixrampdb(Client &client, Request args, gcc_unused Response &r)
CommandResult
handle_mixrampdelay(Client &client, Request args, gcc_unused Response &r)
{
float delay_secs = args.ParseFloat(0);
FloatDuration delay_secs{args.ParseFloat(0)};
client.GetPlayerControl().SetMixRampDelay(delay_secs);
return CommandResult::OK;
}