A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

Get voice event out of playback.c

Purpose: A step in removing all voice references from playback code
and prelude to other changes.

Change-Id: Ic3ad7f7a33b979693e18a3456ced37eb1d2281a4

+19 -12
+5 -1
apps/appevents.h
··· 52 52 /* Next track medadata was just loaded 53 53 data = &(struct track_event){} */ 54 54 PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, 55 + }; 56 + 57 + /** VOICE events **/ 58 + enum { 55 59 /* Voice is playing 56 60 data = &(bool){true|false} */ 57 - PLAYBACK_EVENT_VOICE_PLAYING, 61 + VOICE_EVENT_IS_PLAYING = (EVENT_CLASS_VOICE|1), 58 62 }; 59 63 60 64 /** Buffering events **/
+11
apps/audio_thread.c
··· 27 27 #include "usb.h" 28 28 #include "pcm.h" 29 29 #include "sound.h" 30 + #include "pcmbuf.h" 31 + #include "appevents.h" 30 32 #include "audio_thread.h" 31 33 #ifdef AUDIO_HAVE_RECORDING 32 34 #include "pcm_record.h" ··· 108 110 } 109 111 } 110 112 113 + void audio_voice_event(unsigned short id, void *data) 114 + { 115 + (void)id; 116 + /* Make audio play softly while voice is speaking */ 117 + pcmbuf_soft_mode(*(bool *)data); 118 + } 119 + 111 120 void audio_queue_post(long id, intptr_t data) 112 121 { 113 122 queue_post(&audio_queue, id, data); ··· 169 178 #ifdef AUDIO_HAVE_RECORDING 170 179 recording_init(); 171 180 #endif 181 + 182 + add_event(VOICE_EVENT_IS_PLAYING, audio_voice_event); 172 183 173 184 /* Probably safe to say */ 174 185 audio_is_initialized = true;
-9
apps/playback.c
··· 355 355 356 356 /**************************************/ 357 357 358 - /** --- voice event --- **/ 359 - void playback_voice_event(unsigned short id, void *data) 360 - { 361 - (void)id; 362 - /* Make audio play softly while voice is speaking */ 363 - pcmbuf_soft_mode(*(bool *)data); 364 - } 365 - 366 358 /** --- MP3Entry --- **/ 367 359 368 360 /* Does the mp3entry have enough info for us to use it? */ ··· 3888 3880 track_list_init(); 3889 3881 buffering_init(); 3890 3882 pcmbuf_update_frequency(); 3891 - add_event(PLAYBACK_EVENT_VOICE_PLAYING, playback_voice_event); 3892 3883 #ifdef HAVE_CROSSFADE 3893 3884 /* Set crossfade setting for next buffer init which should be about... */ 3894 3885 pcmbuf_request_crossfade_enable(global_settings.crossfade);
+2 -2
apps/voice_thread.c
··· 372 372 { 373 373 voice_playing = true; 374 374 dsp_configure(td->dsp, DSP_SET_OUT_FREQUENCY, mixer_get_frequency()); 375 - send_event(PLAYBACK_EVENT_VOICE_PLAYING, &voice_playing); 375 + send_event(VOICE_EVENT_IS_PLAYING, &voice_playing); 376 376 } 377 377 378 378 quiet_counter = QUIET_COUNT; ··· 406 406 if (quiet_counter <= 0) 407 407 { 408 408 voice_playing = false; 409 - send_event(PLAYBACK_EVENT_VOICE_PLAYING, &voice_playing); 409 + send_event(VOICE_EVENT_IS_PLAYING, &voice_playing); 410 410 } 411 411 break; 412 412 }
+1
firmware/export/events.h
··· 51 51 #define EVENT_CLASS_GUI 0x0800 52 52 #define EVENT_CLASS_RECORDING 0x1000 53 53 #define EVENT_CLASS_LCD 0x2000 54 + #define EVENT_CLASS_VOICE 0x4000 54 55 55 56 /** 56 57 * Subscribe to an event with a simple callback. The callback will be called