Index: rockbox-devel/apps/bookmark.c =================================================================== --- rockbox-devel.orig/apps/bookmark.c +++ rockbox-devel/apps/bookmark.c @@ -67,7 +67,7 @@ static void display_bookmark(const char int bookmark_id, int bookmark_count); static void say_bookmark(const char* bookmark, - int bookmark_id); + int bookmark_id, bool is_mrb); static bool generate_bookmark_file_name(const char *in); static char* get_bookmark(const char* bookmark_file, int bookmark_count); static bool parse_bookmark(const char *bookmark, @@ -81,7 +81,7 @@ static bool parse_bookmark(const char * int * repeat_mode, bool *shuffle, char* file_name); -static char* select_bookmark(const char* bookmark_file_name); +static char* select_bookmark(const char* bookmark_file_name, bool is_mrb); static bool system_check(void); static bool write_bookmark(bool create_bookmark_file); static int get_bookmark_count(const char* bookmark_file_name); @@ -123,7 +123,7 @@ bool bookmark_load_menu(void) sizeof(global_temp_buffer)); if (generate_bookmark_file_name(name)) { - bookmark = select_bookmark(global_bookmark_file_name); + bookmark = select_bookmark(global_bookmark_file_name, 0); if (!bookmark) return false; /* User exited without selecting a bookmark */ @@ -165,7 +165,7 @@ bool bookmark_mrb_load() int index; char* bookmark; - bookmark = select_bookmark(RECENT_BOOKMARK_FILE); + bookmark = select_bookmark(RECENT_BOOKMARK_FILE, 1); if (!bookmark) return false; /* User exited without selecting a bookmark */ @@ -503,7 +503,7 @@ bool bookmark_load(const char* file, boo else { /* This is not an auto-load, so list the bookmarks */ - bookmark=select_bookmark(file); + bookmark=select_bookmark(file, 0); if(!bookmark) return true; /* User exited without selecting a bookmark */ } @@ -557,7 +557,7 @@ static int get_bookmark_count(const char /* This displays a the bookmarks in a file and allows the user to */ /* select one to play. */ /* ------------------------------------------------------------------------*/ -static char* select_bookmark(const char* bookmark_file_name) +static char* select_bookmark(const char* bookmark_file_name, bool is_mrb) { int bookmark_id = 0; int bookmark_id_prev = -1; @@ -586,31 +586,35 @@ static char* select_bookmark(const char* { bookmark = get_bookmark(bookmark_file_name, bookmark_id); bookmark_id_prev = bookmark_id; - } - if (!bookmark) - { - /* if there were no bookmarks in the file, delete the file and exit. */ - if(bookmark_id <= 0) - { - gui_syncsplash(HZ, true, ID2P(LANG_BOOKMARK_LOAD_EMPTY)); - remove(bookmark_file_name); - action_signalscreenchange(); - return NULL; - } - else - { - bookmark_id_prev = bookmark_id; - bookmark_id--; - } - } - else - { - display_bookmark(bookmark, bookmark_id, bookmark_count); - if (global_settings.talk_menu) /* for voice UI */ - say_bookmark(bookmark, bookmark_id); - } + if (!bookmark) + { + /* if there were no bookmarks in the file, delete the + file and exit. */ + if(bookmark_id <= 0) + { + gui_syncsplash(HZ, true, ID2P(LANG_BOOKMARK_LOAD_EMPTY)); + remove(bookmark_file_name); + action_signalscreenchange(); + return NULL; + } + else + { + bookmark_id_prev = bookmark_id; + bookmark_id--; + } + } + else + { + display_bookmark(bookmark, bookmark_id, bookmark_count); + if (global_settings.talk_menu) /* for voice UI */ + say_bookmark(bookmark, bookmark_id, is_mrb); + /* We say something only if we moved to a new + bookmark. In particular we don't interrupt + ourselves for unmapped buttons. */ + } + } /* waiting for the user to click a button */ key = get_action(CONTEXT_BOOKMARKSCREEN,TIMEOUT_BLOCK); switch(key) @@ -879,40 +883,73 @@ static void display_bookmark(const char* /* This function parses a bookmark, says the voice UI part of it. */ /* ------------------------------------------------------------------------*/ static void say_bookmark(const char* bookmark, - int bookmark_id) + int bookmark_id, bool is_mrb) { int resume_index; long ms; - char dir[MAX_PATH]; - bool enqueue = false; /* only the first voice is not queued */ + char playlist_dir[MAX_PATH]; + int repeat_mode = 0; + bool playlist_shuffle = false; + bool is_dir; parse_bookmark(bookmark, &resume_index, NULL, NULL, NULL, - dir, sizeof(dir), - &ms, NULL, NULL, - NULL); -/* disabled, because transition between talkbox and voice UI clip is not nice */ -#if 0 - if (global_settings.talk_dir >= 3) - { /* "talkbox" enabled */ - char* last = strrchr(dir, '/'); - if (last) - { /* compose filename for talkbox */ - strncpy(last + 1, dir_thumbnail_name, sizeof(dir)-(last-dir)-1); - talk_file(dir, enqueue); - enqueue = true; - } - } -#endif - talk_id(VOICE_EXT_BMARK, enqueue); + playlist_dir, sizeof(playlist_dir), + &ms, &repeat_mode, &playlist_shuffle, + global_filename); + + talk_id(VOICE_EXT_BMARK, false); talk_number(bookmark_id + 1, true); + + is_dir = (playlist_dir[strlen(playlist_dir)-1] == '/'); + if(is_mrb) + { /* It's useful to know which playlist this is */ + if(is_dir) + talk_dir_or_spell(playlist_dir, TALK_IDARRAY(VOICE_DIRECTORY), true); + else talk_file_or_spell(NULL, playlist_dir, + TALK_IDARRAY(LANG_PLAYLIST), true); + } + talk_id(LANG_BOOKMARK_SELECT_INDEX_TEXT, true); talk_number(resume_index + 1, true); talk_id(LANG_BOOKMARK_SELECT_TIME_TEXT, true); if (ms / 60000) talk_value(ms / 60000, UNIT_MIN, true); talk_value((ms % 60000) / 1000, UNIT_SEC, true); + + /* Track filename */ + if(is_dir) + talk_file_or_spell(playlist_dir, global_filename, + TALK_IDARRAY(VOICE_FILE), true); + else + { /* Unfortunately if this is a playlist, we do not know in which + directory the file is and therefore cannot find the track's + .talk file. */ + talk_id(VOICE_FILE, true); + talk_spell(global_filename, true); + } + + /* bookmark shuffle and repeat states*/ + switch (repeat_mode) + { +#if (AB_REPEAT_ENABLE == 1) + case REPEAT_AB: + talk_id(LANG_REPEAT, true); + talk_id(LANG_REPEAT_AB, true); + break; +#endif + case REPEAT_ONE: + talk_id(LANG_REPEAT, true); + talk_id(LANG_REPEAT_ONE, true); + break; + case REPEAT_ALL: + talk_id(LANG_REPEAT, true); + talk_id(LANG_REPEAT_ALL, true); + break; + } + if(playlist_shuffle) + talk_id(LANG_SHUFFLE, true); } Index: rockbox-devel/apps/lang/english.lang =================================================================== --- rockbox-devel.orig/apps/lang/english.lang +++ rockbox-devel/apps/lang/english.lang @@ -10406,3 +10406,17 @@ *: "slash" + + id: VOICE_DIRECTORY + desc: bookmark selection + user: + + *: "" + + + *: "" + + + *: "Directory" + + Index: rockbox-devel/apps/tree.c =================================================================== --- rockbox-devel.orig/apps/tree.c +++ rockbox-devel/apps/tree.c @@ -1303,6 +1303,9 @@ void bookmark_play(char *resume_file, in int i; char* suffix = strrchr(resume_file, '.'); + /* Nicely shuts up the voice while acknowledging the key press */ + gui_syncsplash(0, true, ID2P(LANG_WAIT)); + if (suffix != NULL && (!strcasecmp(suffix, ".m3u") || !strcasecmp(suffix, ".m3u8"))) {