usbaudio: send through dsp (new)

Does not seem to affect UI usability, but allowable DSP loads will vary
based on device and playback sample rate.

To-Do (someday):
- Add dedicated DSP channel
- How to apply DSP settings to above new channel? (UI)
- How to lock out timestretch from being enabled?

Change-Id: Ia24d1055340354e2c32e6008e7e2b03a8e88867d
This commit is contained in:
Dana Conrad 2025-11-02 00:02:02 +00:00
parent 7c4293af64
commit c533222851
12 changed files with 94 additions and 31 deletions

View file

@ -33,11 +33,14 @@ struct dsp_loop_context
#endif
};
static inline void dsp_process_start(struct dsp_loop_context *ctx)
static inline void dsp_process_start(struct dsp_loop_context *ctx, bool thread_yield)
{
/* At least perform one yield before starting */
ctx->last_yield = current_tick;
yield();
if (thread_yield)
{
yield();
}
#if defined(CPU_COLDFIRE)
/* set emac unit for dsp processing, and save old macsr, we're running in
codec thread context at this point, so can't clobber it */
@ -46,14 +49,17 @@ static inline void dsp_process_start(struct dsp_loop_context *ctx)
#endif
}
static inline void dsp_process_loop(struct dsp_loop_context *ctx)
static inline void dsp_process_loop(struct dsp_loop_context *ctx, bool thread_yield)
{
/* Yield at least once each tick */
long tick = current_tick;
if (TIME_AFTER(tick, ctx->last_yield))
{
ctx->last_yield = tick;
yield();
if (thread_yield)
{
yield();
}
}
}
@ -66,12 +72,12 @@ static inline void dsp_process_end(struct dsp_loop_context *ctx)
(void)ctx;
}
#define DSP_PROCESS_START() \
#define DSP_PROCESS_START(yield) \
struct dsp_loop_context __ctx; \
dsp_process_start(&__ctx)
dsp_process_start(&__ctx, yield)
#define DSP_PROCESS_LOOP() \
dsp_process_loop(&__ctx)
#define DSP_PROCESS_LOOP(yield) \
dsp_process_loop(&__ctx, yield)
#define DSP_PROCESS_END() \
dsp_process_end(&__ctx)