2007-02-12 14:22:35 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2007-02-13 00:32:17 +00:00
|
|
|
* $Id$
|
2007-02-12 14:22:35 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Jonathan Gordon
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2007-02-12 14:22:35 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include "config.h"
|
|
|
|
#include "lang.h"
|
|
|
|
#include "action.h"
|
|
|
|
#include "splash.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "sound_menu.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "playlist.h"
|
|
|
|
#include "audio.h"
|
2008-07-14 20:39:30 +00:00
|
|
|
#include "cuesheet.h"
|
2012-04-30 20:27:01 +00:00
|
|
|
#include "misc.h"
|
2008-07-14 20:39:30 +00:00
|
|
|
#include "playback.h"
|
2013-05-23 17:58:51 +00:00
|
|
|
#include "pcm_sampr.h"
|
|
|
|
#ifdef HAVE_PLAY_FREQ
|
|
|
|
#include "talk.h"
|
|
|
|
#endif
|
2007-02-12 14:22:35 +00:00
|
|
|
|
2020-07-17 04:01:32 +00:00
|
|
|
#if defined(HAVE_CROSSFADE)
|
2020-07-19 17:42:04 +00:00
|
|
|
static int setcrossfadeonexit_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2007-02-12 14:22:35 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2007-02-12 14:22:35 +00:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
|
|
|
audio_set_crossfade(global_settings.crossfade);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
2020-07-17 04:01:32 +00:00
|
|
|
#endif /* HAVE_CROSSFADE */
|
2007-02-12 14:22:35 +00:00
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
/* PLAYBACK MENU */
|
2020-07-19 17:42:04 +00:00
|
|
|
static int playback_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list);
|
2013-07-12 16:03:20 +00:00
|
|
|
|
2007-02-12 14:22:35 +00:00
|
|
|
MENUITEM_SETTING(shuffle_item, &global_settings.playlist_shuffle, playback_callback);
|
|
|
|
MENUITEM_SETTING(repeat_mode, &global_settings.repeat_mode, playback_callback);
|
|
|
|
MENUITEM_SETTING(play_selected, &global_settings.play_selected, NULL);
|
|
|
|
|
|
|
|
MENUITEM_SETTING(ff_rewind_accel, &global_settings.ff_rewind_accel, NULL);
|
|
|
|
MENUITEM_SETTING(ff_rewind_min_step, &global_settings.ff_rewind_min_step, NULL);
|
2007-03-03 13:52:14 +00:00
|
|
|
MAKE_MENU(ff_rewind_settings_menu, ID2P(LANG_WIND_MENU), 0, Icon_NOICON,
|
2007-02-12 14:22:35 +00:00
|
|
|
&ff_rewind_min_step, &ff_rewind_accel);
|
2008-10-07 19:37:33 +00:00
|
|
|
#ifdef HAVE_DISK_STORAGE
|
2020-07-19 17:42:04 +00:00
|
|
|
static int buffermargin_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2007-02-12 14:22:35 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2007-02-12 14:22:35 +00:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
|
|
|
audio_set_buffer_margin(global_settings.buffer_margin);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
MENUITEM_SETTING(buffer_margin, &global_settings.buffer_margin,
|
|
|
|
buffermargin_callback);
|
2008-10-07 19:37:33 +00:00
|
|
|
#endif /*HAVE_DISK_STORAGE */
|
2007-02-12 14:22:35 +00:00
|
|
|
MENUITEM_SETTING(fade_on_stop, &global_settings.fade_on_stop, NULL);
|
2021-10-31 06:56:46 +00:00
|
|
|
MENUITEM_SETTING(single_mode, &global_settings.single_mode, NULL);
|
2007-02-12 14:22:35 +00:00
|
|
|
MENUITEM_SETTING(party_mode, &global_settings.party_mode, NULL);
|
|
|
|
|
2009-11-10 03:46:08 +00:00
|
|
|
#ifdef HAVE_CROSSFADE
|
2007-02-12 14:22:35 +00:00
|
|
|
/* crossfade submenu */
|
|
|
|
MENUITEM_SETTING(crossfade, &global_settings.crossfade, setcrossfadeonexit_callback);
|
|
|
|
MENUITEM_SETTING(crossfade_fade_in_delay,
|
2009-11-10 03:46:08 +00:00
|
|
|
&global_settings.crossfade_fade_in_delay, NULL);
|
2007-02-12 14:22:35 +00:00
|
|
|
MENUITEM_SETTING(crossfade_fade_in_duration,
|
2009-11-10 03:46:08 +00:00
|
|
|
&global_settings.crossfade_fade_in_duration, NULL);
|
2007-02-12 14:22:35 +00:00
|
|
|
MENUITEM_SETTING(crossfade_fade_out_delay,
|
|
|
|
&global_settings.crossfade_fade_out_delay, setcrossfadeonexit_callback);
|
|
|
|
MENUITEM_SETTING(crossfade_fade_out_duration,
|
|
|
|
&global_settings.crossfade_fade_out_duration, setcrossfadeonexit_callback);
|
|
|
|
MENUITEM_SETTING(crossfade_fade_out_mixmode,
|
|
|
|
&global_settings.crossfade_fade_out_mixmode,NULL);
|
2007-03-03 13:52:14 +00:00
|
|
|
MAKE_MENU(crossfade_settings_menu,ID2P(LANG_CROSSFADE),0, Icon_NOICON,
|
2007-02-12 14:22:35 +00:00
|
|
|
&crossfade, &crossfade_fade_in_delay, &crossfade_fade_in_duration,
|
|
|
|
&crossfade_fade_out_delay, &crossfade_fade_out_duration,
|
|
|
|
&crossfade_fade_out_mixmode);
|
2009-08-11 01:09:05 +00:00
|
|
|
#endif
|
2007-02-12 14:22:35 +00:00
|
|
|
|
|
|
|
/* replay gain submenu */
|
|
|
|
|
2020-07-19 17:42:04 +00:00
|
|
|
static int replaygain_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2007-02-12 14:22:35 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2007-02-12 14:22:35 +00:00
|
|
|
switch (action)
|
|
|
|
{
|
2013-07-12 16:03:20 +00:00
|
|
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
2012-04-30 20:27:01 +00:00
|
|
|
replaygain_update();
|
2007-02-12 14:22:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
2012-04-30 20:27:01 +00:00
|
|
|
MENUITEM_SETTING(replaygain_noclip,
|
|
|
|
&global_settings.replaygain_settings.noclip,
|
|
|
|
replaygain_callback);
|
|
|
|
MENUITEM_SETTING(replaygain_type,
|
|
|
|
&global_settings.replaygain_settings.type,
|
|
|
|
replaygain_callback);
|
|
|
|
MENUITEM_SETTING(replaygain_preamp,
|
|
|
|
&global_settings.replaygain_settings.preamp,
|
|
|
|
replaygain_callback);
|
2007-03-03 13:52:14 +00:00
|
|
|
MAKE_MENU(replaygain_settings_menu,ID2P(LANG_REPLAYGAIN),0, Icon_NOICON,
|
2009-06-20 21:13:24 +00:00
|
|
|
&replaygain_type, &replaygain_noclip, &replaygain_preamp);
|
2013-07-12 16:03:20 +00:00
|
|
|
|
2007-02-12 14:22:35 +00:00
|
|
|
MENUITEM_SETTING(beep, &global_settings.beep ,NULL);
|
|
|
|
|
|
|
|
#ifdef HAVE_SPDIF_POWER
|
|
|
|
MENUITEM_SETTING(spdif_enable, &global_settings.spdif_enable, NULL);
|
|
|
|
#endif
|
|
|
|
MENUITEM_SETTING(next_folder, &global_settings.next_folder, NULL);
|
2012-03-19 09:56:38 +00:00
|
|
|
MENUITEM_SETTING(constrain_next_folder,
|
|
|
|
&global_settings.constrain_next_folder, NULL);
|
2007-02-14 14:40:24 +00:00
|
|
|
|
2020-07-19 17:42:04 +00:00
|
|
|
static int cuesheet_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2007-02-14 14:40:24 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2007-02-14 14:40:24 +00:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
2011-04-27 03:08:23 +00:00
|
|
|
audio_set_cuesheet(global_settings.cuesheet);
|
2007-02-14 14:40:24 +00:00
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
MENUITEM_SETTING(cuesheet, &global_settings.cuesheet, cuesheet_callback);
|
|
|
|
|
2007-02-12 14:22:35 +00:00
|
|
|
#ifdef HAVE_HEADPHONE_DETECTION
|
|
|
|
MENUITEM_SETTING(unplug_mode, &global_settings.unplug_mode, NULL);
|
|
|
|
MENUITEM_SETTING(unplug_autoresume, &global_settings.unplug_autoresume, NULL);
|
2007-08-05 19:19:39 +00:00
|
|
|
MAKE_MENU(unplug_menu, ID2P(LANG_HEADPHONE_UNPLUG), 0, Icon_NOICON,
|
2011-05-13 22:28:47 +00:00
|
|
|
&unplug_mode, &unplug_autoresume);
|
2007-02-12 14:22:35 +00:00
|
|
|
#endif
|
|
|
|
|
2008-07-14 20:39:30 +00:00
|
|
|
MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL);
|
2009-03-27 13:53:29 +00:00
|
|
|
MENUITEM_SETTING(prevent_skip, &global_settings.prevent_skip, NULL);
|
2022-11-05 18:51:02 +00:00
|
|
|
MENUITEM_SETTING(rewind_across_tracks, &global_settings.rewind_across_tracks, NULL);
|
2010-04-24 14:10:28 +00:00
|
|
|
MENUITEM_SETTING(resume_rewind, &global_settings.resume_rewind, NULL);
|
2011-05-13 22:28:47 +00:00
|
|
|
MENUITEM_SETTING(pause_rewind, &global_settings.pause_rewind, NULL);
|
2013-05-23 17:58:51 +00:00
|
|
|
#ifdef HAVE_PLAY_FREQ
|
|
|
|
MENUITEM_SETTING(play_frequency, &global_settings.play_frequency,
|
|
|
|
playback_callback);
|
|
|
|
#endif
|
2021-11-19 04:11:13 +00:00
|
|
|
#ifdef HAVE_ALBUMART
|
|
|
|
static int albumart_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
|
|
|
{
|
|
|
|
(void)this_item;
|
|
|
|
(void)this_list;
|
|
|
|
static int initial_aa_setting;
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_ENTER_MENUITEM:
|
|
|
|
initial_aa_setting = global_settings.album_art;
|
|
|
|
break;
|
|
|
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
|
|
|
if (initial_aa_setting != global_settings.album_art)
|
|
|
|
set_albumart_mode(global_settings.album_art);
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
MENUITEM_SETTING(album_art, &global_settings.album_art,
|
|
|
|
albumart_callback);
|
|
|
|
#endif
|
2008-05-04 13:47:58 +00:00
|
|
|
|
2008-05-22 08:02:48 +00:00
|
|
|
MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
|
2007-03-03 13:52:14 +00:00
|
|
|
Icon_Playback_menu,
|
2007-03-01 11:14:46 +00:00
|
|
|
&shuffle_item, &repeat_mode, &play_selected,
|
2007-08-01 08:50:44 +00:00
|
|
|
&ff_rewind_settings_menu,
|
2013-07-12 16:03:20 +00:00
|
|
|
#ifdef HAVE_DISK_STORAGE
|
2007-08-01 08:50:44 +00:00
|
|
|
&buffer_margin,
|
|
|
|
#endif
|
2021-10-31 06:56:46 +00:00
|
|
|
&fade_on_stop, &single_mode, &party_mode,
|
2013-07-12 16:03:20 +00:00
|
|
|
|
2020-07-17 04:01:32 +00:00
|
|
|
#if defined(HAVE_CROSSFADE)
|
2013-07-12 16:03:20 +00:00
|
|
|
&crossfade_settings_menu,
|
2009-08-11 02:18:22 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
&replaygain_settings_menu, &beep,
|
2007-02-12 14:22:35 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_SPDIF_POWER
|
|
|
|
&spdif_enable,
|
|
|
|
#endif
|
2022-03-25 13:33:10 +00:00
|
|
|
&next_folder, &constrain_next_folder, &cuesheet
|
2007-02-12 14:22:35 +00:00
|
|
|
#ifdef HAVE_HEADPHONE_DETECTION
|
|
|
|
,&unplug_menu
|
|
|
|
#endif
|
2013-05-23 17:58:51 +00:00
|
|
|
,&skip_length, &prevent_skip
|
2022-11-05 18:51:02 +00:00
|
|
|
,&rewind_across_tracks
|
2010-04-24 14:10:28 +00:00
|
|
|
|
2013-05-23 17:58:51 +00:00
|
|
|
,&resume_rewind
|
|
|
|
,&pause_rewind
|
|
|
|
#ifdef HAVE_PLAY_FREQ
|
|
|
|
,&play_frequency
|
2021-11-19 04:11:13 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_ALBUMART
|
|
|
|
,&album_art
|
2010-04-24 14:10:28 +00:00
|
|
|
#endif
|
2007-02-12 14:22:35 +00:00
|
|
|
);
|
2013-07-12 16:03:20 +00:00
|
|
|
|
2020-07-19 17:42:04 +00:00
|
|
|
static int playback_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2007-02-12 14:22:35 +00:00
|
|
|
{
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2007-02-12 14:22:35 +00:00
|
|
|
static bool old_shuffle = false;
|
2011-10-29 20:41:20 +00:00
|
|
|
static int old_repeat = 0;
|
2007-02-12 14:22:35 +00:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_ENTER_MENUITEM:
|
|
|
|
if (this_item == &shuffle_item)
|
2011-10-29 20:41:20 +00:00
|
|
|
{
|
2007-02-12 14:22:35 +00:00
|
|
|
old_shuffle = global_settings.playlist_shuffle;
|
2011-10-29 20:41:20 +00:00
|
|
|
}
|
|
|
|
else if (this_item == &repeat_mode)
|
|
|
|
{
|
|
|
|
old_repeat = global_settings.repeat_mode;
|
|
|
|
}
|
2007-02-12 14:22:35 +00:00
|
|
|
break;
|
2011-10-29 20:41:20 +00:00
|
|
|
|
2007-02-12 14:22:35 +00:00
|
|
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
2013-05-23 17:58:51 +00:00
|
|
|
/* Playing or not */
|
|
|
|
#ifdef HAVE_PLAY_FREQ
|
|
|
|
if (this_item == &play_frequency)
|
|
|
|
{
|
2017-11-24 12:55:56 +00:00
|
|
|
audio_set_playback_frequency(global_settings.play_frequency);
|
2013-05-23 17:58:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif /* HAVE_PLAY_FREQ */
|
|
|
|
|
2011-10-29 20:41:20 +00:00
|
|
|
if (!(audio_status() & AUDIO_STATUS_PLAY))
|
|
|
|
break;
|
|
|
|
|
2013-05-23 17:58:51 +00:00
|
|
|
/* Playing only */
|
2011-10-29 20:41:20 +00:00
|
|
|
if (this_item == &shuffle_item)
|
2007-02-12 14:22:35 +00:00
|
|
|
{
|
2011-10-29 20:41:20 +00:00
|
|
|
if (old_shuffle == global_settings.playlist_shuffle)
|
|
|
|
break;
|
|
|
|
|
2012-04-30 20:27:01 +00:00
|
|
|
replaygain_update();
|
|
|
|
|
2007-02-12 14:22:35 +00:00
|
|
|
if (global_settings.playlist_shuffle)
|
|
|
|
{
|
|
|
|
playlist_randomise(NULL, current_tick, true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
playlist_sort(NULL, true);
|
|
|
|
}
|
|
|
|
}
|
2011-10-29 20:41:20 +00:00
|
|
|
else if (this_item == &repeat_mode)
|
|
|
|
{
|
|
|
|
if (old_repeat == global_settings.repeat_mode)
|
|
|
|
break;
|
|
|
|
|
|
|
|
audio_flush_and_reload_tracks();
|
|
|
|
}
|
|
|
|
|
2007-02-12 14:22:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
/* PLAYBACK MENU */
|
|
|
|
/***********************************/
|