mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 05:35:02 -05:00
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
This commit is contained in:
parent
c533222851
commit
a1837d2d80
3 changed files with 28 additions and 0 deletions
|
|
@ -65,6 +65,12 @@
|
||||||
#include <strings.h> /* For strncasecmp() */
|
#include <strings.h> /* For strncasecmp() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USB_ENABLE_AUDIO
|
||||||
|
#include "usbstack/usb_audio.h"
|
||||||
|
#include "splash.h"
|
||||||
|
#include "lang.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* TODO: The audio thread really is doing multitasking of acting like a
|
/* TODO: The audio thread really is doing multitasking of acting like a
|
||||||
consumer and producer of tracks. It may be advantageous to better
|
consumer and producer of tracks. It may be advantageous to better
|
||||||
logically separate the two functions. I won't go that far just yet. */
|
logically separate the two functions. I won't go that far just yet. */
|
||||||
|
|
@ -2978,6 +2984,15 @@ static void audio_on_track_changed(void)
|
||||||
static void audio_start_playback(const struct audio_resume_info *resume_info,
|
static void audio_start_playback(const struct audio_resume_info *resume_info,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
/* NOTE: if USBAudio ever gets its own DSP channel, this block can go away! */
|
||||||
|
#ifdef USB_ENABLE_AUDIO
|
||||||
|
if (usb_audio_get_active())
|
||||||
|
{
|
||||||
|
splash(HZ*2, str(LANG_USB_DAC_ACTIVE));
|
||||||
|
queue_reply(&audio_queue, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
static struct audio_resume_info resume = { 0, 0 };
|
static struct audio_resume_info resume = { 0, 0 };
|
||||||
enum play_status old_status = play_status;
|
enum play_status old_status = play_status;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -398,6 +398,9 @@ int buffers_filled_max_last;
|
||||||
static int last_frame = 0;
|
static int last_frame = 0;
|
||||||
static int frames_dropped = 0;
|
static int frames_dropped = 0;
|
||||||
|
|
||||||
|
/* for blocking normal playback */
|
||||||
|
static bool usbaudio_active = false;
|
||||||
|
|
||||||
/* Schematic view of the RX situation:
|
/* Schematic view of the RX situation:
|
||||||
* (in case NR_BUFFERS = 4)
|
* (in case NR_BUFFERS = 4)
|
||||||
*
|
*
|
||||||
|
|
@ -1181,6 +1184,7 @@ void usb_audio_init_connection(void)
|
||||||
{
|
{
|
||||||
logf("usbaudio: init connection");
|
logf("usbaudio: init connection");
|
||||||
|
|
||||||
|
usbaudio_active = true;
|
||||||
dsp = dsp_get_config(CODEC_IDX_AUDIO);
|
dsp = dsp_get_config(CODEC_IDX_AUDIO);
|
||||||
dsp_configure(dsp, DSP_RESET, 0);
|
dsp_configure(dsp, DSP_RESET, 0);
|
||||||
dsp_configure(dsp, DSP_SET_STEREO_MODE, STEREO_INTERLEAVED);
|
dsp_configure(dsp, DSP_SET_STEREO_MODE, STEREO_INTERLEAVED);
|
||||||
|
|
@ -1202,6 +1206,12 @@ void usb_audio_disconnect(void)
|
||||||
|
|
||||||
usb_audio_stop_playback();
|
usb_audio_stop_playback();
|
||||||
usb_audio_free_buf();
|
usb_audio_free_buf();
|
||||||
|
usbaudio_active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool usb_audio_get_active(void)
|
||||||
|
{
|
||||||
|
return usbaudio_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool usb_audio_get_alloc_failed(void)
|
bool usb_audio_get_alloc_failed(void)
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#define USB_AUDIO_H
|
#define USB_AUDIO_H
|
||||||
|
|
||||||
#include "usb_ch9.h"
|
#include "usb_ch9.h"
|
||||||
|
#include "usb_class_driver.h"
|
||||||
|
|
||||||
/* NOTE
|
/* NOTE
|
||||||
*
|
*
|
||||||
|
|
@ -276,4 +277,6 @@ int usb_audio_get_frames_dropped(void);
|
||||||
*/
|
*/
|
||||||
int usb_audio_get_cur_volume(void);
|
int usb_audio_get_cur_volume(void);
|
||||||
|
|
||||||
|
bool usb_audio_get_active(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue