diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2021-03-06 23:25:25 -0500 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-03-07 12:51:36 +0000 |
commit | 207514fb2578cfac611b4ab98b251d1524a55efe (patch) | |
tree | 581cea233e7d0d5a1b0356552c1201ce1ca4bdd4 /apps | |
parent | c16f9142f7224007eeca9e44731db95af2b17a8e (diff) | |
download | rockbox-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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/english.lang | 14 | ||||
-rw-r--r-- | apps/menus/settings_menu.c | 3 | ||||
-rw-r--r-- | apps/settings.h | 1 | ||||
-rw-r--r-- | apps/settings_list.c | 4 | ||||
-rw-r--r-- | apps/voice_thread.c | 11 | ||||
-rw-r--r-- | apps/voice_thread.h | 2 |
6 files changed, 33 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, | |||
709 | MENUITEM_SETTING(talk_filetype_item, &global_settings.talk_filetype, NULL); | 709 | MENUITEM_SETTING(talk_filetype_item, &global_settings.talk_filetype, NULL); |
710 | MENUITEM_SETTING(talk_battery_level_item, | 710 | MENUITEM_SETTING(talk_battery_level_item, |
711 | &global_settings.talk_battery_level, NULL); | 711 | &global_settings.talk_battery_level, NULL); |
712 | MENUITEM_SETTING(talk_mixer_amp_item, &global_settings.talk_mixer_amp, NULL); | ||
712 | MAKE_MENU(voice_settings_menu, ID2P(LANG_VOICE), 0, Icon_Voice, | 713 | MAKE_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 | ||
331 | void 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 */ |
332 | static void voice_data_init(struct voice_thread_data *td) | 340 | static 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); | |||
38 | void voice_thread_init(void); | 38 | void voice_thread_init(void); |
39 | void voice_thread_kill(void); | 39 | void voice_thread_kill(void); |
40 | 40 | ||
41 | void voice_set_mixer_level(int percent); | ||
42 | |||
41 | #ifdef HAVE_PRIORITY_SCHEDULING | 43 | #ifdef HAVE_PRIORITY_SCHEDULING |
42 | void voice_thread_set_priority(int priority); | 44 | void voice_thread_set_priority(int priority); |
43 | #endif | 45 | #endif |