1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 Jonathan Gordon
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
22 struct plugin_api
* api
= 0;
32 int audio_status
= api
->audio_status();
33 if (!audio_status
&& api
->global_status
->resume_index
!= -1)
35 if (api
->playlist_resume() != -1)
37 api
->playlist_start(api
->global_status
->resume_index
,
38 api
->global_status
->resume_offset
);
41 else if (audio_status
& AUDIO_STATUS_PAUSE
)
60 static bool volume(void)
62 const struct settings_list
* vol
=
63 api
->find_setting(&api
->global_settings
->volume
, NULL
);
64 return api
->option_screen((struct settings_list
*)vol
, false, "Volume");
67 static bool shuffle(void)
69 const struct settings_list
* shuffle
=
70 api
->find_setting(&api
->global_settings
->playlist_shuffle
, NULL
);
71 return api
->option_screen((struct settings_list
*)shuffle
, false, "Shuffle");
74 static bool repeat_mode(void)
76 const struct settings_list
* repeat
=
77 api
->find_setting(&api
->global_settings
->repeat_mode
, NULL
);
78 int old_repeat
= api
->global_settings
->repeat_mode
;
80 api
->option_screen((struct settings_list
*)repeat
, false, "Repeat");
82 if (old_repeat
!= api
->global_settings
->repeat_mode
&&
83 (api
->audio_status() & AUDIO_STATUS_PLAY
))
84 api
->audio_flush_and_reload_tracks();
88 MENUITEM_FUNCTION(prevtrack_item
, 0, "Previous Track",
89 prevtrack
, NULL
, NULL
, Icon_NOICON
);
90 MENUITEM_FUNCTION(playpause_item
, 0, "Pause / Play",
91 play
, NULL
, NULL
, Icon_NOICON
);
92 MENUITEM_FUNCTION(stop_item
, 0, "Stop Playback",
93 stop
, NULL
, NULL
, Icon_NOICON
);
94 MENUITEM_FUNCTION(nexttrack_item
, 0, "Next Track",
95 nexttrack
, NULL
, NULL
, Icon_NOICON
);
96 MENUITEM_FUNCTION(volume_item
, 0, "Change Volume",
97 volume
, NULL
, NULL
, Icon_NOICON
);
98 MENUITEM_FUNCTION(shuffle_item
, 0, "Enable/Disable Shuffle",
99 shuffle
, NULL
, NULL
, Icon_NOICON
);
100 MENUITEM_FUNCTION(repeat_mode_item
, 0, "Change Repeat Mode",
101 repeat_mode
, NULL
, NULL
, Icon_NOICON
);
102 MAKE_MENU(playback_control_menu
, "Playback Control", NULL
, Icon_NOICON
,
103 &prevtrack_item
, &playpause_item
, &stop_item
, &nexttrack_item
,
104 &volume_item
, &shuffle_item
, &repeat_mode_item
);
106 void playback_control_init(struct plugin_api
* newapi
)
111 bool playback_control(struct plugin_api
* newapi
)
114 return api
->do_menu(&playback_control_menu
, NULL
, NULL
, false) == MENU_ATTACHED_USB
;