summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2021-03-06 23:25:25 -0500
committerSolomon Peachy <pizza@shaftnet.org>2021-03-07 12:51:36 +0000
commit207514fb2578cfac611b4ab98b251d1524a55efe (patch)
tree581cea233e7d0d5a1b0356552c1201ce1ca4bdd4
parentc16f9142f7224007eeca9e44731db95af2b17a8e (diff)
downloadrockbox-207514fb2578cfac611b4ab98b251d1524a55efe.tar.gz
rockbox-207514fb2578cfac611b4ab98b251d1524a55efe.zip
voice: Allow voice prompt volume to be configurable
It defaults to 100%, allow it to be dialed back Change-Id: If997fb7d3057472a7fac0be4ae7d1e8fce654c49
-rw-r--r--apps/lang/english.lang14
-rw-r--r--apps/menus/settings_menu.c3
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_list.c4
-rw-r--r--apps/voice_thread.c11
-rw-r--r--apps/voice_thread.h2
-rw-r--r--manual/configure_rockbox/voice.tex4
7 files changed, 37 insertions, 2 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 8672c9f421..8fd482b0ac 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -9500,6 +9500,20 @@
9500 </voice> 9500 </voice>
9501</phrase> 9501</phrase>
9502<phrase> 9502<phrase>
9503 id: LANG_TALK_MIXER_LEVEL
9504 desc: Relative volume of voice prompts
9505 user: core
9506 <source>
9507 *: "Voice prompt volume"
9508 </source>
9509 <dest>
9510 *: "Voice prompt volume"
9511 </dest>
9512 <voice>
9513 *: "Voice prompt volume"
9514 </voice>
9515</phrase>
9516<phrase>
9503 id: LANG_VOICE_FILETYPE 9517 id: LANG_VOICE_FILETYPE
9504 desc: voice settings menu 9518 desc: voice settings menu
9505 user: core 9519 user: core
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 96ad8009d3..f8dbb86dc3 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -709,10 +709,11 @@ static int talk_callback(int action,
709MENUITEM_SETTING(talk_filetype_item, &global_settings.talk_filetype, NULL); 709MENUITEM_SETTING(talk_filetype_item, &global_settings.talk_filetype, NULL);
710MENUITEM_SETTING(talk_battery_level_item, 710MENUITEM_SETTING(talk_battery_level_item,
711 &global_settings.talk_battery_level, NULL); 711 &global_settings.talk_battery_level, NULL);
712MENUITEM_SETTING(talk_mixer_amp_item, &global_settings.talk_mixer_amp, NULL);
712MAKE_MENU(voice_settings_menu, ID2P(LANG_VOICE), 0, Icon_Voice, 713MAKE_MENU(voice_settings_menu, ID2P(LANG_VOICE), 0, Icon_Voice,
713 &talk_menu_item, &talk_dir_item, &talk_dir_clip_item, 714 &talk_menu_item, &talk_dir_item, &talk_dir_clip_item,
714 &talk_file_item, &talk_file_clip_item, &talk_filetype_item, 715 &talk_file_item, &talk_file_clip_item, &talk_filetype_item,
715 &talk_battery_level_item); 716 &talk_battery_level_item, &talk_mixer_amp_item);
716/* VOICE MENU */ 717/* VOICE MENU */
717/***********************************/ 718/***********************************/
718 719
diff --git a/apps/settings.h b/apps/settings.h
index f9deae1ebe..e6af373e15 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -588,6 +588,7 @@ struct user_settings
588 bool talk_file_clip; /* use file .talk clips */ 588 bool talk_file_clip; /* use file .talk clips */
589 bool talk_filetype; /* say file type */ 589 bool talk_filetype; /* say file type */
590 bool talk_battery_level; 590 bool talk_battery_level;
591 int talk_mixer_amp; /* Relative volume of voices, MIX_AMP_MPUTE->MIX_AMP_UNITY */
591 592
592 /* file browser sorting */ 593 /* file browser sorting */
593 bool sort_case; /* dir sort order: 0=case insensitive, 1=sensitive */ 594 bool sort_case; /* dir sort order: 0=case insensitive, 1=sensitive */
diff --git a/apps/settings_list.c b/apps/settings_list.c
index e296582482..40dbdfa152 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -61,6 +61,8 @@
61#include "onplay.h" 61#include "onplay.h"
62#endif 62#endif
63 63
64#include "voice_thread.h"
65
64#if defined(DX50) || defined(DX90) 66#if defined(DX50) || defined(DX90)
65#include "governor-ibasso.h" 67#include "governor-ibasso.h"
66#include "usb-ibasso.h" 68#include "usb-ibasso.h"
@@ -1327,6 +1329,8 @@ const struct settings_list settings[] = {
1327 "talk filetype", NULL), 1329 "talk filetype", NULL),
1328 OFFON_SETTING(F_TEMPVAR, talk_battery_level, LANG_TALK_BATTERY_LEVEL, false, 1330 OFFON_SETTING(F_TEMPVAR, talk_battery_level, LANG_TALK_BATTERY_LEVEL, false,
1329 "Announce Battery Level", NULL), 1331 "Announce Battery Level", NULL),
1332 INT_SETTING(0, talk_mixer_amp, LANG_TALK_MIXER_LEVEL, 100,
1333 "talk mixer level", UNIT_PERCENT, 0, 100, 5, NULL, NULL, voice_set_mixer_level),
1330 1334
1331#ifdef HAVE_RECORDING 1335#ifdef HAVE_RECORDING
1332 /* recording */ 1336 /* recording */
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index d7c352509b..77bdd08d44 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -31,6 +31,7 @@
31#include "pcm.h" 31#include "pcm.h"
32#include "pcm_mixer.h" 32#include "pcm_mixer.h"
33#include "codecs/libspeex/speex/speex.h" 33#include "codecs/libspeex/speex/speex.h"
34#include "settings.h"
34 35
35/* Default number of PCM frames to queue - adjust as necessary per-target */ 36/* Default number of PCM frames to queue - adjust as necessary per-target */
36#define VOICE_FRAMES 4 37#define VOICE_FRAMES 4
@@ -327,6 +328,13 @@ void voice_wait(void)
327 sleep(1); 328 sleep(1);
328} 329}
329 330
331void voice_set_mixer_level(int percent)
332{
333 percent *= MIX_AMP_UNITY;
334 percent /= 100;
335 mixer_channel_set_amplitude(PCM_MIXER_CHAN_VOICE, percent);
336}
337
330/* Initialize voice thread data that must be valid upon starting and the 338/* Initialize voice thread data that must be valid upon starting and the
331 * setup the DSP parameters */ 339 * setup the DSP parameters */
332static void voice_data_init(struct voice_thread_data *td) 340static void voice_data_init(struct voice_thread_data *td)
@@ -337,7 +345,8 @@ static void voice_data_init(struct voice_thread_data *td)
337 dsp_configure(td->dsp, DSP_SET_SAMPLE_DEPTH, VOICE_SAMPLE_DEPTH); 345 dsp_configure(td->dsp, DSP_SET_SAMPLE_DEPTH, VOICE_SAMPLE_DEPTH);
338 dsp_configure(td->dsp, DSP_SET_STEREO_MODE, STEREO_MONO); 346 dsp_configure(td->dsp, DSP_SET_STEREO_MODE, STEREO_MONO);
339 347
340 mixer_channel_set_amplitude(PCM_MIXER_CHAN_VOICE, MIX_AMP_UNITY); 348 voice_set_mixer_level(global_settings.talk_mixer_amp);
349
341 voice_buf->td = td; 350 voice_buf->td = td;
342 td->dst = NULL; 351 td->dst = NULL;
343} 352}
diff --git a/apps/voice_thread.h b/apps/voice_thread.h
index 81b11eea37..c0122f0fb9 100644
--- a/apps/voice_thread.h
+++ b/apps/voice_thread.h
@@ -38,6 +38,8 @@ void voice_stop(void);
38void voice_thread_init(void); 38void voice_thread_init(void);
39void voice_thread_kill(void); 39void voice_thread_kill(void);
40 40
41void voice_set_mixer_level(int percent);
42
41#ifdef HAVE_PRIORITY_SCHEDULING 43#ifdef HAVE_PRIORITY_SCHEDULING
42void voice_thread_set_priority(int priority); 44void voice_thread_set_priority(int priority);
43#endif 45#endif
diff --git a/manual/configure_rockbox/voice.tex b/manual/configure_rockbox/voice.tex
index 582bd84178..c248feefb4 100644
--- a/manual/configure_rockbox/voice.tex
+++ b/manual/configure_rockbox/voice.tex
@@ -88,6 +88,10 @@
88 When this option is enabled the battery level is announced when it falls 88 When this option is enabled the battery level is announced when it falls
89 under 50\%, 30\% and 15\%. 89 under 50\%, 30\% and 15\%.
90 90
91 \item[Voice Volume Level.]
92 This allows you to specify the relative volume of the voice prompts as
93 a percentage of the main audio volume. It defaults to 100\%.
94
91 \end{description} 95 \end{description}
92 96
93See \wikilink{VoiceHowto} for more details on configuring speech support in Rockbox. 97See \wikilink{VoiceHowto} for more details on configuring speech support in Rockbox.