1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jens Arnold 2006-05-15 21:00:58 +00:00
parent 96fe33102a
commit 83f67db3ee

View file

@ -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,10 +483,6 @@ 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;
@ -492,8 +496,6 @@ void talk_init(void)
close(filehandle); /* close again, this was just to detect presence */
filehandle = -1;
}
#endif
}