From 207514fb2578cfac611b4ab98b251d1524a55efe Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sat, 6 Mar 2021 23:25:25 -0500 Subject: voice: Allow voice prompt volume to be configurable It defaults to 100%, allow it to be dialed back Change-Id: If997fb7d3057472a7fac0be4ae7d1e8fce654c49 --- apps/voice_thread.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'apps/voice_thread.c') 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; } -- cgit v1.2.3