summaryrefslogtreecommitdiff
path: root/apps
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 /apps
parentc16f9142f7224007eeca9e44731db95af2b17a8e (diff)
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.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
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 @@
</voice>
</phrase>
<phrase>
+ id: LANG_TALK_MIXER_LEVEL
+ desc: Relative volume of voice prompts
+ user: core
+ <source>
+ *: "Voice prompt volume"
+ </source>
+ <dest>
+ *: "Voice prompt volume"
+ </dest>
+ <voice>
+ *: "Voice prompt volume"
+ </voice>
+</phrase>
+<phrase>
id: LANG_VOICE_FILETYPE
desc: voice settings menu
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,
MENUITEM_SETTING(talk_filetype_item, &global_settings.talk_filetype, NULL);
MENUITEM_SETTING(talk_battery_level_item,
&global_settings.talk_battery_level, NULL);
+MENUITEM_SETTING(talk_mixer_amp_item, &global_settings.talk_mixer_amp, NULL);
MAKE_MENU(voice_settings_menu, ID2P(LANG_VOICE), 0, Icon_Voice,
&talk_menu_item, &talk_dir_item, &talk_dir_clip_item,
&talk_file_item, &talk_file_clip_item, &talk_filetype_item,
- &talk_battery_level_item);
+ &talk_battery_level_item, &talk_mixer_amp_item);
/* VOICE MENU */
/***********************************/
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
bool talk_file_clip; /* use file .talk clips */
bool talk_filetype; /* say file type */
bool talk_battery_level;
+ int talk_mixer_amp; /* Relative volume of voices, MIX_AMP_MPUTE->MIX_AMP_UNITY */
/* file browser sorting */
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 @@
#include "onplay.h"
#endif
+#include "voice_thread.h"
+
#if defined(DX50) || defined(DX90)
#include "governor-ibasso.h"
#include "usb-ibasso.h"
@@ -1327,6 +1329,8 @@ const struct settings_list settings[] = {
"talk filetype", NULL),
OFFON_SETTING(F_TEMPVAR, talk_battery_level, LANG_TALK_BATTERY_LEVEL, false,
"Announce Battery Level", NULL),
+ INT_SETTING(0, talk_mixer_amp, LANG_TALK_MIXER_LEVEL, 100,
+ "talk mixer level", UNIT_PERCENT, 0, 100, 5, NULL, NULL, voice_set_mixer_level),
#ifdef HAVE_RECORDING
/* 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 @@
#include "pcm.h"
#include "pcm_mixer.h"
#include "codecs/libspeex/speex/speex.h"
+#include "settings.h"
/* Default number of PCM frames to queue - adjust as necessary per-target */
#define VOICE_FRAMES 4
@@ -327,6 +328,13 @@ void voice_wait(void)
sleep(1);
}
+void voice_set_mixer_level(int percent)
+{
+ percent *= MIX_AMP_UNITY;
+ percent /= 100;
+ mixer_channel_set_amplitude(PCM_MIXER_CHAN_VOICE, percent);
+}
+
/* Initialize voice thread data that must be valid upon starting and the
* setup the DSP parameters */
static void voice_data_init(struct voice_thread_data *td)
@@ -337,7 +345,8 @@ static void voice_data_init(struct voice_thread_data *td)
dsp_configure(td->dsp, DSP_SET_SAMPLE_DEPTH, VOICE_SAMPLE_DEPTH);
dsp_configure(td->dsp, DSP_SET_STEREO_MODE, STEREO_MONO);
- mixer_channel_set_amplitude(PCM_MIXER_CHAN_VOICE, MIX_AMP_UNITY);
+ voice_set_mixer_level(global_settings.talk_mixer_amp);
+
voice_buf->td = td;
td->dst = NULL;
}
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);
void voice_thread_init(void);
void voice_thread_kill(void);
+void voice_set_mixer_level(int percent);
+
#ifdef HAVE_PRIORITY_SCHEDULING
void voice_thread_set_priority(int priority);
#endif