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
This commit is contained in:
Nils Wallménius 2007-11-20 19:50:52 +00:00
parent ade8ae9acb
commit acbd780239
6 changed files with 21 additions and 20 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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)
{

View file

@ -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

View file

@ -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 */

View file

@ -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 */