diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2010-06-03 04:21:27 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2010-06-03 04:21:27 +0000 |
| commit | 7e538995a57f8036c52800deb694ecd108172e2d (patch) | |
| tree | 1f78435192dbcfcb29bac8dce351d2ee6bad3384 /apps | |
| parent | 949d546fc85d064b2ccd039f3db21ef335d3390b (diff) | |
| download | rockbox-7e538995a57f8036c52800deb694ecd108172e2d.zip rockbox-7e538995a57f8036c52800deb694ecd108172e2d.tar.gz rockbox-7e538995a57f8036c52800deb694ecd108172e2d.tar.bz2 rockbox-7e538995a57f8036c52800deb694ecd108172e2d.tar.xz | |
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
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/plugins/fft/fft.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c index 23c37fb..dc118ec 100644 --- a/apps/plugins/fft/fft.c +++ b/apps/plugins/fft/fft.c @@ -1294,7 +1294,7 @@ static void fft_close_fft(void) * target uses IRAM */ 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) @@ -1355,6 +1355,9 @@ enum plugin_status plugin_start(const void* parameter) 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; while (!fft_have_fft()) @@ -1378,13 +1381,13 @@ enum plugin_status plugin_start(const void* parameter) 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 - * anything but watching for buttons. Music might not be playing - * or things just aren't going well for picking up buffers so keys - * are scanned to avoid lockup. */ + /* Make sure the FFT has produced something before doing anything + * but watching for buttons. Music might not be playing or things + * just aren't going well for picking up buffers so keys are + * scanned to avoid lockup. */ button = rb->button_get_w_tmo(timeout); if (button != BUTTON_NONE) goto read_button; @@ -1394,9 +1397,18 @@ enum plugin_status plugin_start(const void* parameter) 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: switch (button) { |