From 431c895542d482ddf7cced7d7bdfd252968ae875 Mon Sep 17 00:00:00 2001 From: Stéphane Doyon Date: Tue, 15 Jul 2008 19:50:22 +0000 Subject: Workaround to allow voicing the "Create a Bookmark?" prompt and "Bookmark Created" splash. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18061 a1c6a512-1295-4272-9138-f99709370657 --- apps/bookmark.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/apps/bookmark.c b/apps/bookmark.c index 0ab78cd83f..5bb87ac25e 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -93,7 +93,7 @@ static char* get_bookmark_info(int list_index, size_t buffer_len); static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume); static bool system_check(void); -static bool write_bookmark(bool create_bookmark_file); +static bool write_bookmark(bool create_bookmark_file, char *bookmark); static int get_bookmark_count(const char* bookmark_file_name); static char global_temp_buffer[MAX_PATH+1]; @@ -110,7 +110,7 @@ static char global_filename[MAX_PATH]; /* ----------------------------------------------------------------------- */ bool bookmark_create_menu(void) { - write_bookmark(true); + write_bookmark(true, create_bookmark()); return false; } @@ -162,20 +162,27 @@ bool bookmark_mrb_load() /* ----------------------------------------------------------------------- */ bool bookmark_autobookmark(void) { + char* bookmark; if (!system_check()) return false; audio_pause(); /* first pause playback */ + bookmark = create_bookmark(); + /* Workaround for inability to speak when paused: all callers will + just do audio_stop() when we return, so we can do it right + away. This makes it possible to speak the "Create a Bookmark?" + prompt and the "Bookmark Created" splash. */ + audio_stop(); switch (global_settings.autocreatebookmark) { case BOOKMARK_YES: - return write_bookmark(true); + return write_bookmark(true, bookmark); case BOOKMARK_NO: return false; case BOOKMARK_RECENT_ONLY_YES: - return write_bookmark(false); + return write_bookmark(false, bookmark); } #ifdef HAVE_LCD_BITMAP const char *lines[]={ID2P(LANG_AUTO_BOOKMARK_QUERY)}; @@ -195,9 +202,9 @@ bool bookmark_autobookmark(void) if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) { if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK) - return write_bookmark(false); + return write_bookmark(false, bookmark); else - return write_bookmark(true); + return write_bookmark(true, bookmark); } return false; } @@ -209,15 +216,9 @@ bool bookmark_autobookmark(void) /* resume_index*resume_offset*resume_seed*resume_first_index* */ /* resume_file*milliseconds*MP3 Title* */ /* ------------------------------------------------------------------------*/ -static bool write_bookmark(bool create_bookmark_file) +static bool write_bookmark(bool create_bookmark_file, char *bookmark) { bool success=false; - char* bookmark; - - if (!system_check()) - return false; /* something didn't happen correctly, do nothing */ - - bookmark = create_bookmark(); if (!bookmark) return false; /* something didn't happen correctly, do nothing */ @@ -321,6 +322,9 @@ static char* create_bookmark() int resume_index = 0; char *file; + if (!system_check()) + return NULL; /* something didn't happen correctly, do nothing */ + /* grab the currently playing track */ struct mp3entry *id3 = audio_current_track(); if(!id3) -- cgit v1.2.3