From e62cb566448ebb56e2b0ddcaea5fe90532d24488 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 31 May 2013 18:45:51 -0400 Subject: Have voice fire an event when it starts and stops playing. Further decouples voice_thread.c from other playback areas. Also allows other audio sources, such as FM radio, to be attenuated when voice is playing by implementing a callback. Defined as another playback event rather than a new event class: PLAYBACK_EVENT_VOICE_PLAYING Change-Id: I2e3e218be6cd6bebbf39e7883a8c0e4ed42b62bb --- apps/playback.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'apps/playback.c') diff --git a/apps/playback.c b/apps/playback.c index 870cb08d17..9cc29ea2d8 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -344,6 +344,12 @@ void audio_pcmbuf_sync_position(void); /**************************************/ +/** --- voice event --- **/ +void playback_voice_event(void *data) +{ + pcmbuf_soft_mode(*(bool *)data); +} + /** --- audio_queue helpers --- **/ static void audio_queue_post(long id, intptr_t data) { @@ -3760,6 +3766,7 @@ void playback_init(void) mutex_init(&id3_mutex); track_list_init(); buffering_init(); + add_event(PLAYBACK_EVENT_VOICE_PLAYING, false, playback_voice_event); #ifdef HAVE_CROSSFADE /* Set crossfade setting for next buffer init which should be about... */ pcmbuf_request_crossfade_enable(global_settings.crossfade); -- cgit v1.2.3