[player] Turn repeat mode off when activating consume mode and vice

versa
This commit is contained in:
chme 2022-05-28 09:42:07 +02:00
parent efd149f2c1
commit 63bede3ee9

View File

@ -2975,10 +2975,14 @@ volume_generic_bh(void *arg, int *retval)
return COMMAND_END;
}
static enum command_state
consume_set(void *arg, int *retval);
static enum command_state
repeat_set(void *arg, int *retval)
{
enum repeat_mode *mode = arg;
union player_arg consume_arg;
if (*mode == repeat)
{
@ -3003,6 +3007,13 @@ repeat_set(void *arg, int *retval)
// Persist
SETTINGS_SETINT(player_settings_category, PLAYER_SETTINGS_MODE_REPEAT, repeat);
if (repeat == REPEAT_ALL || repeat == REPEAT_SONG)
{
// Activating repeat requires repeat consume mode to be off
consume_arg.intval = 0;
consume_set(&consume_arg, retval);
}
*retval = 0;
return COMMAND_END;
}
@ -3046,6 +3057,7 @@ shuffle_set(void *arg, int *retval)
static enum command_state
consume_set(void *arg, int *retval)
{
enum repeat_mode repeat_mode;
union player_arg *cmdarg = arg;
consume = cmdarg->intval;
@ -3053,6 +3065,13 @@ consume_set(void *arg, int *retval)
// Persist
SETTINGS_SETBOOL(player_settings_category, PLAYER_SETTINGS_MODE_CONSUME, consume);
if (consume)
{
// Activating cosume mode requires repeat mode to be off
repeat_mode = REPEAT_OFF;
repeat_set(&repeat_mode, retval);
}
*retval = 0;
return COMMAND_END;
}