summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2004-04-06 07:06:59 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2004-04-06 07:06:59 +0000
commit6e77d1fe39cd07bd4ec39ea595e9ec7ac2ac7d34 (patch)
tree110141f754982db12b5f5760840bfdb12e9e09ef /apps
parent4af9331ed2370797ce3b71e4cd1f2b679542a225 (diff)
downloadrockbox-6e77d1fe39cd07bd4ec39ea595e9ec7ac2ac7d34.tar.gz
rockbox-6e77d1fe39cd07bd4ec39ea595e9ec7ac2ac7d34.zip
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')
-rw-r--r--apps/settings.c4
-rw-r--r--apps/talk.c25
-rw-r--r--apps/tree.c1
3 files changed, 27 insertions, 3 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 2e1a664286..865e84dafe 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -587,6 +587,7 @@ void settings_apply(void)
587 snprintf(buf, sizeof buf, ROCKBOX_DIR LANG_DIR "/%s.lng", 587 snprintf(buf, sizeof buf, ROCKBOX_DIR LANG_DIR "/%s.lng",
588 global_settings.lang_file); 588 global_settings.lang_file);
589 lang_load(buf); 589 lang_load(buf);
590 talk_init(); /* use voice of same language */
590 } 591 }
591 592
592 set_car_adapter_mode(global_settings.car_adapter_mode); 593 set_car_adapter_mode(global_settings.car_adapter_mode);
@@ -974,7 +975,10 @@ bool settings_load_config(char* file)
974 } 975 }
975 else if (!strcasecmp(name, "lang")) { 976 else if (!strcasecmp(name, "lang")) {
976 if (!lang_load(value)) 977 if (!lang_load(value))
978 {
977 set_file(value, global_settings.lang_file, MAX_FILENAME); 979 set_file(value, global_settings.lang_file, MAX_FILENAME);
980 talk_init(); /* use voice of same language */
981 }
978 } 982 }
979 else if (!strcasecmp(name, "bidir limit")) 983 else if (!strcasecmp(name, "bidir limit"))
980 set_cfg_int(&global_settings.bidir_limit, value, 0, 200); 984 set_cfg_int(&global_settings.bidir_limit, value, 0, 200);
diff --git a/apps/talk.c b/apps/talk.c
index a0c730cbcc..9ea547bb16 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -26,6 +26,7 @@
26#include "file.h" 26#include "file.h"
27#include "buffer.h" 27#include "buffer.h"
28#include "system.h" 28#include "system.h"
29#include "settings.h"
29#include "mp3_playback.h" 30#include "mp3_playback.h"
30#include "mpeg.h" 31#include "mpeg.h"
31#include "lang.h" 32#include "lang.h"
@@ -36,7 +37,6 @@ extern void bitswap(unsigned char *data, int length); /* no header for this */
36/***************** Constants *****************/ 37/***************** Constants *****************/
37 38
38#define QUEUE_SIZE 50 39#define QUEUE_SIZE 50
39const char* voicefont_file = "/.rockbox/langs/english.voice";
40const char* dir_thumbnail_name = ".dirname.mp3"; 40const char* dir_thumbnail_name = ".dirname.mp3";
41 41
42 42
@@ -84,10 +84,29 @@ static int load_voicefont(void);
84static void mp3_callback(unsigned char** start, int* size); 84static void mp3_callback(unsigned char** start, int* size);
85static int shutup(void); 85static int shutup(void);
86static int queue_clip(unsigned char* buf, int size, bool enqueue); 86static int queue_clip(unsigned char* buf, int size, bool enqueue);
87static int open_voicefile(void);
87 88
88 89
89/***************** Private implementation *****************/ 90/***************** Private implementation *****************/
90 91
92static int open_voicefile(void)
93{
94 char buf[64];
95 char* p_lang = "english"; /* default */
96
97 if ( global_settings.lang_file[0] &&
98 global_settings.lang_file[0] != 0xff )
99 { /* try to open the voice file of the selected language */
100 p_lang = global_settings.lang_file;
101 }
102
103 snprintf(buf, sizeof(buf), ROCKBOX_DIR LANG_DIR "/%s.voice", p_lang);
104
105 return open(buf, O_RDONLY);
106}
107
108
109
91static int load_voicefont(void) 110static int load_voicefont(void)
92{ 111{
93 int fd; 112 int fd;
@@ -95,7 +114,7 @@ static int load_voicefont(void)
95 114
96 p_voicefont = NULL; /* indicate no voicefont if we fail below */ 115 p_voicefont = NULL; /* indicate no voicefont if we fail below */
97 116
98 fd = open(voicefont_file, O_RDONLY); 117 fd = open_voicefile();
99 if (fd < 0) /* failed to open */ 118 if (fd < 0) /* failed to open */
100 { 119 {
101 p_voicefont = NULL; /* indicate no voicefont */ 120 p_voicefont = NULL; /* indicate no voicefont */
@@ -253,7 +272,7 @@ void talk_init(void)
253{ 272{
254 int fd; 273 int fd;
255 274
256 fd = open(voicefont_file, O_RDONLY); 275 fd = open_voicefile();
257 if (fd >= 0) /* success */ 276 if (fd >= 0) /* success */
258 { 277 {
259 close(fd); 278 close(fd);
diff --git a/apps/tree.c b/apps/tree.c
index 31fe0e2d4b..8417e9a65e 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -1176,6 +1176,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1176 if(!lang_load(buf)) { 1176 if(!lang_load(buf)) {
1177 set_file(buf, global_settings.lang_file, 1177 set_file(buf, global_settings.lang_file,
1178 MAX_FILENAME); 1178 MAX_FILENAME);
1179 talk_init(); /* use voice of same language */
1179 splash(HZ, true, str(LANG_LANGUAGE_LOADED)); 1180 splash(HZ, true, str(LANG_LANGUAGE_LOADED));
1180 restore = true; 1181 restore = true;
1181 } 1182 }