voice: Allow voice prompt volume to be configurable
It defaults to 100%, allow it to be dialed back Change-Id: If997fb7d3057472a7fac0be4ae7d1e8fce654c49
This commit is contained in:
parent
c16f9142f7
commit
207514fb25
7 changed files with 37 additions and 2 deletions
|
@ -9499,6 +9499,20 @@
|
|||
*: "Announce Battery Level"
|
||||
</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
|
||||
|
|
|
@ -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 */
|
||||
/***********************************/
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -88,6 +88,10 @@
|
|||
When this option is enabled the battery level is announced when it falls
|
||||
under 50\%, 30\% and 15\%.
|
||||
|
||||
\item[Voice Volume Level.]
|
||||
This allows you to specify the relative volume of the voice prompts as
|
||||
a percentage of the main audio volume. It defaults to 100\%.
|
||||
|
||||
\end{description}
|
||||
|
||||
See \wikilink{VoiceHowto} for more details on configuring speech support in Rockbox.
|
||||
|
|
Loading…
Reference in a new issue