diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2003-12-23 22:24:48 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2003-12-23 22:24:48 +0000 |
commit | 2d720b2a7968666bfc315026c8a69b8a762aa058 (patch) | |
tree | eabe756f60a5049c0697d0dad3af28c5d850ab44 /apps/plugins/vu_meter.c | |
parent | 9aad0db9df7716fe4e2997bca09e8a0a46889b84 (diff) | |
download | rockbox-2d720b2a7968666bfc315026c8a69b8a762aa058.tar.gz rockbox-2d720b2a7968666bfc315026c8a69b8a762aa058.zip |
I found several plugins to draw beyond screen boundary
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4176 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/vu_meter.c')
-rw-r--r-- | apps/plugins/vu_meter.c | 118 |
1 files changed, 117 insertions, 1 deletions
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c index 268f4b161a..677d41886d 100644 --- a/apps/plugins/vu_meter.c +++ b/apps/plugins/vu_meter.c | |||
@@ -1,116 +1,232 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | |||
2 | * __________ __ ___. | 3 | * __________ __ ___. |
4 | |||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | 5 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
6 | |||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | 7 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
8 | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 9 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
10 | |||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 11 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
12 | |||
7 | * \/ \/ \/ \/ \/ | 13 | * \/ \/ \/ \/ \/ |
14 | |||
8 | * | 15 | * |
16 | |||
9 | * Copyright (C) 2003 Lee Pilgrim | 17 | * Copyright (C) 2003 Lee Pilgrim |
18 | |||
10 | * | 19 | * |
20 | |||
11 | * All files in this archive are subject to the GNU General Public License. | 21 | * All files in this archive are subject to the GNU General Public License. |
22 | |||
12 | * See the file COPYING in the source tree root for full license agreement. | 23 | * See the file COPYING in the source tree root for full license agreement. |
24 | |||
13 | * | 25 | * |
26 | |||
14 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | 27 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
28 | |||
15 | * KIND, either express or implied. | 29 | * KIND, either express or implied. |
30 | |||
16 | * | 31 | * |
32 | |||
17 | **************************************************************************/ | 33 | **************************************************************************/ |
34 | |||
18 | #ifndef SIMULATOR /* The simulator dosen't have a MAS */ | 35 | #ifndef SIMULATOR /* The simulator dosen't have a MAS */ |
36 | |||
19 | #include "plugin.h" | 37 | #include "plugin.h" |
20 | 38 | ||
39 | |||
40 | |||
21 | #ifdef HAVE_LCD_BITMAP | 41 | #ifdef HAVE_LCD_BITMAP |
22 | 42 | ||
43 | |||
44 | |||
23 | static struct plugin_api* rb; | 45 | static struct plugin_api* rb; |
24 | 46 | ||
47 | |||
48 | |||
25 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 49 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
50 | |||
26 | { | 51 | { |
52 | |||
27 | TEST_PLUGIN_API(api); | 53 | TEST_PLUGIN_API(api); |
54 | |||
28 | (void) parameter; | 55 | (void) parameter; |
56 | |||
29 | rb = api; | 57 | rb = api; |
30 | 58 | ||
59 | |||
60 | |||
31 | /* | 61 | /* |
62 | |||
32 | I hope to make (left/right)_needle_top_y change some day (because it looks | 63 | I hope to make (left/right)_needle_top_y change some day (because it looks |
64 | |||
33 | like it is stretching) so that is why it is a int and not a #define. | 65 | like it is stretching) so that is why it is a int and not a #define. |
66 | |||
34 | */ | 67 | */ |
68 | |||
35 | #define LEFT_NEEDLE_BOTTOM_X 28 | 69 | #define LEFT_NEEDLE_BOTTOM_X 28 |
70 | |||
36 | #define LEFT_NEEDLE_BOTTOM_Y 53 | 71 | #define LEFT_NEEDLE_BOTTOM_Y 53 |
72 | |||
37 | int left_needle_top_x; | 73 | int left_needle_top_x; |
74 | |||
38 | int left_needle_top_y = 18; | 75 | int left_needle_top_y = 18; |
39 | 76 | ||
77 | |||
78 | |||
40 | #define RIGHT_NEEDLE_BOTTOM_X 84 | 79 | #define RIGHT_NEEDLE_BOTTOM_X 84 |
80 | |||
41 | #define RIGHT_NEEDLE_BOTTOM_Y 53 | 81 | #define RIGHT_NEEDLE_BOTTOM_Y 53 |
82 | |||
42 | int right_needle_top_x; | 83 | int right_needle_top_x; |
84 | |||
43 | int right_needle_top_y = 18; | 85 | int right_needle_top_y = 18; |
44 | 86 | ||
87 | |||
88 | |||
45 | while (!PLUGIN_OK) | 89 | while (!PLUGIN_OK) |
90 | |||
46 | { | 91 | { |
92 | |||
47 | /* These are to define how far the tip of the needles can go to the | 93 | /* These are to define how far the tip of the needles can go to the |
94 | |||
48 | left and right. The names are a bit confusing. The LEFT/RIGHT tells | 95 | left and right. The names are a bit confusing. The LEFT/RIGHT tells |
96 | |||
49 | which needle it is for, and the L/R at the end tells which side | 97 | which needle it is for, and the L/R at the end tells which side |
98 | |||
50 | of the needle. */ | 99 | of the needle. */ |
100 | |||
51 | #define MAX_LEFT_L 2 | 101 | #define MAX_LEFT_L 2 |
102 | |||
52 | #define MAX_LEFT_R 55 | 103 | #define MAX_LEFT_R 55 |
104 | |||
53 | #define MAX_RIGHT_L 57 | 105 | #define MAX_RIGHT_L 57 |
106 | |||
54 | #define MAX_RIGHT_R 111 | 107 | #define MAX_RIGHT_R 111 |
55 | 108 | ||
109 | |||
110 | |||
56 | #define MAX_PEAK 0x7FFF | 111 | #define MAX_PEAK 0x7FFF |
57 | 112 | ||
113 | |||
114 | |||
58 | left_needle_top_x = | 115 | left_needle_top_x = |
116 | |||
59 | (rb->mas_codec_readreg(0xC) * | 117 | (rb->mas_codec_readreg(0xC) * |
118 | |||
60 | (MAX_LEFT_R - MAX_LEFT_L) / MAX_PEAK) + MAX_LEFT_L; | 119 | (MAX_LEFT_R - MAX_LEFT_L) / MAX_PEAK) + MAX_LEFT_L; |
120 | |||
61 | 121 | ||
122 | |||
62 | right_needle_top_x = | 123 | right_needle_top_x = |
124 | |||
63 | (rb->mas_codec_readreg(0xD) * | 125 | (rb->mas_codec_readreg(0xD) * |
126 | |||
64 | (MAX_RIGHT_R - MAX_RIGHT_L) / MAX_PEAK) + MAX_RIGHT_L; | 127 | (MAX_RIGHT_R - MAX_RIGHT_L) / MAX_PEAK) + MAX_RIGHT_L; |
65 | 128 | ||
129 | |||
130 | |||
66 | /* Time to draw all of the display stuff! | 131 | /* Time to draw all of the display stuff! |
132 | |||
67 | Could I move some of these out of the loop so they don't have to | 133 | Could I move some of these out of the loop so they don't have to |
134 | |||
68 | be re-drawn everytime, but still be displayed, or would that | 135 | be re-drawn everytime, but still be displayed, or would that |
136 | |||
69 | improve performance any at all? */ | 137 | improve performance any at all? */ |
138 | |||
70 | rb->lcd_clear_display(); | 139 | rb->lcd_clear_display(); |
71 | 140 | ||
141 | |||
142 | |||
72 | rb->lcd_drawline(LEFT_NEEDLE_BOTTOM_X, LEFT_NEEDLE_BOTTOM_Y, | 143 | rb->lcd_drawline(LEFT_NEEDLE_BOTTOM_X, LEFT_NEEDLE_BOTTOM_Y, |
144 | |||
73 | left_needle_top_x, left_needle_top_y); | 145 | left_needle_top_x, left_needle_top_y); |
146 | |||
74 | rb->lcd_drawline(RIGHT_NEEDLE_BOTTOM_X, RIGHT_NEEDLE_BOTTOM_Y, | 147 | rb->lcd_drawline(RIGHT_NEEDLE_BOTTOM_X, RIGHT_NEEDLE_BOTTOM_Y, |
148 | |||
75 | right_needle_top_x, right_needle_top_y); | 149 | right_needle_top_x, right_needle_top_y); |
76 | 150 | ||
151 | |||
152 | |||
77 | rb->lcd_setfont(FONT_SYSFIXED); | 153 | rb->lcd_setfont(FONT_SYSFIXED); |
154 | |||
78 | rb->lcd_putsxy(30, 1, "VU Meter"); | 155 | rb->lcd_putsxy(30, 1, "VU Meter"); |
79 | 156 | ||
157 | |||
158 | |||
80 | /* The first is the line under "VU Meter" and the second is under | 159 | /* The first is the line under "VU Meter" and the second is under |
160 | |||
81 | the needles. */ | 161 | the needles. */ |
162 | |||
82 | rb->lcd_drawline(30, 9, 77, 9); | 163 | rb->lcd_drawline(30, 9, 77, 9); |
83 | rb->lcd_drawline(1, 53, 112, 53); | 164 | |
165 | rb->lcd_drawline(0, 53, 111, 53); | ||
166 | |||
167 | |||
84 | 168 | ||
85 | /* These are the needle "covers" - we're going for that | 169 | /* These are the needle "covers" - we're going for that |
170 | |||
86 | "old fashioned" look */ | 171 | "old fashioned" look */ |
87 | 172 | ||
173 | |||
174 | |||
88 | /* The left needle cover - organized from the top line to the bottom */ | 175 | /* The left needle cover - organized from the top line to the bottom */ |
176 | |||
89 | rb->lcd_drawline(27, 48, 29, 48); | 177 | rb->lcd_drawline(27, 48, 29, 48); |
178 | |||
90 | rb->lcd_drawline(25, 49, 31, 49); | 179 | rb->lcd_drawline(25, 49, 31, 49); |
180 | |||
91 | rb->lcd_drawline(23, 50, 33, 50); | 181 | rb->lcd_drawline(23, 50, 33, 50); |
182 | |||
92 | rb->lcd_drawline(22, 51, 34, 51); | 183 | rb->lcd_drawline(22, 51, 34, 51); |
184 | |||
93 | rb->lcd_drawline(22, 52, 34, 52); | 185 | rb->lcd_drawline(22, 52, 34, 52); |
94 | 186 | ||
187 | |||
188 | |||
95 | /* The right needle cover - organized from the top line to | 189 | /* The right needle cover - organized from the top line to |
190 | |||
96 | the bottom */ | 191 | the bottom */ |
192 | |||
97 | rb->lcd_drawline(83, 48, 85, 48); | 193 | rb->lcd_drawline(83, 48, 85, 48); |
194 | |||
98 | rb->lcd_drawline(81, 49, 87, 49); | 195 | rb->lcd_drawline(81, 49, 87, 49); |
196 | |||
99 | rb->lcd_drawline(79, 50, 89, 50); | 197 | rb->lcd_drawline(79, 50, 89, 50); |
198 | |||
100 | rb->lcd_drawline(78, 51, 90, 51); | 199 | rb->lcd_drawline(78, 51, 90, 51); |
200 | |||
101 | rb->lcd_drawline(78, 52, 90, 52); | 201 | rb->lcd_drawline(78, 52, 90, 52); |
102 | 202 | ||
203 | |||
204 | |||
103 | rb->lcd_update(); | 205 | rb->lcd_update(); |
104 | 206 | ||
207 | |||
208 | |||
105 | /* We must yield once in a while to make sure that the MPEG thread | 209 | /* We must yield once in a while to make sure that the MPEG thread |
210 | |||
106 | isn't starved, but we use the shortest possible timeout for best | 211 | isn't starved, but we use the shortest possible timeout for best |
212 | |||
107 | performance */ | 213 | performance */ |
214 | |||
108 | switch (rb->button_get_w_tmo(1)) | 215 | switch (rb->button_get_w_tmo(1)) |
216 | |||
109 | { | 217 | { |
218 | |||
110 | case BUTTON_OFF: | 219 | case BUTTON_OFF: |
220 | |||
111 | return PLUGIN_OK; | 221 | return PLUGIN_OK; |
222 | |||
112 | } | 223 | } |
224 | |||
113 | } | 225 | } |
226 | |||
114 | } | 227 | } |
228 | |||
115 | #endif /* HAVE_LCD_BITMAP */ | 229 | #endif /* HAVE_LCD_BITMAP */ |
230 | |||
116 | #endif /* #ifndef SIMULATOR */ | 231 | #endif /* #ifndef SIMULATOR */ |
232 | |||