mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 13:45:03 -05:00
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 <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
This commit is contained in:
parent
e1ea08417b
commit
0f8aedbe94
8 changed files with 2102 additions and 442 deletions
|
|
@ -45,6 +45,7 @@ struct mixer_channel
|
|||
pcm_play_callback_type get_more; /* Registered callback */
|
||||
enum channel_status status; /* Playback status */
|
||||
uint32_t amplitude; /* Amp. factor: 0x0000 = mute, 0x10000 = unity */
|
||||
chan_buffer_hook_fn_type buffer_hook; /* Callback for new buffer */
|
||||
};
|
||||
|
||||
/* Forget about boost here for the moment */
|
||||
|
|
@ -106,6 +107,12 @@ static void mixer_pcm_callback(const void **addr, size_t *size)
|
|||
*size = next_size;
|
||||
}
|
||||
|
||||
static inline void chan_call_buffer_hook(struct mixer_channel *chan)
|
||||
{
|
||||
if (UNLIKELY(chan->buffer_hook))
|
||||
chan->buffer_hook(chan->start, chan->size);
|
||||
}
|
||||
|
||||
/* Buffering callback - calls sub-callbacks and mixes the data for next
|
||||
buffer to be sent from mixer_pcm_callback() */
|
||||
static enum pcm_dma_status MIXER_CALLBACK_ICODE
|
||||
|
|
@ -149,6 +156,8 @@ fill_frame:
|
|||
channel_stopped(chan);
|
||||
continue;
|
||||
}
|
||||
|
||||
chan_call_buffer_hook(chan);
|
||||
}
|
||||
|
||||
/* Channel will play for at least part of this frame */
|
||||
|
|
@ -298,6 +307,7 @@ void mixer_channel_play_data(enum pcm_mixer_channel channel,
|
|||
chan->get_more = get_more;
|
||||
|
||||
mixer_activate_channel(chan);
|
||||
chan_call_buffer_hook(chan);
|
||||
mixer_start_pcm();
|
||||
}
|
||||
else
|
||||
|
|
@ -406,6 +416,18 @@ void mixer_adjust_channel_address(enum pcm_mixer_channel channel,
|
|||
pcm_play_unlock();
|
||||
}
|
||||
|
||||
/* Set a hook that is called upon getting a new source buffer for a channel
|
||||
NOTE: Called for each buffer, not each mixer chunk */
|
||||
void mixer_channel_set_buffer_hook(enum pcm_mixer_channel channel,
|
||||
chan_buffer_hook_fn_type fn)
|
||||
{
|
||||
struct mixer_channel *chan = &channels[channel];
|
||||
|
||||
pcm_play_lock();
|
||||
chan->buffer_hook = fn;
|
||||
pcm_play_unlock();
|
||||
}
|
||||
|
||||
/* Stop ALL channels and PCM and reset state */
|
||||
void mixer_reset(void)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue