From 63bede3ee9e68746ce1ccd0b94fcc5c356df3c81 Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 28 May 2022 09:42:07 +0200 Subject: [PATCH] [player] Turn repeat mode off when activating consume mode and vice versa --- src/player.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/player.c b/src/player.c index f6c77df1..c959574d 100644 --- a/src/player.c +++ b/src/player.c @@ -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; }