forked from len0rd/rockbox
FFT plugin: Some speed regulation for too-fast targets. (50FPS)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26503 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
949d546fc8
commit
7e538995a5
1 changed files with 20 additions and 8 deletions
|
@ -1294,7 +1294,7 @@ static void fft_close_fft(void)
|
||||||
* target uses IRAM */
|
* target uses IRAM */
|
||||||
static bool fft_have_fft(void)
|
static bool fft_have_fft(void)
|
||||||
{
|
{
|
||||||
return fft_get_fft();
|
return rb->pcm_is_playing() && fft_get_fft();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void fft_free_fft_output(void)
|
static inline void fft_free_fft_output(void)
|
||||||
|
@ -1355,6 +1355,9 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
|
|
||||||
while (run)
|
while (run)
|
||||||
{
|
{
|
||||||
|
/* Unless otherwise specified, HZ/50 is around the window length
|
||||||
|
* and quite fast. We want to be done with drawing by this time. */
|
||||||
|
long next_frame_tick = *rb->current_tick + HZ/50;
|
||||||
int button;
|
int button;
|
||||||
|
|
||||||
while (!fft_have_fft())
|
while (!fft_have_fft())
|
||||||
|
@ -1378,13 +1381,13 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
lcd_(update)();
|
lcd_(update)();
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout = HZ/100;
|
timeout = HZ/100; /* 'till end of curent tick, don't use 100% CPU */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure the input thread has produced something before doing
|
/* Make sure the FFT has produced something before doing anything
|
||||||
* anything but watching for buttons. Music might not be playing
|
* but watching for buttons. Music might not be playing or things
|
||||||
* or things just aren't going well for picking up buffers so keys
|
* just aren't going well for picking up buffers so keys are
|
||||||
* are scanned to avoid lockup. */
|
* scanned to avoid lockup. */
|
||||||
button = rb->button_get_w_tmo(timeout);
|
button = rb->button_get_w_tmo(timeout);
|
||||||
if (button != BUTTON_NONE)
|
if (button != BUTTON_NONE)
|
||||||
goto read_button;
|
goto read_button;
|
||||||
|
@ -1394,9 +1397,18 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
|
|
||||||
fft_free_fft_output(); /* COP only */
|
fft_free_fft_output(); /* COP only */
|
||||||
|
|
||||||
rb->yield();
|
long tick = *rb->current_tick;
|
||||||
|
if(TIME_BEFORE(tick, next_frame_tick))
|
||||||
|
{
|
||||||
|
tick = next_frame_tick - tick;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rb->yield(); /* tmo = 0 won't yield */
|
||||||
|
tick = 0;
|
||||||
|
}
|
||||||
|
|
||||||
button = rb->button_get(false);
|
button = rb->button_get_w_tmo(tick);
|
||||||
read_button:
|
read_button:
|
||||||
switch (button)
|
switch (button)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue