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

usbaudio: block playback while usbaudio is active

Needed due to us commandeering the AUDIO DSP "channel" for USBAudio.
If/When we add another DSP channel, this can be reverted.

Works, but still goes to a "blank" WPS screen for a split second before
cancelling out.

Change-Id: I5fb8a1e226b4d3e46c86c59d593d807f49d7a35f

+28
+15
apps/playback.c
··· 65 65 #include <strings.h> /* For strncasecmp() */ 66 66 #endif 67 67 68 + #ifdef USB_ENABLE_AUDIO 69 + #include "usbstack/usb_audio.h" 70 + #include "splash.h" 71 + #include "lang.h" 72 + #endif 73 + 68 74 /* TODO: The audio thread really is doing multitasking of acting like a 69 75 consumer and producer of tracks. It may be advantageous to better 70 76 logically separate the two functions. I won't go that far just yet. */ ··· 2978 2984 static void audio_start_playback(const struct audio_resume_info *resume_info, 2979 2985 unsigned int flags) 2980 2986 { 2987 + /* NOTE: if USBAudio ever gets its own DSP channel, this block can go away! */ 2988 + #ifdef USB_ENABLE_AUDIO 2989 + if (usb_audio_get_active()) 2990 + { 2991 + splash(HZ*2, str(LANG_USB_DAC_ACTIVE)); 2992 + queue_reply(&audio_queue, 0); 2993 + return; 2994 + } 2995 + #endif 2981 2996 static struct audio_resume_info resume = { 0, 0 }; 2982 2997 enum play_status old_status = play_status; 2983 2998
+10
firmware/usbstack/usb_audio.c
··· 398 398 static int last_frame = 0; 399 399 static int frames_dropped = 0; 400 400 401 + /* for blocking normal playback */ 402 + static bool usbaudio_active = false; 403 + 401 404 /* Schematic view of the RX situation: 402 405 * (in case NR_BUFFERS = 4) 403 406 * ··· 1181 1184 { 1182 1185 logf("usbaudio: init connection"); 1183 1186 1187 + usbaudio_active = true; 1184 1188 dsp = dsp_get_config(CODEC_IDX_AUDIO); 1185 1189 dsp_configure(dsp, DSP_RESET, 0); 1186 1190 dsp_configure(dsp, DSP_SET_STEREO_MODE, STEREO_INTERLEAVED); ··· 1202 1206 1203 1207 usb_audio_stop_playback(); 1204 1208 usb_audio_free_buf(); 1209 + usbaudio_active = false; 1210 + } 1211 + 1212 + bool usb_audio_get_active(void) 1213 + { 1214 + return usbaudio_active; 1205 1215 } 1206 1216 1207 1217 bool usb_audio_get_alloc_failed(void)
+3
firmware/usbstack/usb_audio.h
··· 20 20 #define USB_AUDIO_H 21 21 22 22 #include "usb_ch9.h" 23 + #include "usb_class_driver.h" 23 24 24 25 /* NOTE 25 26 * ··· 275 276 * Return current audio volume in db 276 277 */ 277 278 int usb_audio_get_cur_volume(void); 279 + 280 + bool usb_audio_get_active(void); 278 281 279 282 #endif