summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Doyon <s.doyon@videotron.ca>2007-10-09 03:53:46 +0000
committerStéphane Doyon <s.doyon@videotron.ca>2007-10-09 03:53:46 +0000
commit26e47f2ad5e9450dfa4a94473f8c8bd1c59a2412 (patch)
tree34dd30257e1f0f6e66d4fb403c378919320128f7
parent5acf09104644a7942cf264d80a99f6bf5ae20792 (diff)
downloadrockbox-26e47f2ad5e9450dfa4a94473f8c8bd1c59a2412.tar.gz
rockbox-26e47f2ad5e9450dfa4a94473f8c8bd1c59a2412.zip
Use dynamic menu voice callbacks to speak menu item names in the
"Simple EQ Settings" menu and the Peak filter item names in the "Advanced EQ Settings" menu. From FS#7563. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15043 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/lang/english.lang2
-rw-r--r--apps/menus/eq_menu.c72
2 files changed, 49 insertions, 25 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 94a280ecff..ce798fded3 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -1109,7 +1109,7 @@
</dest>
<voice>
*: none
- swcodec: ""
+ swcodec: "hertz band gain"
</voice>
</phrase>
<phrase>
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c
index 7cb88065f5..4dd8c06c65 100644
--- a/apps/menus/eq_menu.c
+++ b/apps/menus/eq_menu.c
@@ -118,6 +118,14 @@ char* gainitem_get_name(int selected_item, void * data, char *buffer)
snprintf(buffer, MAX_PATH, str(LANG_EQUALIZER_GAIN_ITEM), *setting);
return buffer;
}
+int gainitem_speak_item(int selected_item, void * data)
+{
+ (void)selected_item;
+ int *setting = (int*)data;
+ talk_number(*setting, false);
+ talk_id(LANG_EQUALIZER_GAIN_ITEM, true);
+ return 0;
+}
int do_option(void* param)
{
@@ -145,21 +153,26 @@ MENUITEM_SETTING(gain_2, &global_settings.eq_band2_gain, dsp_set_coefs_callback)
MENUITEM_SETTING(gain_3, &global_settings.eq_band3_gain, dsp_set_coefs_callback);
MENUITEM_SETTING(gain_4, &global_settings.eq_band4_gain, dsp_set_coefs_callback);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_0, MENU_FUNC_USEPARAM, do_option,
- (void*)&gain_0, gainitem_get_name, NULL, &global_settings.eq_band0_cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_1, MENU_FUNC_USEPARAM, do_option,
- (void*)&gain_1, gainitem_get_name, NULL, &global_settings.eq_band1_cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_2, MENU_FUNC_USEPARAM, do_option,
- (void*)&gain_2, gainitem_get_name, NULL, &global_settings.eq_band2_cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_3, MENU_FUNC_USEPARAM, do_option,
- (void*)&gain_3, gainitem_get_name, NULL, &global_settings.eq_band3_cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_4, MENU_FUNC_USEPARAM, do_option,
- (void*)&gain_4, gainitem_get_name, NULL, &global_settings.eq_band4_cutoff,
- NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT(gain_item_0, MENU_FUNC_USEPARAM,
+ do_option, (void*)&gain_0,
+ gainitem_get_name, gainitem_speak_item,
+ &global_settings.eq_band0_cutoff, NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT(gain_item_1, MENU_FUNC_USEPARAM,
+ do_option, (void*)&gain_1,
+ gainitem_get_name, gainitem_speak_item,
+ &global_settings.eq_band1_cutoff, NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT(gain_item_2, MENU_FUNC_USEPARAM,
+ do_option, (void*)&gain_2,
+ gainitem_get_name, gainitem_speak_item,
+ &global_settings.eq_band2_cutoff, NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT(gain_item_3, MENU_FUNC_USEPARAM,
+ do_option, (void*)&gain_3,
+ gainitem_get_name, gainitem_speak_item,
+ &global_settings.eq_band3_cutoff, NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT(gain_item_4, MENU_FUNC_USEPARAM,
+ do_option, (void*)&gain_4,
+ gainitem_get_name, gainitem_speak_item,
+ &global_settings.eq_band4_cutoff, NULL, Icon_NOICON);
MAKE_MENU(gain_menu, ID2P(LANG_EQUALIZER_GAIN), NULL, Icon_NOICON, &gain_item_0,
&gain_item_1, &gain_item_2, &gain_item_3, &gain_item_4);
@@ -176,6 +189,14 @@ char* centerband_get_name(int selected_item, void * data, char *buffer)
snprintf(buffer, MAX_PATH, str(LANG_EQUALIZER_BAND_PEAK), band);
return buffer;
}
+int centerband_speak_item(int selected_item, void * data)
+{
+ (void)selected_item;
+ int band = (intptr_t)data;
+ talk_id(LANG_EQUALIZER_BAND_PEAK, false);
+ talk_number(band, true);
+ return 0;
+}
int do_center_band_menu(void* param)
{
int band = (intptr_t)param;
@@ -196,14 +217,17 @@ int do_center_band_menu(void* param)
MAKE_MENU(band_0_menu, ID2P(LANG_EQUALIZER_BAND_LOW_SHELF), NULL,
Icon_EQ, &cutoff_0, &q_0, &gain_0);
MENUITEM_FUNCTION_DYNTEXT(band_1_menu, MENU_FUNC_USEPARAM,
- do_center_band_menu, (void*)1,
- centerband_get_name, NULL, (void*)1, NULL, Icon_EQ);
+ do_center_band_menu, (void*)1,
+ centerband_get_name, centerband_speak_item,
+ (void*)1, NULL, Icon_EQ);
MENUITEM_FUNCTION_DYNTEXT(band_2_menu, MENU_FUNC_USEPARAM,
- do_center_band_menu, (void*)2,
- centerband_get_name, NULL, (void*)2, NULL, Icon_EQ);
+ do_center_band_menu, (void*)2,
+ centerband_get_name, centerband_speak_item,
+ (void*)2, NULL, Icon_EQ);
MENUITEM_FUNCTION_DYNTEXT(band_3_menu, MENU_FUNC_USEPARAM,
- do_center_band_menu, (void*)3,
- centerband_get_name, NULL, (void*)3, NULL, Icon_EQ);
+ do_center_band_menu, (void*)3,
+ centerband_get_name, centerband_speak_item,
+ (void*)3, NULL, Icon_EQ);
MAKE_MENU(band_4_menu, ID2P(LANG_EQUALIZER_BAND_HIGH_SHELF), NULL,
Icon_EQ, &cutoff_4, &q_4, &gain_4);
@@ -594,12 +618,12 @@ static bool eq_save_preset(void)
if (!kbd_input(filename, sizeof filename)) {
fd = creat(filename);
if (fd < 0)
- gui_syncsplash(HZ, str(LANG_FAILED));
+ gui_syncsplash(HZ, ID2P(LANG_FAILED));
else
break;
}
else {
- gui_syncsplash(HZ, str(LANG_CANCEL));
+ gui_syncsplash(HZ, ID2P(LANG_CANCEL));
return false;
}
}
@@ -618,7 +642,7 @@ static bool eq_save_preset(void)
close(fd);
- gui_syncsplash(HZ, str(LANG_SETTINGS_SAVED));
+ gui_syncsplash(HZ, ID2P(LANG_SETTINGS_SAVED));
return true;
}