From 0f8aedbe9492a5226fddd4ad27dae21b8a39e1b4 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sun, 2 Dec 2012 01:09:44 -0500 Subject: Add a true waveform display to the oscilloscope plugin. * Adds some additional niftyness like a floating popup display that is implemented in an OSD library for use by other plugins. * Speed changes are now gradual for both views and follow a curve derived from some fiddling around to get a nice feel. * Refined a few behavioral things overall. It needs a bit of help from a direct PCM channel callback so it may capture PCM for waveform display. Also need a few other core routines to help out for the OSD. Messes with some keymaps. Some targets need keymaps to access the different views. Some devices can't support the additional view because it requires a large buffer ( > 1 s) for samples. If the plugin buffer is small, they can still use the popup display since the plugin is also much smaller in that case. Slow speed waveform needs some refining so it draws gradually like a real oscilloscope but I'll stick with what it is, for the moment. Change-Id: Ieb5b7922a2238264e9b19a58cb437739194eb036 Reviewed-on: http://gerrit.rockbox.org/245 Reviewed-by: Michael Sevakis Tested-by: Michael Sevakis --- firmware/export/pcm_mixer.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'firmware/export') diff --git a/firmware/export/pcm_mixer.h b/firmware/export/pcm_mixer.h index 69d2b894df..d424083002 100644 --- a/firmware/export/pcm_mixer.h +++ b/firmware/export/pcm_mixer.h @@ -106,7 +106,8 @@ enum channel_status mixer_channel_status(enum pcm_mixer_channel channel); size_t mixer_channel_get_bytes_waiting(enum pcm_mixer_channel channel); /* Return pointer to channel's playing audio data and the size remaining */ -const void * mixer_channel_get_buffer(enum pcm_mixer_channel channel, int *count); +const void * mixer_channel_get_buffer(enum pcm_mixer_channel channel, + int *count); /* Calculate peak values for channel */ void mixer_channel_calculate_peaks(enum pcm_mixer_channel channel, @@ -116,6 +117,13 @@ void mixer_channel_calculate_peaks(enum pcm_mixer_channel channel, void mixer_adjust_channel_address(enum pcm_mixer_channel channel, off_t offset); +/* Set a hook that is called upon getting a new source buffer for a channel + NOTE: Called for each buffer, not each mixer chunk */ +typedef void (*chan_buffer_hook_fn_type)(const void *start, size_t size); + +void mixer_channel_set_buffer_hook(enum pcm_mixer_channel channel, + chan_buffer_hook_fn_type fn); + /* Stop ALL channels and PCM and reset state */ void mixer_reset(void); -- cgit v1.2.3