diff options
| author | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-04-06 07:06:59 +0000 |
|---|---|---|
| committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-04-06 07:06:59 +0000 |
| commit | 6e77d1fe39cd07bd4ec39ea595e9ec7ac2ac7d34 (patch) | |
| tree | 110141f754982db12b5f5760840bfdb12e9e09ef /apps/talk.c | |
| parent | 4af9331ed2370797ce3b71e4cd1f2b679542a225 (diff) | |
| download | rockbox-6e77d1fe39cd07bd4ec39ea595e9ec7ac2ac7d34.zip rockbox-6e77d1fe39cd07bd4ec39ea595e9ec7ac2ac7d34.tar.gz rockbox-6e77d1fe39cd07bd4ec39ea595e9ec7ac2ac7d34.tar.bz2 rockbox-6e77d1fe39cd07bd4ec39ea595e9ec7ac2ac7d34.tar.xz | |
Voice UI searches for <mylanguage>.voice, no hard-coded "english.voice" any more. We can localize the voice now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4471 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/talk.c')
| -rw-r--r-- | apps/talk.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/apps/talk.c b/apps/talk.c index a0c730c..9ea547b 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -26,6 +26,7 @@ #include "file.h" #include "buffer.h" #include "system.h" +#include "settings.h" #include "mp3_playback.h" #include "mpeg.h" #include "lang.h" @@ -36,7 +37,6 @@ extern void bitswap(unsigned char *data, int length); /* no header for this */ /***************** Constants *****************/ #define QUEUE_SIZE 50 -const char* voicefont_file = "/.rockbox/langs/english.voice"; const char* dir_thumbnail_name = ".dirname.mp3"; @@ -84,10 +84,29 @@ static int load_voicefont(void); static void mp3_callback(unsigned char** start, int* size); static int shutup(void); static int queue_clip(unsigned char* buf, int size, bool enqueue); +static int open_voicefile(void); /***************** Private implementation *****************/ +static int open_voicefile(void) +{ + char buf[64]; + char* p_lang = "english"; /* default */ + + if ( global_settings.lang_file[0] && + global_settings.lang_file[0] != 0xff ) + { /* try to open the voice file of the selected language */ + p_lang = global_settings.lang_file; + } + + snprintf(buf, sizeof(buf), ROCKBOX_DIR LANG_DIR "/%s.voice", p_lang); + + return open(buf, O_RDONLY); +} + + + static int load_voicefont(void) { int fd; @@ -95,7 +114,7 @@ static int load_voicefont(void) p_voicefont = NULL; /* indicate no voicefont if we fail below */ - fd = open(voicefont_file, O_RDONLY); + fd = open_voicefile(); if (fd < 0) /* failed to open */ { p_voicefont = NULL; /* indicate no voicefont */ @@ -253,7 +272,7 @@ void talk_init(void) { int fd; - fd = open(voicefont_file, O_RDONLY); + fd = open_voicefile(); if (fd >= 0) /* success */ { close(fd); |