From 9e9da94b714dc3108bd06366e5f15f53602a0f08 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Mon, 10 Nov 2003 22:00:27 +0000 Subject: [PATCH] VU meter no longer starves the mpeg thread, and now uses a correct maximum level for the scaling git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4028 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/vu_meter.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c index e7e8d33ad8..712c7d18f4 100644 --- a/apps/plugins/vu_meter.c +++ b/apps/plugins/vu_meter.c @@ -53,7 +53,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) #define MAX_RIGHT_L 57 #define MAX_RIGHT_R 111 - #define MAX_PEAK 0x8FFF + #define MAX_PEAK 0x7FFF left_needle_top_x = (rb->mas_codec_readreg(0xC) * @@ -83,7 +83,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) rb->lcd_drawline(1, 53, 112, 53); /* These are the needle "covers" - we're going for that - "old fasioned" look */ + "old fashioned" look */ /* The left needle cover - organized from the top line to the bottom */ rb->lcd_drawline(27, 48, 29, 48); @@ -102,10 +102,13 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) rb->lcd_update(); - switch (rb->button_get(false)) + /* We must yield once in a while to make sure that the MPEG thread + isn't starved, but we use the shortest possible timeout for best + performance */ + switch (rb->button_get_w_tmo(HZ/HZ)) { case BUTTON_OFF: - return false; + return PLUGIN_OK; } } }