summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2007-11-20 19:50:52 +0000
committerNils Wallménius <nils@rockbox.org>2007-11-20 19:50:52 +0000
commitacbd78023965cce0b0499ff150caf8078cb33b58 (patch)
tree5da45c3ae17f0ec27b5057910feec68ff35ec377
parentade8ae9acbcaaf2a61fed00160f6c46aba052c16 (diff)
downloadrockbox-acbd78023965cce0b0499ff150caf8078cb33b58.zip
rockbox-acbd78023965cce0b0499ff150caf8078cb33b58.tar.gz
rockbox-acbd78023965cce0b0499ff150caf8078cb33b58.tar.bz2
rockbox-acbd78023965cce0b0499ff150caf8078cb33b58.tar.xz
Make id's created with the TALK_ID macro work in 64 bit sims
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15723 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/option_select.c8
-rw-r--r--apps/settings.h4
-rw-r--r--apps/settings_list.c14
-rw-r--r--apps/settings_list.h2
-rw-r--r--apps/talk.c10
-rw-r--r--apps/talk.h3
6 files changed, 21 insertions, 20 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index d36ed40..ec86de7 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -152,9 +152,9 @@ static int option_talk(int selected_item, void * data)
{
struct int_setting *info = setting->int_setting;
if (info->get_talk_id)
- talk_id(info->get_talk_id((int)temp_var), false);
+ talk_id(info->get_talk_id(temp_var), false);
else
- talk_value((int)temp_var, info->unit, false);
+ talk_value(temp_var, info->unit, false);
}
else if ((setting->flags & F_T_SOUND) == F_T_SOUND)
{
@@ -477,7 +477,7 @@ void set_option_formatter(char* buf, size_t size, int item, const char* unit)
const unsigned char *text = set_option_options[item].string;
snprintf(buf, size, "%s", P2STR(text));
}
-long set_option_get_talk_id(int value)
+int32_t set_option_get_talk_id(int value)
{
return set_option_options[value].voice_id;
}
@@ -518,7 +518,7 @@ bool set_int_ex(const unsigned char* string,
int min,
int max,
void (*formatter)(char*, size_t, int, const char*),
- long (*get_talk_id)(int))
+ int32_t (*get_talk_id)(int))
{
(void)unit;
struct settings_list item;
diff --git a/apps/settings.h b/apps/settings.h
index c4db9a1..e5a2b17 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -41,7 +41,7 @@
struct opt_items {
unsigned const char* string;
- long voice_id;
+ int32_t voice_id;
};
/** Setting values defines **/
@@ -254,7 +254,7 @@ bool set_int_ex(const unsigned char* string, const char* unit, int voice_unit,
int* variable,
void (*function)(int), int step, int min, int max,
void (*formatter)(char*, size_t, int, const char*),
- long (*get_talk_id)(int));
+ int32_t (*get_talk_id)(int));
/* the following are either not in setting.c or shouldnt be */
bool set_time_screen(const char* string, struct tm *tm);
diff --git a/apps/settings_list.c b/apps/settings_list.c
index d1d8905..516c65e 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -189,7 +189,7 @@ static const char trig_durations_conf [] =
# endif
#endif
-static long rectime_getlang(int value)
+static int32_t rectime_getlang(int value)
{
if (value == 0)
return LANG_OFF;
@@ -221,7 +221,7 @@ static void backlight_formatter(char *buffer, size_t buffer_size,
else
snprintf(buffer, buffer_size, "%d s", backlight_timeout_value[val]);
}
-static long backlight_getlang(int value)
+static int32_t backlight_getlang(int value)
{
if (value == 0)
return LANG_OFF;
@@ -232,7 +232,7 @@ static long backlight_getlang(int value)
#endif
/* ffwd/rewind and scan acceleration stuff */
static const unsigned char ff_rewind_min_stepvals[] = {1,2,3,4,5,6,8,10,15,20,25,30,45,60};
-static long ff_rewind_min_step_getlang(int value)
+static int32_t ff_rewind_min_step_getlang(int value)
{
return TALK_ID(ff_rewind_min_stepvals[value], UNIT_SEC);
}
@@ -242,7 +242,7 @@ static void ff_rewind_min_step_formatter(char *buffer, size_t buffer_size,
(void)unit;
snprintf(buffer, buffer_size, "%ds", ff_rewind_min_stepvals[val]);
}
-static long scanaccel_getlang(int value)
+static int32_t scanaccel_getlang(int value)
{
if (value == 0)
return LANG_OFF;
@@ -259,7 +259,7 @@ static void scanaccel_formatter(char *buffer, size_t buffer_size,
}
static const unsigned char poweroff_idle_timer_times[] = {0,1,2,3,4,5,6,7,8,9,10,15,30,45,60};
-static long poweroff_idle_timer_getlang(int value)
+static int32_t poweroff_idle_timer_getlang(int value)
{
if (value == 0)
return LANG_OFF;
@@ -276,7 +276,7 @@ static void poweroff_idle_timer_formatter(char *buffer, size_t buffer_size,
}
#ifndef HAVE_SCROLLWHEEL
-static long listaccel_getlang(int value)
+static int32_t listaccel_getlang(int value)
{
if (value == 0)
return LANG_OFF;
@@ -352,7 +352,7 @@ static void jumpscroll_format(char* buffer, size_t buffer_size, int value,
break;
}
}
-static long jumpscroll_getlang(int value)
+static int32_t jumpscroll_getlang(int value)
{
switch (value)
{
diff --git a/apps/settings_list.h b/apps/settings_list.h
index 3127dba..8aa7863 100644
--- a/apps/settings_list.h
+++ b/apps/settings_list.h
@@ -70,7 +70,7 @@ struct int_setting {
int max;
int step;
void (*formatter)(char*, size_t, int, const char*);
- long (*get_talk_id)(int);
+ int32_t (*get_talk_id)(int);
};
#define F_INT_SETTING 0x80
diff --git a/apps/talk.c b/apps/talk.c
index 332a10f..012048a 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -559,17 +559,17 @@ void talk_buffer_steal(void)
/* play a voice ID from voicefile */
-int talk_id(long id, bool enqueue)
+int talk_id(int32_t id, bool enqueue)
{
long clipsize;
unsigned char* clipbuf;
- int unit;
+ int32_t unit;
if (talk_temp_disable_count > 0)
return -1; /* talking has been disabled */
#if CONFIG_CODEC != SWCODEC
if (audio_status()) /* busy, buffer in use */
- return -1;
+ return -1;
#endif
if (p_voicefile == NULL && has_voicefile)
@@ -582,10 +582,10 @@ int talk_id(long id, bool enqueue)
return -1;
/* check if this is a special ID, with a value */
- unit = ((unsigned long)id) >> UNIT_SHIFT;
+ unit = ((uint32_t)id) >> UNIT_SHIFT;
if (unit)
{ /* sign-extend the value */
- id = (unsigned long)id << (32-UNIT_SHIFT);
+ id = (uint32_t)id << (32-UNIT_SHIFT);
id >>= (32-UNIT_SHIFT);
talk_value(id, unit, enqueue); /* speak it */
return 0; /* and stop, end of special case */
diff --git a/apps/talk.h b/apps/talk.h
index adf4155..af74af6 100644
--- a/apps/talk.h
+++ b/apps/talk.h
@@ -25,6 +25,7 @@
#define __TALK_H__
#include <stdbool.h>
+#include <inttypes.h>
#include "time.h"
#define VOICE_VERSION 400 /* 4.00 - if you change this, change it in voicefont too */
@@ -72,7 +73,7 @@ bool talk_voice_required(void); /* returns true if voice codec required */
int talk_get_bufsize(void); /* get the loaded voice file size */
void talk_buffer_steal(void); /* claim the mp3 buffer e.g. for play/record */
bool is_voice_queued(void); /* Are there more voice clips to be spoken? */
-int talk_id(long id, bool enqueue); /* play a voice ID from voicefont */
+int talk_id(int32_t id, bool enqueue); /* play a voice ID from voicefont */
int talk_file(const char* filename, bool enqueue); /* play a thumbnail from file */
int talk_number(long n, bool enqueue); /* say a number */
int talk_value(long n, int unit, bool enqueue); /* say a numeric value */