diff options
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 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 |
39 | const char* voicefont_file = "/.rockbox/langs/english.voice"; | ||
40 | const char* dir_thumbnail_name = ".dirname.mp3"; | 40 | const char* dir_thumbnail_name = ".dirname.mp3"; |
41 | 41 | ||
42 | 42 | ||
@@ -84,10 +84,29 @@ static int load_voicefont(void); | |||
84 | static void mp3_callback(unsigned char** start, int* size); | 84 | static void mp3_callback(unsigned char** start, int* size); |
85 | static int shutup(void); | 85 | static int shutup(void); |
86 | static int queue_clip(unsigned char* buf, int size, bool enqueue); | 86 | static int queue_clip(unsigned char* buf, int size, bool enqueue); |
87 | static int open_voicefile(void); | ||
87 | 88 | ||
88 | 89 | ||
89 | /***************** Private implementation *****************/ | 90 | /***************** Private implementation *****************/ |
90 | 91 | ||
92 | static 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 | |||
91 | static int load_voicefont(void) | 110 | static 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); |