pcm_mixer: introduce mixer_buffer_cbs

intended to add sampr_changed callback to buffer hook as well as mixer
playback

Change-Id: I9df6194a884cfb813342a827b7fdc3bccbe3d60c
This commit is contained in:
mojyack 2026-02-24 16:39:42 +09:00 committed by Solomon Peachy
parent cb04b8167c
commit e2040cc98c
5 changed files with 44 additions and 30 deletions

View file

@ -1441,6 +1441,10 @@ static void waveform_buffer_callback(const void *start, size_t size)
waveform_buffer_have = have + copy;
}
static const struct mixer_buffer_cbs buf_cbs = {
.next_buffer = waveform_buffer_callback,
};
static void waveform_buffer_reset(void)
{
/* only called when callback is off */
@ -1909,7 +1913,7 @@ static void graphmode_setup(void)
if (osc.graphmode == GRAPH_WAVEFORM)
{
rb->mixer_channel_set_buffer_hook(channel,
waveform_buffer_callback);
&buf_cbs);
#ifdef HAVE_SCHEDULER_BOOSTCTRL
rb->trigger_cpu_boost(); /* Just looks better */
#endif
@ -2013,7 +2017,7 @@ void switch_channel(enum pcm_mixer_channel new_channel)
#ifdef OSCILLOSCOPE_GRAPHMODE
if (osc.graphmode == GRAPH_WAVEFORM)
rb->mixer_channel_set_buffer_hook(channel, waveform_buffer_callback);
rb->mixer_channel_set_buffer_hook(channel, &buf_cbs);
#endif
}
#endif /* USB_ENABLE_AUDIO */