summaryrefslogtreecommitdiff
path: root/apps/voice_thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/voice_thread.c')
-rw-r--r--apps/voice_thread.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index 46471c0d9b..7788f659b0 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -18,7 +18,7 @@
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include <sys/types.h> 21#include "config.h"
22#include "system.h" 22#include "system.h"
23#include "core_alloc.h" 23#include "core_alloc.h"
24#include "thread.h" 24#include "thread.h"
@@ -30,8 +30,7 @@
30#include "pcm_mixer.h" 30#include "pcm_mixer.h"
31#include "codecs/libspeex/speex/speex.h" 31#include "codecs/libspeex/speex/speex.h"
32 32
33/* Default number of native-frequency PCM frames to queue - adjust as 33/* Default number of PCM frames to queue - adjust as necessary per-target */
34 necessary per-target */
35#define VOICE_FRAMES 4 34#define VOICE_FRAMES 4
36 35
37/* Define any of these as "1" and uncomment the LOGF_ENABLE line to log 36/* Define any of these as "1" and uncomment the LOGF_ENABLE line to log
@@ -84,8 +83,8 @@ static struct queue_sender_list voice_queue_sender_list SHAREDBSS_ATTR;
84static int quiet_counter SHAREDDATA_ATTR = 0; 83static int quiet_counter SHAREDDATA_ATTR = 0;
85static bool voice_playing = false; 84static bool voice_playing = false;
86 85
87#define VOICE_PCM_FRAME_COUNT ((NATIVE_FREQUENCY*VOICE_FRAME_COUNT + \ 86#define VOICE_PCM_FRAME_COUNT ((PLAY_SAMPR_MAX*VOICE_FRAME_COUNT + \
88 VOICE_SAMPLE_RATE) / VOICE_SAMPLE_RATE) 87 VOICE_SAMPLE_RATE) / VOICE_SAMPLE_RATE)
89#define VOICE_PCM_FRAME_SIZE (VOICE_PCM_FRAME_COUNT*2*sizeof (int16_t)) 88#define VOICE_PCM_FRAME_SIZE (VOICE_PCM_FRAME_COUNT*2*sizeof (int16_t))
90 89
91/* Voice processing states */ 90/* Voice processing states */
@@ -356,11 +355,13 @@ static enum voice_state voice_message(struct voice_thread_data *td)
356 { 355 {
357 /* Stop any clip still playing */ 356 /* Stop any clip still playing */
358 voice_stop_playback(); 357 voice_stop_playback();
358 dsp_configure(td->dsp, DSP_FLUSH, 0);
359 } 359 }
360 360
361 if (quiet_counter <= 0) 361 if (quiet_counter <= 0)
362 { 362 {
363 voice_playing = true; 363 voice_playing = true;
364 dsp_configure(td->dsp, DSP_SET_OUT_FREQUENCY, mixer_get_frequency());
364 send_event(PLAYBACK_EVENT_VOICE_PLAYING, &voice_playing); 365 send_event(PLAYBACK_EVENT_VOICE_PLAYING, &voice_playing);
365 } 366 }
366 367