summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/talk.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/talk.c b/apps/talk.c
index 80b4fa335f..6807481e0d 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -89,7 +89,7 @@ static int queue_write; /* write index of queue, by application */
89static int queue_read; /* read index of queue, by ISR context */ 89static int queue_read; /* read index of queue, by ISR context */
90static int sent; /* how many bytes handed over to playback, owned by ISR */ 90static int sent; /* how many bytes handed over to playback, owned by ISR */
91static unsigned char curr_hd[3]; /* current frame header, for re-sync */ 91static unsigned char curr_hd[3]; /* current frame header, for re-sync */
92static int filehandle; /* global, so the MMC variant can keep the file open */ 92static int filehandle = -1; /* global, so the MMC variant can keep the file open */
93static unsigned char* p_silence; /* VOICE_PAUSE clip, used for termination */ 93static unsigned char* p_silence; /* VOICE_PAUSE clip, used for termination */
94static long silence_len; /* length of the VOICE_PAUSE clip */ 94static long silence_len; /* length of the VOICE_PAUSE clip */
95static unsigned char* p_lastclip; /* address of latest clip, for silence add */ 95static unsigned char* p_lastclip; /* address of latest clip, for silence add */
@@ -466,6 +466,14 @@ void talk_init(void)
466 return; 466 return;
467 } 467 }
468 468
469#ifdef HAVE_MMC
470 if (filehandle >= 0) /* MMC: An old voice file might still be open */
471 {
472 close(filehandle);
473 filehandle = -1;
474 }
475#endif
476
469 talk_initialized = true; 477 talk_initialized = true;
470 strncpy((char *) last_lang, (char *)global_settings.lang_file, 478 strncpy((char *) last_lang, (char *)global_settings.lang_file,
471 MAX_FILENAME); 479 MAX_FILENAME);
@@ -475,14 +483,10 @@ void talk_init(void)
475#endif 483#endif
476 reset_state(); /* use this for most of our inits */ 484 reset_state(); /* use this for most of our inits */
477 485
478#ifdef HAVE_MMC
479 load_voicefile(); /* load the tables right away */
480 has_voicefile = (p_voicefile != NULL);
481#else
482 filehandle = open_voicefile(); 486 filehandle = open_voicefile();
483 has_voicefile = (filehandle >= 0); /* test if we can open it */ 487 has_voicefile = (filehandle >= 0); /* test if we can open it */
484 voicefile_size = 0; 488 voicefile_size = 0;
485 489
486 if (has_voicefile) 490 if (has_voicefile)
487 { 491 {
488 voicefile_size = filesize(filehandle); 492 voicefile_size = filesize(filehandle);
@@ -492,8 +496,6 @@ void talk_init(void)
492 close(filehandle); /* close again, this was just to detect presence */ 496 close(filehandle); /* close again, this was just to detect presence */
493 filehandle = -1; 497 filehandle = -1;
494 } 498 }
495#endif
496
497} 499}
498 500
499 501