summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-05-15 21:00:58 +0000
committerJens Arnold <amiconn@rockbox.org>2006-05-15 21:00:58 +0000
commit83f67db3ee24d426c956de1d426695fc547ba262 (patch)
tree9215ff135e0fb2f8eb87f6fcbc156a247a256d3b
parent96fe33102add19631b96ca4cf830e80b8d8eb19e (diff)
downloadrockbox-83f67db3ee24d426c956de1d426695fc547ba262.zip
rockbox-83f67db3ee24d426c956de1d426695fc547ba262.tar.gz
rockbox-83f67db3ee24d426c956de1d426695fc547ba262.tar.bz2
rockbox-83f67db3ee24d426c956de1d426695fc547ba262.tar.xz
Ondio: Two voice bugfixes. (1) When changing language and voice is enabled, do the voice file presence check the same way as on the other targets. Loading the tables right away when music is playing isn't a good idea... (2) Changing language with voice enabled leaked file handles.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9946 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/talk.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/talk.c b/apps/talk.c
index 80b4fa3..6807481 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -89,7 +89,7 @@ static int queue_write; /* write index of queue, by application */
static int queue_read; /* read index of queue, by ISR context */
static int sent; /* how many bytes handed over to playback, owned by ISR */
static unsigned char curr_hd[3]; /* current frame header, for re-sync */
-static int filehandle; /* global, so the MMC variant can keep the file open */
+static int filehandle = -1; /* global, so the MMC variant can keep the file open */
static unsigned char* p_silence; /* VOICE_PAUSE clip, used for termination */
static long silence_len; /* length of the VOICE_PAUSE clip */
static unsigned char* p_lastclip; /* address of latest clip, for silence add */
@@ -466,6 +466,14 @@ void talk_init(void)
return;
}
+#ifdef HAVE_MMC
+ if (filehandle >= 0) /* MMC: An old voice file might still be open */
+ {
+ close(filehandle);
+ filehandle = -1;
+ }
+#endif
+
talk_initialized = true;
strncpy((char *) last_lang, (char *)global_settings.lang_file,
MAX_FILENAME);
@@ -475,14 +483,10 @@ void talk_init(void)
#endif
reset_state(); /* use this for most of our inits */
-#ifdef HAVE_MMC
- load_voicefile(); /* load the tables right away */
- has_voicefile = (p_voicefile != NULL);
-#else
filehandle = open_voicefile();
has_voicefile = (filehandle >= 0); /* test if we can open it */
voicefile_size = 0;
-
+
if (has_voicefile)
{
voicefile_size = filesize(filehandle);
@@ -492,8 +496,6 @@ void talk_init(void)
close(filehandle); /* close again, this was just to detect presence */
filehandle = -1;
}
-#endif
-
}