summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2006-01-10 02:51:50 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2006-01-10 02:51:50 +0000
commit81c9d58c4e6c6b35eb16954d9f9c0c9ce8465be7 (patch)
treee0fc2e371a7666a105c8e09f0e1f7946c59f087d /apps
parent6422d07fa784de20f06b77f3081a4eac8e2ded12 (diff)
downloadrockbox-81c9d58c4e6c6b35eb16954d9f9c0c9ce8465be7.tar.gz
rockbox-81c9d58c4e6c6b35eb16954d9f9c0c9ce8465be7.zip
Metronome plugin for iriver targets, by Sebastian Henriksen, Martin Scarratt and me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8319 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/SOURCES1
-rw-r--r--apps/plugins/metronome.c739
2 files changed, 691 insertions, 49 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index 2f02506912..5bb84a7a0a 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -32,6 +32,7 @@ flipit.c
32grayscale.c 32grayscale.c
33jpeg.c 33jpeg.c
34mandelbrot.c 34mandelbrot.c
35metronome.c
35minesweeper.c 36minesweeper.c
36oscillograph.c 37oscillograph.c
37oscilloscope.c 38oscilloscope.c
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c
index 861eebf3aa..bf1a1a31e1 100644
--- a/apps/plugins/metronome.c
+++ b/apps/plugins/metronome.c
@@ -19,7 +19,6 @@
19#include "plugin.h" 19#include "plugin.h"
20 20
21#if !defined(SIMULATOR) 21#if !defined(SIMULATOR)
22/* only do this for targets with MAS */
23 22
24/* variable button definitions */ 23/* variable button definitions */
25#if CONFIG_KEYPAD == RECORDER_PAD 24#if CONFIG_KEYPAD == RECORDER_PAD
@@ -47,15 +46,25 @@
47#define METRONOME_VOL_DOWN (BUTTON_ON | BUTTON_LEFT) 46#define METRONOME_VOL_DOWN (BUTTON_ON | BUTTON_LEFT)
48#define METRONOME_TAP BUTTON_ON 47#define METRONOME_TAP BUTTON_ON
49 48
50#elif CONFIG_KEYPAD == IRIVER_H100_PAD 49#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
51#define METRONOME_QUIT BUTTON_OFF 50#define METRONOME_QUIT BUTTON_OFF
52#define METRONOME_PLAYPAUSE BUTTON_ON 51#define METRONOME_PLAYPAUSE BUTTON_ON
53#define METRONOME_VOL_UP BUTTON_UP 52#define METRONOME_VOL_UP BUTTON_UP
54#define METRONOME_VOL_DOWN BUTTON_DOWN 53#define METRONOME_VOL_DOWN BUTTON_DOWN
55#define METRONOME_TAP BUTTON_SELECT 54#define METRONOME_TAP BUTTON_SELECT
55#define METRONOME_SYNC BUTTON_REC
56#define METRONOME_MSG_START "press play" 56#define METRONOME_MSG_START "press play"
57#define METRONOME_MSG_STOP "press pause" 57#define METRONOME_MSG_STOP "press pause"
58#endif 58#endif
59
60#if CONFIG_REMOTE_KEYPAD == H100_REMOTE
61#define METRONOME_R_QUIT BUTTON_RC_STOP
62#define METRONOME_R_PLAYPAUSE BUTTON_RC_ON
63#define METRONOME_R_VOL_UP BUTTON_RC_VOL_UP
64#define METRONOME_R_VOL_DOWN BUTTON_RC_VOL_DOWN
65#define METRONOME_R_TAP BUTTON_RC_BITRATE
66#endif
67
59static struct plugin_api* rb; 68static struct plugin_api* rb;
60 69
61static int bpm = 120; 70static int bpm = 120;
@@ -72,8 +81,25 @@ static int tap_count = 0;
72static int tap_time = 0; 81static int tap_time = 0;
73static int tap_timeout = 0; 82static int tap_timeout = 0;
74 83
75/*tick sound from a metronome*/ 84void led(bool on)
76static unsigned char sound[]={ 85{
86#if CONFIG_CPU == SH7034
87 if(on)
88 or_b(0x40, &PBDRL);
89 else
90 and_b(~0x40, &PBDRL);
91#else
92 (void)on;
93#endif
94}
95
96#if CONFIG_CODEC != SWCODEC
97
98#define MET_IS_PLAYING rb->mp3_is_playing()
99#define MET_PLAY_STOP rb->mp3_play_stop()
100
101/* tick sound from a metronome */
102static unsigned char sound[] = {
77255,251, 80,196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 103255,251, 80,196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
78 0, 73,110,102,111, 0, 0, 0, 15, 0, 0, 0, 4, 0, 0, 4, 19, 0, 64, 64, 104 0, 73,110,102,111, 0, 0, 0, 15, 0, 0, 0, 4, 0, 0, 4, 19, 0, 64, 64,
79 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 105 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -127,24 +153,6 @@ static unsigned char sound[]={
127 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 153 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
128 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 154 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
129 85, 85, 85}; 155 85, 85, 85};
130
131
132
133void led(bool on)
134{
135#if CONFIG_CPU == SH7034
136 if(on)
137 or_b(0x40, &PBDRL);
138 else
139 and_b(~0x40, &PBDRL);
140#else
141 (void)on;
142#endif
143}
144
145void calc_period(void){
146 period = 61440/bpm-1; // (60*1024)/bpm;
147}
148 156
149void callback(unsigned char** start, int* size){ 157void callback(unsigned char** start, int* size){
150 (void)start; /* unused parameter, avoid warning */ 158 (void)start; /* unused parameter, avoid warning */
@@ -160,13 +168,580 @@ void play_tock(void){
160 rb->mp3_play_pause(true); /* kickoff audio */ 168 rb->mp3_play_pause(true); /* kickoff audio */
161} 169}
162 170
171#else
172
173#define MET_IS_PLAYING rb->pcm_is_playing()
174#define MET_PLAY_STOP rb->pcm_play_stop()
175
176static signed short sound[] = {
177 1, -1, 1, -1, 0, 0, 0, 1, -1, 0, 0,
178 0, -1, 2, -2, 2, -1, 0, 0, 0, 0, 1,
179 -1, 0, -1, 1, 0, 0, 0, 1, -1, 1, -2,
180 1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
181 0, 0, -1, 2, -2, 2, -1, 0, 1, -1, 1,
182 -1, 0, 0, 0, 0, 1, -2, 2, -2, 1, 0,
183 1, -1, 0, 1, -1, 0, 1, -2, 2, -1, 0,
184 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0,
185 0, -1, 1, -1, 2, -2, 2, -2, 2, -2, 1,
186 0, 0, 0, 1, -2, 2, -2, 1, 0, 0, 0,
187 0, 0, 0, -1, 1, 0, -1, 2, -2, 2, -1,
188 0, 0, 0, -1, 1, -1, 1, -1, 2, -2, 1,
189 0, -1, 2, -2, 2, -2, 1, 0, 0, 0, 0,
190 0, 0, 0, 0, 1, -1, 0, 0, -1, 1, 0,
191 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0,
192 1, -2, 2, -1, 0, 0, 0, 0, 0, 1, -2,
193 1, 0, 0, 0, 0, 0, 1, -1, 0, 0, -1,
194 2, -2, 2, -2, 2, -1, 0, 0, -1, 1, -1,
195 1, -1, 1, -1, 1, -1, 1, 0, 0, -1, 2,
196 -2, 1, 0, 0, 0, 0, 0, 1, -1, 0, 0,
197 -1, 1, 0, 0, 0, 0, 0, 0, 1, -2, 2,
198 -2, 2, -1, 1, -1, 1, -2, 2, -2, 2, -2,
199 2, -2, 2, -2, 2, -1, 0, 0, 0, -1, 2,
200 -2, 2, -1, 1, -1, 1, -2, 2, -2, 1, 0,
201 1, -1, 1, -2, 1, -1, 1, 0, 0, 0, 0,
202 0, 0, 0, 0, -1, 1, 0, -1, 2, -1, 0,
203 0, -1, 1, 0, -1, 2, -2, 1, 0, 0, 0,
204 0, 0, 0, -1, 2, -1, 1, -1, 0, 0, 1,
205 -2, 2, -1, 1, -1, 0, 1, -1, 0, 0, 0,
206 0, 0, 0, -1, 1, 0, 0, 0, 0, -1, 2,
207 -2, 2, -1, 0, 1, -1, 0, 0, 0, 0, 0,
208 0, 0, 0, 1, -1, 1, -1, 0, 0, 0, 0,
209 0, 1, -1, 1, -1, 0, 1, -2, 2, -1, 0,
210 1, -2, 2, -2, 2, -2, 2, -1, 0, 1, -1,
211 0, 1, -1, 0, 0, 0, 0, 0, 0, 1, -2,
212 2, -2, 1, 0, -1, 2, -2, 1, 0, 0, 0,
213 0, -1, 1, 0, 0, 1, -1, 0, 0, 0, 0,
214 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0,
215 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1,
216 -1, 1, 0, 0, 0, 0, 0, 0, -1, 2, -1,
217 0, 0, 0, 0, 1, -1, 0, 0, 1, -2, 2,
218 -1, 0, 0, 0, 0, -1, 1, 0, 0, -1, 2,
219 -2, 1, 0, -1, 1, -1, 2, -2, 2, -2, 2,
220 -1, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0,
221 0, 0, 0, 0, 0, 0, -1, 1, 0, 1, -2,
222 2, -1, 0, 1, -1, 0, 0, 0, 0, 0, 0,
223 -1, 2, -2, 2, -2, 2, -1, 0, 0, 0, -1,
224 1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 1,
225 -1, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0,
226 1, -2, 2, -2, 1, 0, 0, 0, 0, 0, 0,
227 0, 1, -1, 0, 1, -1, 1, -1, 0, -1, 2,
228 -1, 0, 0, 0, -1, 1, -1, 1, 0, 1, -1,
229 1, -2, 1, 0, 0, 1, -2, 2, -2, 2, -2,
230 2, -2, 2, -1, 0, 0, 0, 0, 0, -1, 2,
231 -2, 2, -1, 0, 0, 0, 1, -1, 0, 0, 0,
232 0, -1, 1, -1, 1, 0, 0, 0, 1, -2, 1,
233 0, -1, 2, -2, 1, -1, 0, 2, -2, 2, 0,
234 -1, 0, 0, 0, -1, 2, -2, 2, -2, 2, -2,
235 2, -1, 0, 1, -2, 2, -1, 0, 0, 0, 0,
236 1, -1, 0, 0, 0, 0, 0, 0, 0, 1, -2,
237 1, 0, 0, 0, 0, 0, 0, -1, 1, -1, 1,
238 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
239 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
240 0, 0, 0, 0, 0, 0, 0, -1, 1, 0, -1,
241 2, -2, 1, 0, 0, 0, 0, 0, -1, 2, -2,
242 2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
243 0, 0, 0, -1, 2, -1, 0, 0, -1, 1, 0,
244 0, 0, 0, 0, 1, -1, 0, 0, -1, 1, 0,
245 0, 0, 0, -1, 1, 0, -1, 2, -1, 0, 0,
246 0, 1, -2, 2, -1, 0, 0, 0, -1, 1, -1,
247 1, 0, 0, 0, 0, 0, 0, 1, -1, 1, -1,
248 0, 0, -1, 2, -2, 1, 0, 0, 0, 0, 0,
249 0, 0, 0, 0, 0, 0, -1, 1, -1, 1, 0,
250 -1, 2, -2, 1, 1, -1, 0, 0, -1, 1, 0,
251 0, 0, 1, -2, 2, -2, 1, 0, 1, -2, 2,
252 -1, 0, 0, 0, -1, 2, -1, 0, 0, 0, 0,
253 0, 0, 0, 0, -1, 2, -2, 2, -1, 0, 0,
254 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
255 0, 0, 0, 0, -1, 2, -2, 2, -1, 0, 1,
256 -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -2,
257 2, -1, 0, 0, 0, -1, 2, -2, 2, -2, 1,
258 0, -1, 1, 0, -1, 1, 0, 0, 0, 0, 0,
259 -1, 1, -1, 2, -2, 2, -1, 1, -1, 0, 0,
260 0, 0, 1, -1, 0, 0, 0, 0, 1, -2, 2,
261 -2, 1, 1, -1, 1, -1, 1, -2, 2, -2, 1,
262 -1, 2, -2, 1, 0, 0, 0, 0, 0, -1, 2,
263 -2, 2, -1, -1, 1, -1, 1, -1, 2, -2, 2,
264 -1, 0, 0, 1, -2, 2, -2, 1, 0, 0, 0,
265 0, 1, -2, 1, -1, 1, -1, 1, 0, 0, 0,
266 0, 0, -1, 1, 0, 0, 0, -1, 1, 0, 0,
267 1, -2, 2, -2, 1, 0, 0, 0, 0, 0, 0,
268 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
269 0, 0, 0, 0, 1, -1, 1, -2, 1, 0, 0,
270 0, 0, 0, 0, -1, 1, 0, 0, 0, -1, 1,
271 0, 0, 0, 0, 0, 0, 1, -2, 2, -1, 0,
272 0, 0, 0, 0, 0, 1, -2, 2, -1, 1, -1,
273 0, 0, 0, 1, -1, 0, 0, -1, 2, -1, 0,
274 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
275 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
276 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 1,
277 -1, 0, 0, 0, 0, 0, 0, -1, 2, -2, 2,
278 -1, 1, -1, 0, 0, -1, 2, -1, 1, -1, 1,
279 -2, 2, -2, 2, -2, 2, -1, 0, 0, 0, 0,
280 0, 0, 0, 0, 1, -1, 0, 0, 1, -2, 2,
281 -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
282 -1, 1, 0, 0, 0, -1, 1, 0, 0, 0, 0,
283 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
284 0, 0, 0, 0, -1, 2, -2, 2, -1, 0, 1,
285 -2, 1, 0, 0, 1, -2, 2, -2, 2, -1, -1,
286 2, -2, 1, 0, 0, 0, 1, -2, 2, -1, 0,
287 0, 0, 0, 0, 0, 0, -1, 1, -1, 2, -1,
288 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 2,
289 -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
290 1, 0, 0, 1, -1, 1, -1, 0, 0, -1, 2,
291 -2, 2, -1, 0, 0, 0, 1, -1, 0, 0, 0,
292 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, 0,
293 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0,
294 0, -1, 2, -2, 1, 0, -1, 1, 0, 0, 1,
295 -1, 0, 0, -1, 2, -2, 1, 0, -1, 2, -1,
296 0, 0, 0, 0, 0, 0, 0, -1, 1, 0, 0,
297 1, -2, 2, -2, 1, 0, 0, 0, 0, -1, 1,
298 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0,
299 -1, 1, 0, 0, 0, 1, -1, 0, 0, 0, 0,
300 1, -1, 0, 1, -1, 0, -1, 1, 0, -1, 2,
301 -2, 1, 0, 0, 0, -1, 2, -2, 1, 0, 0,
302 1, -2, 2, -1, 0, 1, -1, 0, 0, 0, -1,
303 1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
304 0, -1, 1, 0, -1, 2, -2, 1, 0, 0, 0,
305 0, 0, 0, 0, 0, 0, 0, 0, -1, 2, -2,
306 1, -1, 1, -1, 2, -2, 1, 0, -1, 2, -2,
307 2, -1, 0, 0, 0, -1, 1, 0, 0, 0, 1,
308 -2, 2, -2, 2, -2, 1, 0, 0, 0, 0, 1,
309 -1, 1, -1, 0, 0, 0, 0, 0, 0, 1, -1,
310 0, 0, 0, 0, 1, -1, 0, 0, 0, -1, 2,
311 -2, 2, -1, 0, 1, -2, 1, 0, 0, 0, 0,
312 0, 0, 0, 0, 0, 0, 0, 0, -1, 2, -2,
313 2, -2, 1, 0, 0, 0, 0, 0, 0, -1, 2,
314 -2, 2, -1, 0, 1, -1, 0, 0, 0, 0, 0,
315 0, 1, -1, 0, 1, -2, 1, 0, -1, 1, 0,
316 -1, 1, 0, 0, 0, 0, 1, -1, 0, 0, 0,
317 0, 0, -1, 2, -2, 2, -2, 2, -2, 1, 0,
318 0, 0, 0, 1, -2, 2, -2, 2, -1, 0, 1,
319 -2, 2, -2, 1, 0, 0, 0, 1, -1, 0, 0,
320 -1, 1, 0, 0, 0, 0, -1, 2, -2, 2, -1,
321 0, 0, 0, -1, 2, -1, 0, 1, -1, 0, 0,
322 0, 0, 1, -2, 2, -1, 0, 0, 0, 0, 0,
323 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0,
324 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0,
325 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0,
326 0, 0, 0, -1, 1, 0, 0, -1, 1, -1, 2,
327 -2, 2, -2, 2, -1, 0, 0, -1, 1, -1, 1,
328 0, -1, 2, -2, 2, -1, 0, 0, 0, 0, 0,
329 0, 0, 1, -2, 2, -2, 1, 0, 0, 0, -1,
330 2, -2, 1, 0, 1, -1, 0, 0, 1, -1, 1,
331 -2, 1, 0, 0, 0, -1, 1, -1, 2, -2, 2,
332 -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1,
333 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
334 1, -2, 2, -1, 0, 1, -2, 2, -1, 0, 0,
335 0, 0, 1, -1, 1, -1, 0, -1, 2, -2, 2,
336 -2, 2, -1, 0, 0, 0, 0, 0, 0, 0, 1,
337 -1, 0, 0, 0, -1, 2, -2, 1, 1, -2, 2,
338 -1, 0, 1, -2, 1, 0, 0, 0, 0, 1, -1,
339 0, 1, -1, 0, 0, -1, 2, -2, 2, -2, 2,
340 -2, 2, -2, 2, -2, 2, -2, 2, -1, 1, -1,
341 1, -1, 1, 0, -1, 1, -1, 1, 0, 0, -1,
342 0, 1, 0, 1, -2, 2, -2, 1, 1, -2, 1,
343 0, 0, 0, 0, 0, 0, 0, -1, 2, -1, 0,
344 0, -1, 1, 0, 0, 0, -1, 0, 1, 0, 1,
345 -2, 0, -1, 1, 0, 1, 0, -1, 0, 0, 1,
346 -1, 1, -2, 1, 1, -1, 1, -1, -1, 0, 1,
347 0, 1, -1, 0, -1, 0, 1, 1, -2, 1, -1,
348 1, 1, 0, -1, 0, 0, 1, 1, 1, -1, 0,
349 -1, 0, 1, -1, 1, -2, 2, 0, 0, 1, -2,
350 -1, 0, 0, 1, -1, 0, -1, 1, 0, 0, 0,
351 0, 0, 0, 0, -1, 1, -1, 1, 0, 2, 1,
352 -1, 0, 0, 0, 1, 1, 1, -1, 1, 1, 0,
353 1, -2, 1, -1, 2, 2, 0, -1, -1, -1, 0,
354 1, -1, 1, -1, 1, 1, 1, 1, -3, 0, 3,
355 0, 0, -4, -2, 4, 5, 4, -3, -1, 1, -3,
356 -2, -5, -6, -1, 5, 2, 1, -3, -2, -5, 1,
357 -4, -5, 3, 5, 0, 1, 2, 0, -5, -1, 3,
358 5, 2, 1, 1, 6, 5, 3, -1, 0, 2, 5,
359 10, 8, 4, 2, -5, -5, 3, 11, 8, -4, -8,
360 -2, 2, -1, -1, 5, -6, -12, -11, -5, -9, -5,
361 10, 6, 3, -4, -3, -9, -8, -18, -9, 5, 13,
362 7, 13, 29, 17, -1, -1, 15, 21, 15, -9, -29,
363 -15, 10, 10, -15, -31, -48, -49, -30, -7, -1, -8,
364 -6, 15, 39, 43, 24, 16, 27, 28, 9, -16, -6,
365 34, 60, 41, 15, 11, 26, 14, -28, -77, -83, -60,
366 -32, 1, 10, -11, -59, -83, -49, 27, 93, 82, 11,
367 -27, -8, 9, 1, 12, 22, 6, -22, -15, 4, 8,
368 -19, -23, 49, 143, 139, 39, -31, -56, -101, -145, -102,
369 -10, 20, -61, -196, -258, -136, 70, 172, 112, 43, 55,
370 75, 12, -69, -33, 89, 114, -26, -137, -14, 239, 335,
371 202, 68, 115, 231, 169, -131, -459, -540, -338, -72, 43,
372 20, -53, -174, -290, -195, 192, 593, 628, 322, 95, 159,
373 264, 163, -50, -202, -229, -114, 18, -31, -212, -264, -36,
374 432, 807, 619, -52, -483, -452, -414, -404, -98, 228, -3,
375 -760, -1444, -1414, -458, 624, 732, 35, -209, 476, 1113, 586,
376 -785, -1405, -480, 753, 881, 280, 81, 441, 753, 687, 711,
377 1440, 2140, 1110, -1470, -2963, -1770, 607, 1427, -399, -3146, -3899,
378 -2064, 28, 715, 874, 1442, 1606, 394, -1483, -2014, -354, 1531,
379 1156, -984, -2108, -821, 1635, 3003, 2087, 186, -155, 1569, 3328,
380 3463, 2110, 9, -2200, -3876, -4298, -2871, -266, 1039, -393, -2357,
381 -1809, 1079, 4019, 5685, 5742, 4435, 3098, 2963, 3181, 2018, -691,
382 -3919, -6922, -9001, -8935, -6374, -3215, -1862, -2089, -1508, 731, 3186,
383 4763, 5160, 3629, 706, -712, 739, 2391, 1570, -1015, -3502, -4979,
384 -4798, -2615, 420, 2178, 1457, -602, -1287, 741, 3741, 5018, 3687,
385 934, -757, 497, 3094, 3163, 113, -2188, -1194, 911, 998, -254,
386 484, 3643, 4907, 1023, -4718, -6191, -1911, 3621, 4508, -687, -6491,
387 -6309, -1015, 3007, 3184, 1911, 471, -1763, -4048, -4414, -2046, 1179,
388 1513, -1919, -4522, -2259, 2368, 4547, 3613, 2320, 2847, 5035, 6432,
389 4390, -835, -5857, -7419, -5497, -2768, -1012, -27, -294, -2444, -3889,
390 -1911, 942, 1212, 859, 2879, 5141, 4107, 108, -3768, -4853, -2787,
391 -162, 142, -1594, -2490, -498, 3349, 5670, 4368, 1089, -1548, -3118,
392 -3936, -3319, -1583, -547, -360, 985, 3125, 2273, -1728, -2291, 4071,
393 10390, 9283, 3620, 79, -90, 1293, 1968, -2030,-10963,-16320,-10631,
394 1236, 8206, 6740, 2418, 1132, 3007, 3504, -1371, -8877, -9321, 2657,
395 17866, 22245, 14739, 4801, -2737, -7071, -2808, 12289, 25609, 19526, -6479,
396-30563,-29780, -6434, 13879, 13263, 83, -8239, -7874, -6445, -8032, -9180,
397 -7691, -7914,-12368,-13982, -7090, -1018, -8154,-21862,-22142, -3867, 14327,
398 14436, 1712, -5853, -2462, 3311, 4605, 1731, -3832,-11191,-17673,-17400,
399 -4049, 17643, 27851, 14373, -7582,-15759, -9573, -1277, 5996, 13903, 17168,
400 11276, 1603, -4763, -7550, -7537, -2186, 6709, 10980, 6990, -1127, -9765,
401-16805,-19102,-18420,-18687,-13775, 3373, 21405, 23456, 12651, 3319, -1287,
402 -4637, -3954, 3883, 11849, 8344, -6853,-17292, -7204, 16901, 31089, 21726,
403 1084, -7875, 1459, 15092, 20527, 18496, 10594, -3296,-12835, -6081, 9842,
404 15942, 3977,-16959,-26888,-12200, 13260, 20645, 6239, -5950, -2526, 6054,
405 8073, 3123, -4656,-11949,-15611,-12153, -2236, 4314, -2887,-19936,-30928,
406-23846, -1429, 17759, 15264, -1868, -7505, 5991, 19737, 18946, 8185, -600,
407 44, 6127, 5321, -4750,-11829, -8743, -1330, 3689, 3252, -3513,-11859,
408-14753,-10198, 72, 10949, 13370, 5735, -564, 2639, 9903, 13145, 11045,
409 6754, 3123, -724, -6600,-10509, -8340, -6244,-12133,-21055,-20385, -5186,
410 15105, 23034, 11762, -3750, -5737, 2612, 6060, 33, -7014, -4975, 7697,
411 18684, 12606, -7934,-23083,-20429, -7355, 2345, 4875, 7094, 14569, 22636,
412 22509, 13749, 4800, 2246, 4805, 7497, 7404, 4042, -3207,-13334,-19292,
413-12274, 5051, 15820, 7212,-12051,-20991,-11633, 3886, 11417, 10491, 8967,
414 9849, 9995, 8305, 7497, 7731, 5549, -49, -6582,-12286,-16545,-19489,
415-22478,-23536,-16116, -123, 14039, 19014, 16964, 11024, 3746, 1174, 5696,
416 10510, 9283, 3833, -1113, -4247, -7485,-11448,-12665, -9329, -7052,-10656,
417-14627,-10081, 3317, 16454, 18316, 6990, -6264,-10409, -7182, -2463, 3812,
418 10794, 12717, 7460, 215, -2353, 676, 983, -9207,-21161,-17629, 361,
419 11731, 2863,-15895,-22726, -8619, 11663, 17157, 7331, -255, 4522, 15016,
420 20742, 18465, 12205, 6509, 836, -6050,-10016, -8310, -6482, -9596,-13628,
421-12443, -6667, -1745, -487, 633, 6363, 14319, 17428, 14246, 9598, 6752,
422 5527, 5289, 5673, 6272, 5900, 2123, -5034,-10908,-12352,-12153,-13371,
423-14974,-15335,-14089, -9874, -1589, 8285, 14571, 13761, 7383, 1668, 1519,
424 4509, 3987, -1719, -7872,-10985,-12263,-12864,-11713, -9423, -8944,-10937,
425-12477,-11078, -6884, -1052, 5798, 13303, 20195, 23473, 20387, 12863, 7217,
426 6080, 4059, -3737,-13190,-17239,-15342,-11071, -5970, -543, 4259, 7968,
427 8781, 4097, -3427, -7041, -5374, -2595, 70, 4218, 8042, 8534, 7403,
428 8758, 12712, 15141, 12739, 6198, -414, -2420, 331, 780, -7211,-18274,
429-21587,-15771, -7472, 733, 9880, 17443, 19723, 16661, 10520, 4467, 1343,
430 308, -1550, -3368, -1921, 1564, 1426, -5086,-13434,-16483,-12675, -6499,
431 -2040, -586, -2374, -5424, -5786, -2131, 3305, 7892, 9432, 7024, 3000,
432 410, -274, 396, 1514, 785, -2873, -7609,-11931,-15458,-16897,-15275,
433-10823, -3469, 5396, 11785, 13505, 11686, 7478, 2801, 1972, 6978, 13591,
434 14815, 7016, -6127,-15851,-17122,-13183, -9425, -7273, -5029, -1087, 3485,
435 5516, 4834, 5156, 7648, 9472, 9387, 8481, 7313, 6847, 7922, 8488,
436 6309, 2375, -1821, -6179, -9633,-10798,-10521,-10565,-11165,-11055, -8661,
437 -3781, 1960, 6819, 9680, 9920, 8944, 9396, 10975, 10715, 7182, 861,
438 -7005,-13267,-15283,-15034,-15703,-15867,-12193, -5329, 829, 3996, 5377,
439 7152, 9312, 10386, 10275, 10167, 10500, 10694, 9601, 6318, 2012, -1381,
440 -4917,-10834,-17053,-18962,-15907,-11261, -7518, -4754, -2399, -32, 2969,
441 6930, 10871, 13043, 13087, 12045, 10546, 9003, 8103, 6739, 2241, -5153,
442-11768,-15213,-15636,-13473, -9655, -6045, -3220, -430, 2055, 3835, 6558,
443 11429, 15904, 16225, 12337, 7477, 3631, -122, -4854, -9898,-13734,-15118,
444-13861,-11287, -8854, -6458, -3768, -1724, -385, 2105, 5993, 8742, 9121,
445 8765, 8415, 6764, 3536, 104, -2912, -5635, -7580, -8217, -7502, -5362,
446 -2617, -1366, -2262, -3363, -3163, -2137, -589, 1870, 4595, 6301, 6764,
447 6718, 6520, 5842, 4638, 3882, 4279, 4700, 3357, 183, -2935, -3952,
448 -2906, -2493, -4469, -6460, -5616, -2932, -231, 3057, 6959, 9364, 9069,
449 6831, 4078, 2556, 2602, 2068, -153, -1834, -1310, -248, -795, -2717,
450 -4126, -3995, -3695, -4963, -6850, -7066, -5258, -2772, -846, 139, 1073,
451 2821, 4490, 5430, 6971, 8941, 8259, 3626, -2713, -8358,-12049,-13228,
452-12856,-12123,-10333, -7012, -3862, -1844, 527, 4263, 8105, 10304, 10453,
453 9346, 7786, 5793, 3181, 40, -3553, -7164, -9520, -9740, -8339, -6135,
454 -3335, 16, 3345, 5455, 5356, 3793, 2943, 3715, 4965, 5638, 6024,
455 6657, 7270, 6829, 4385, 593, -2392, -3644, -4633, -6185, -6575, -4682,
456 -2249, -1081, -648, 222, 1873, 4273, 6609, 7328, 6269, 5017, 4332,
457 3500, 2200, 704, -1135, -3367, -5373, -6705, -7346, -7055, -5618, -3596,
458 -1716, 117, 2133, 3576, 3514, 2437, 1568, 1147, 588, -490, -1976,
459 -3125, -2983, -1979, -1775, -2637, -2993, -2327, -2013, -2843, -4077, -4841,
460 -4778, -3915, -2756, -1663, -78, 2401, 4777, 5910, 6074, 5858, 4886,
461 2889, 688, -970, -2010, -2413, -2357, -2511, -3033, -3218, -2983, -2783,
462 -2022, 315, 3490, 5687, 6228, 5642, 4405, 3006, 2065, 1656, 1592,
463 2141, 3191, 3485, 2147, -131, -2437, -4663, -6289, -6118, -3991, -1098,
464 1550, 3446, 4204, 4186, 4379, 4801, 4654, 3956, 3267, 2297, 512,
465 -1660, -3571, -5057, -5713, -5051, -3695, -2719, -2075, -1180, -306, 43,
466 201, 527, 896, 1415, 2085, 2103, 1018, -171, -613, -825, -1316,
467 -1701, -1787, -1766, -1462, -922, -997, -1987, -2857, -2699, -1736, -514,
468 484, 696, 221, 24, 316, 48, -973, -1304, -49, 1921, 3426,
469 4026, 3875, 3529, 3327, 2659, 1002, -723, -1568, -2055, -2862, -3247,
470 -2368, -873, 62, 184, 58, 315, 1196, 2204, 2563, 2494, 2945,
471 3730, 3479, 1991, 500, -527, -1710, -3069, -4146, -4921, -5126, -4168,
472 -2410, -881, 287, 1399, 2210, 2737, 3559, 4435, 4390, 3402, 2338,
473 1278, -271, -1954, -2896, -3007, -2752, -2482, -2724, -3874, -5145, -5390,
474 -4613, -3122, -402, 3217, 5859, 6536, 6136, 5381, 4239, 3021, 1905,
475 465, -1127, -2074, -2588, -3532, -4652, -5131, -4876, -4054, -2586, -848,
476 525, 1727, 3291, 4715, 5094, 4595, 3990, 3426, 2642, 1618, 196,
477 -1676, -3238, -3809, -3789, -3482, -2326, -697, -239, -1207, -1820, -939,
478 863, 2740, 4260, 5221, 5856, 6299, 5671, 3229, -23, -2465, -3892,
479 -4948, -5454, -5047, -4443, -4355, -4055, -2592, -469, 1194, 2038, 2285,
480 2563, 3653, 5162, 5484, 4235, 2697, 1473, 27, -1754, -3674, -5673,
481 -6983, -6577, -4808, -2747, -690, 1257, 2527, 3071, 3338, 3313, 2895,
482 2726, 3203, 3522, 2793, 1295, -325, -2074, -3850, -4855, -4744, -4000,
483 -2801, -1095, 473, 1418, 2150, 2712, 2651, 2407, 2619, 2775, 2513,
484 2523, 2737, 2113, 659, -598, -1376, -2019, -2413, -2377, -2143, -1792,
485 -1119, -403, -404, -963, -894, 215, 1579, 2770, 3868, 4081, 2660,
486 398, -1501, -2862, -3573, -3200, -2109, -1097, -276, 295, 45, -1024,
487 -1953, -2120, -1736, -971, 274, 1597, 2369, 2667, 2840, 2417, 947,
488 -823, -1912, -2224, -1940, -1203, -452, 127, 811, 1272, 788, -366,
489 -1342, -1806, -1746, -1161, -266, 928, 2469, 3661, 3707, 2956, 2179,
490 1379, 340, -690, -1418, -1852, -2028, -1928, -1591, -1202, -864, -267,
491 806, 1949, 2658, 2868, 2653, 2202, 1866, 1534, 768, -230, -1027,
492 -1800, -2455, -2301, -1394, -707, -605, -610, -403, -39, 282, 371,
493 423, 917, 1881, 2543, 1980, 235, -1335, -1767, -1786, -2298, -2787,
494 -2689, -2421, -2133, -1460, -694, -214, 424, 1435, 2307, 2819, 3041,
495 2652, 1573, 324, -754, -1729, -2520, -2956, -2933, -2321, -1260, -306,
496 165, 305, 416, 646, 985, 1362, 1745, 2076, 2245, 2234, 1930,
497 1150, -10, -1337, -2785, -3969, -4138, -3350, -2371, -1256, 303, 1810,
498 2722, 3265, 3605, 3559, 3246, 2772, 1942, 766, -553, -1923, -2939,
499 -3124, -2592, -1721, -657, 340, 1033, 1514, 1616, 1076, 417, 322,
500 591, 787, 929, 1058, 1046, 827, 255, -548, -1069, -1232, -1508,
501 -1928, -2066, -1828, -1384, -836, -313, 165, 570, 710, 593, 549,
502 566, 338, -42, -215, -86, 93, -71, -692, -1242, -1361, -1405,
503 -1612, -1705, -1546, -1012, 64, 1202, 1774, 2110, 2444, 2028, 747,
504 -280, -586, -712, -687, -214, 222, 21, -651, -1402, -2075, -2301,
505 -1607, -374, 420, 528, 623, 906, 895, 646, 748, 1155, 1401,
506 1471, 1569, 1443, 829, -102, -1009, -1730, -2195, -2295, -1957, -1121,
507 235, 1663, 2296, 1932, 1429, 1359, 1289, 1045, 1074, 1308, 1229,
508 771, 13, -1126, -2275, -2863, -2931, -2658, -1849, -660, 316, 931,
509 1418, 1586, 1154, 592, 633, 1166, 1428, 1169, 759, 275, -489,
510 -1425, -2208, -2714, -2705, -2029, -1090, -367, 236, 886, 1413, 1728,
511 1903, 1867, 1576, 1097, 393, -463, -1157, -1465, -1417, -1112, -615,
512 82, 923, 1390, 889, -291, -1250, -1686, -1756, -1338, -411, 577,
513 1291, 1751, 1854, 1480, 897, 393, -43, -439, -733, -924, -979,
514 -751, -354, -58, 122, 314, 418, 311, 171, 225, 428, 678,
515 1000, 1304, 1263, 748, 37, -586, -1042, -1237, -1070, -664, -243,
516 97, 262, 167, -128, -402, -445, -184, 202, 446, 534, 519,
517 323, -11, -258, -385, -468, -463, -350, -191, -36, -2, -163,
518 -207, 82, 406, 588, 861, 1087, 900, 461, 73, -396, -872,
519 -917, -514, -44, 332, 667, 771, 490, -59, -620, -1123, -1495,
520 -1448, -811, 63, 751, 1214, 1446, 1336, 1005, 611, 60, -531,
521 -828, -837, -740, -478, -139, -25, -63, 30, 245, 481, 790,
522 1033, 1002, 750, 462, 140, -197, -433, -516, -516, -578, -715,
523 -818, -821, -742, -548, -228, 77, 233, 247, 183, 100, 60,
524 91, 155, 208, 257, 275, 154, -136, -387, -429, -428, -486,
525 -396, -72, 259, 435, 450, 397, 400, 373, 153, -57, 23,
526 181, 231, 390, 496, 87, -627, -1036, -1047, -785, -216, 465,
527 823, 761, 501, 269, 197, 282, 395, 502, 597, 684, 687,
528 440, -91, -581, -803, -853, -677, -155, 367, 520, 472, 351,
529 -35, -523, -708, -585, -312, 103, 471, 530, 378, 226, 51,
530 -164, -377, -542, -582, -404, -134, 42, 91, 4, -205, -400,
531 -488, -528, -548, -453, -157, 305, 794, 1106, 1134, 866, 307,
532 -368, -839, -979, -916, -721, -436, -226, -164, -84, 26, 32,
533 27, 249, 614, 889, 1016, 1036, 931, 663, 248, -235, -632,
534 -864, -967, -997, -965, -800, -394, 150, 614, 919, 1096, 1049,
535 791, 514, 271, 19, -107, -93, -145, -295, -384, -365, -257,
536 -96, -26, -115, -232, -332, -437, -400, -167, 106, 387, 655,
537 726, 536, 231, -134, -519, -793, -961, -1068, -1019, -800, -555,
538 -275, 62, 333, 543, 777, 937, 940, 888, 784, 519, 133,
539 -278, -630, -849, -905, -836, -598, -266, -41, 129, 370, 501,
540 401, 294, 265, 159, 100, 253, 410, 336, 166, 11, -162,
541 -313, -295, -159, -70, -82, -123, -159, -195, -141, 128, 547,
542 900, 1123, 1218, 1047, 565, -14, -513, -944, -1193, -1088, -735,
543 -411, -189, -17, 62, 33, 33, 114, 218, 335, 449, 434,
544 244, -53, -414, -720, -786, -594, -314, -119, -107, -289, -515,
545 -670, -755, -661, -218, 419, 945, 1257, 1343, 1140, 688, 146,
546 -364, -747, -941, -997, -923, -669, -334, -74, 97, 267, 439,
547 594, 715, 741, 715, 739, 823, 817, 615, 225, -241, -642,
548 -911, -1033, -958, -683, -356, -53, 232, 432, 478, 491, 616,
549 782, 862, 863, 794, 586, 230, -181, -534, -750, -738, -528,
550 -311, -238, -262, -256, -227, -207, -107, 83, 179, 121, 79,
551 115, 135, 168, 205, 147, 48, 78, 104, -77, -367, -617,
552 -883, -1084, -1016, -718, -373, -15, 361, 660, 801, 781, 677,
553 554, 320, -73, -437, -617, -681, -645, -434, -130, 113, 293,
554 396, 325, 127, -74, -166, -76, 183, 416, 509, 518, 451,
555 293, 114, -37, -135, -139, -66, 9, 69, 133, 172, 213,
556 302, 407, 464, 465, 362, 169, -59, -340, -635, -779, -688,
557 -447, -84, 362, 661, 681, 514, 221, -144, -386, -357, -167,
558 107, 375, 463, 237, -179, -650, -1045, -1222, -1130, -842, -392,
559 138, 538, 675, 607, 418, 190, 41, -18, -35, -35, -32,
560 -96, -207, -325, -456, -537, -470, -334, -214, -45, 183, 298,
561 318, 354, 397, 377, 383, 478, 558, 567, 484, 302, 21,
562 -283, -518, -634, -630, -538, -323, -11, 257, 390, 440, 384,
563 210, 120, 251, 418, 464, 415, 286, 41, -216, -388, -514,
564 -519, -335, -65, 96, 139, 108, -19, -217, -360, -319, -84,
565 209, 472, 622, 599, 404, 185, 16, -167, -362, -491, -580,
566 -659, -617, -457, -316, -190, 29, 245, 336, 321, 250, 116,
567 2, -41, -39, 27, 143, 200, 119, -28, -153, -219, -211,
568 -152, -101, -31, 29, 24, -42, -109, -150, -121, -8, 81,
569 114, 185, 282, 308, 280, 243, 149, 11, -54, -87, -184,
570 -283, -303, -254, -123, 83, 232, 239, 165, 62, -49, -140,
571 -173, -148, -67, 24, 67, 84, 92, 54, -41, -121, -154,
572 -114, -23, 33, -42, -166, -268, -347, -412, -399, -276, -56,
573 203, 449, 635, 747, 724, 565, 367, 166, -64, -263, -360,
574 -406, -447, -446, -403, -362, -295, -156, -16, 98, 230, 381,
575 493, 512, 456, 390, 345, 296, 223, 156, 56, -121, -320,
576 -500, -665, -754, -680, -487, -234, 79, 378, 518, 528, 469,
577 319, 127, 35, 48, 65, 106, 170, 121, -91, -334, -506,
578 -625, -686, -636, -473, -258, -40, 168, 349, 443, 477, 509,
579 514, 432, 311, 186, -4, -269, -460, -541, -600, -629, -558,
580 -432, -326, -227, -105, 34, 209, 394, 534, 582, 577, 524,
581 403, 246, 118, 23, -71, -157, -166, -96, -30, -27, -54,
582 -75, -74, -38, -12, -25, -9, 103, 245, 354, 449, 504,
583 459, 321, 148, -52, -248, -357, -383, -369, -327, -281, -274,
584 -281, -215, -56, 146, 351, 547, 692, 699, 525, 253, 5,
585 -185, -301, -328, -280, -255, -260, -282, -372, -505, -535, -391,
586 -184, 26, 233, 392, 410, 313, 173, 39, -67, -108, -93,
587 -70, -85, -151, -261, -381, -475, -495, -443, -313, -91, 211,
588 503, 688, 732, 648, 464, 220, -12, -159, -211, -226, -273,
589 -324, -329, -267, -147, -8, 120, 253, 422, 558, 570, 491,
590 394, 269, 115, 6, -26, -46, -102, -183, -263, -295, -279,
591 -200, -55, 104, 181, 191, 229, 264, 234, 170, 120, 23,
592 -99, -169, -217, -323, -368, -285, -173, -113, -33, 59, 81,
593 15, -85, -169, -191, -127, 0, 127, 178, 111, -6, -94,
594 -130, -110, -20, 82, 87, 38, 1, -73, -175, -203, -108,
595 24, 142, 243, 255, 154, 20, -64, -99, -88, -26, 73,
596 178, 230, 191, 70, -70, -165, -187, -142, -52, 49, 163,
597 267, 320, 304, 230, 146, 70, 6, -38, -84, -144, -224,
598 -289, -349, -368, -291, -88, 163, 372, 491, 466, 307, 89,
599 -105, -254, -332, -311, -217, -111, -19, -4, -66, -132, -161,
600 -159, -125, -50, -13, -36, -42, 14, 105, 212, 311, 353,
601 331, 264, 120, -101, -320, -487, -564, -501, -331, -168, -22,
602 130, 249, 281, 288, 283, 239, 225, 267, 268, 198, 126,
603 28, -139, -302, -389, -442, -438, -302, -96, 102, 291, 438,
604 476, 423, 334, 223, 106, 14, -82, -191, -290, -397, -494,
605 -518, -425, -238, -23, 164, 270, 324, 355, 319, 215, 89,
606 -27, -147, -236, -288, -347, -395, -360, -243, -125, -43, 25,
607 75, 85, 82, 119, 160, 166, 148, 130, 82, 8, -29,
608 -63, -124, -173, -166, -121, -63, 16, 87, 163, 235, 250,
609 217, 191, 187, 142, 76, 12, -71, -137, -169, -189, -183,
610 -106, 8, 87, 134, 154, 99, 45, 84, 178, 241, 277,
611 270, 209, 125, 50, -62, -190, -254, -235, -179, -106, -18,
612 33, 46, 32, 9, -22, -35, -13, 22, 64, 78, 29,
613 -63, -133, -169, -189, -166, -121, -98, -67, -3, 15, 5,
614 44, 100, 108, 108, 114, 64, -46, -141, -245, -316, -233,
615 -59, 21, -10, -20, -6, -7, -6, 7, -3, -2, 9,
616 -2, -25, -17, -1, 1, -8, -1, -5, -11, -13, -10,
617 -14, -12, -3, 11, 6, 2, 1, -9, -13, 0, 11,
618 12, 16, 17, 9, -4, -9, -13, -11, 1, 7, 2,
619 13, 13, -3, 0, 10, 9, 3, 6, 4, -4, -9,
620 -7, -2, 6, 5, -14, -19, -9, -11, -10, -5, -16,
621 -22, -4, 17, 16, 1, -14, -17, -6, 6, 3, -2,
622 -5, -10, -11, -1, -2, -12, -12, -4, 9, 14, 15,
623 6, 9, 13, 7, -6, -5, 5, 3, -6, -10, -14,
624 -11, -4, 4, 3, -1, 3, -1, -12, -13, 2, 9,
625 -1, -7, -1, 1, 1, 12, 7, 2, -1, 3, 3,
626 7, 7, 3, -1, 4, 8, 3, 6, 6, 2, -3,
627 -2, -5, -6, 1, -2, -6, -9, -10, -7, -5, 3,
628 -4, -10, -7, 5, 7, 1, 0, 0, -8, -7, -5,
629 -1, 2, 4, 6, -1, -2, 5, 5, 0, -1, 0,
630 1, -8, -8, -12, -9, -4, -2, -3, -4, -1, 2,
631 3, 3, -3, -4, -5, 3, 6, -1, -5, -14, -13,
632 -12, -13, -11, 0, 9, 13, 10, 9, 7, 1, 1,
633 -2, 1, 3, 3, 2, 0, -2, 0, 0, 3, 1,
634 4, 2, 4, 0, 1, -1, -1, -1, 0, -2, -2,
635 -1, -2, 2, -1, 1, 0, 1, 2, 2, 1, 1,
636 1, 0, -1, -1, 0, -1, 1, -2, 2, 0, 1,
637 0, -1, -1, -1, 1, 0, 0, -1, -2, -2, -1,
638 -2, -1, 2, 1, 3, 0, 3, 0, -1, 1, -1,
639 1, 0, 1, 0, -1, 1, -2, 2, -1, 1, 0,
640 1, 0, 0, 0, 0, 0, -1, 1, -2, 1, -1,
641 1, 0, 0, 0, 0, 0, 0, 1, -1, 1, 0,
642 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1,
643 0, 0, 1, 0, 0, 0, -1, 0, -1, 1, -1,
644 1, 0, -1, 2, -1, 1, -1, 1, -1, 0, 1,
645 -1, 0, 1, -1, 2, -2, 1, -1, 1, -1, 0,
646 1, -1, 1, 0, -1, 1, 0, -1, 1, -1, 0,
647 1, -1, 1, 0, -1, 1, -1, 0, 0, 1, -1,
648 1, -1, 1, 0, -1, 1, -1, 1, 0, -1, 1,
649 -1, 1, -1, 0, 1, -1, 1, -1, 1, -2, 2,
650 -1, 0, 1, -1, 0, 1, -1, 1, 0, 0, 0,
651 0, 0, 0, -1, 1, -1, 1, -1, 1, -1, 1,
652 -1, 1, -1, 0, 1, -2, 2, -1, 0, 0, 1,
653 -1, 1, 0, -1, 0, 0, 1, -2, 2, -1, 0,
654 1, -1, 0, 1, -1, 1, -1, 1, -1, 1, -1,
655 1, -1, 0, 1, -1, 1, 0, -1, 0, 0, 1,
656 -1, 0, 0, 1, -1, 0, 0, 0, 1, -1, 1,
657 -1, 0, 1, -1, 1, -1, 0, 0, 0, 1, -1,
658 1, -1, 1, -1, 1, 0, 0, 0, -1, 0, 1,
659 -1, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1,
660 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1,
661 -1, 0, 1, -1, 1, 0, -1, 1, 0, -1, 1,
662 -1, 1, -1, 1, -1, 1, -1, 0, 1, -2, 2,
663 0, -1, 1, -1, 1, -1, 1, 0, -1, 1, -1,
664 0, 1, -2, 2, -1, 1, 0, 0, 0, -1, 1,
665 -1, 1, -1, 0, 0, 0, 1, -1, 1, 0, -1,
666 1, -1, 0, 1, -1, 1, -1, 1, -1, 0, 1,
667 -1, 1, -1, 0, 0, 1, -1, 1, -1, 0, 1,
668 -2, 2, -1, 0, 1, -2, 2, 0, 0, 0, -1,
669 1, -1, 0, 1, -1, 1, -1, 1, -1, 1, -1,
670 0, 1, -1, 1, -1, 0, 0, 1, -1, 1, -2,
671 2, -2, 3, -3, 3, -2, 0, 1, -1, 0, 0,
672 1, -1, 1, -1, 0, 1, -1, 0, 0, 0, 1,
673 -1, 0, 1, -1, 1, -1, 0, 0, 0, 1, -1,
674 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, -1,
675 1, -1, 1, 0, -1, 1, 0, -1, 1, -1, 0,
676 1, -1, 1, -1, 1, 0, -1, 1, -1, 0, 1,
677 -1, 1, 0, 0, 0, -1, 1, -1, 0, 0, 0,
678 0, 1, -1, 1, 0, -1, 0, 1, -1, 0, 1,
679 -1, 1, -1, 1, -1, 0, 1, -2, 2, -1, 0,
680 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 1,
681 -1, 0, 1, -1, 1, -1, 1, 0, 0, -1, 1,
682 -1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1,
683 -1, 0, 1, -1, 1, -1, 1, -1, 0, 1, -1,
684 0, 1, -1, 1, 0, -1, 1, -1, 0, 1, -2,
685 2, -1, 0, 0, 0, 1, -1, 1, -1, 1, 0,
686 -1, 1, -1, 0, 1, -2, 2, -1, 0, 0, 0,
687 1, -1, 0, 0, 1, -1, 1, 0, -1, 0, 1,
688 -2, 2, -1, 1, 0, -1, 0, 1, -2, 3, -2,
689 1, -1, 1, -2, 2, -2, 2, -1, 1, -1, 1,
690 -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1,
691 0, 0, 1, -1, 1, -2, 2, -1, 1, -1, 1,
692 -1, 0, 1, -2, 2, -1, 1, -1, 0, 0, 0,
693 0, 1, -1, 1, -1, 1, -2, 2, -1, 1, 0,
694 -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 0,
695 1, -1, 1, -1, 1, -1, 0, 0, 0, 1, 0,
696 -1, 1, 0, -1, 1, -2, 2, -2, 2, -1, 0,
697 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 1,
698 0, 0, -1, 1, -1, 1, -1, 1, -1, 0, 0,
699 0, 0, 1, -1, 1, 0, -1, 0, 0, 0, 1,
700 -1, 1, -1, 0, 1, -1, 0
701};
702
703int tock;
163 704
164void draw_display(void){ 705void callback_pcm(unsigned char** start, long* size)
706{
707 if(sound_active) {
708 *start = (unsigned char *)sound;
709 *size = sizeof(sound);
710 sound_active = false;
711 }
712}
713
714void play_tock(void) {
715 sound_active = true;
716 rb->pcm_play_data(callback_pcm);
717 tock++;
718}
719
720#endif
721
722void calc_period(void)
723{
724 period = 61440/bpm-1; // (60*1024)/bpm;
725}
726
727
728void draw_display(void)
729{
165 rb->lcd_clear_display(); 730 rb->lcd_clear_display();
731#ifdef HAVE_REMOTE_LCD
732 rb->lcd_remote_clear_display();
733#endif
166 734
167#ifdef HAVE_LCD_BITMAP 735#ifdef HAVE_LCD_BITMAP
168 rb->lcd_setfont(FONT_SYSFIXED); 736 rb->lcd_setfont(FONT_SYSFIXED);
169 rb->lcd_putsxy(1, 1, "Metronome"); 737 rb->lcd_putsxy(1, 1, "Metronome");
738 rb->lcd_puts(0, 10, "Select to TAP");
739 rb->lcd_puts(0, 12, "Rec to SYNC");
740#endif
741#ifdef HAVE_REMOTE_LCD
742 rb->lcd_remote_putsxy(1, 1, "Metronome");
743 rb->lcd_remote_putsxy(1, 42, "Rec to TAP");
744 rb->lcd_remote_putsxy(1, 52, "Mode to SYNC");
170#endif 745#endif
171 746
172 rb->snprintf(buffer, sizeof(buffer), "BPM: %d ",bpm); 747 rb->snprintf(buffer, sizeof(buffer), "BPM: %d ",bpm);
@@ -175,6 +750,10 @@ void draw_display(void){
175#else 750#else
176 rb->lcd_puts(0,0, buffer); 751 rb->lcd_puts(0,0, buffer);
177#endif 752#endif
753#ifdef HAVE_REMOTE_LCD
754 rb->lcd_remote_putsxy(1, 32, buffer);
755#endif
756
178 rb->snprintf(buffer, sizeof(buffer), "Vol: %d", 757 rb->snprintf(buffer, sizeof(buffer), "Vol: %d",
179 rb->global_settings->volume); 758 rb->global_settings->volume);
180#ifdef HAVE_LCD_BITMAP 759#ifdef HAVE_LCD_BITMAP
@@ -182,15 +761,26 @@ void draw_display(void){
182#else 761#else
183 rb->lcd_puts(0,1, buffer); 762 rb->lcd_puts(0,1, buffer);
184#endif 763#endif
764#ifdef HAVE_REMOTE_LCD
765 rb->lcd_remote_putsxy(60, 32, buffer);
766#endif
185 767
186#ifdef HAVE_LCD_BITMAP 768#ifdef HAVE_LCD_BITMAP
187 rb->lcd_drawline(0, 12, 111, 12); 769 rb->lcd_drawline(0, 12, 111, 12);
188 if(sound_paused) 770 if(sound_paused)
189 rb->lcd_puts(0,2,METRONOME_MSG_START); 771 rb->lcd_puts(0,2,METRONOME_MSG_START);
190 else 772 else
191 rb->lcd_puts(0,2,METRONOME_MSG_STOP); 773 rb->lcd_puts(0,2,METRONOME_MSG_STOP);
192 rb->lcd_update(); 774 rb->lcd_update();
193#endif 775#endif
776#ifdef HAVE_REMOTE_LCD
777 rb->lcd_remote_drawline(0, 12, 111, 12);
778 if(sound_paused)
779 rb->lcd_remote_putsxy(1,20,METRONOME_MSG_START);
780 else
781 rb->lcd_remote_putsxy(1,20,METRONOME_MSG_STOP);
782 rb->lcd_remote_update();
783#endif
194} 784}
195 785
196/* helper function to change the volume by a certain amount, +/- 786/* helper function to change the volume by a certain amount, +/-
@@ -199,34 +789,29 @@ void change_volume(int delta){
199 int minvol = rb->sound_min(SOUND_VOLUME); 789 int minvol = rb->sound_min(SOUND_VOLUME);
200 int maxvol = rb->sound_max(SOUND_VOLUME); 790 int maxvol = rb->sound_max(SOUND_VOLUME);
201 int vol = rb->global_settings->volume + delta; 791 int vol = rb->global_settings->volume + delta;
202 char buffer[30];
203 792
204 if (vol > maxvol) vol = maxvol; 793 if (vol > maxvol) vol = maxvol;
205 else if (vol < minvol) vol = minvol; 794 else if (vol < minvol) vol = minvol;
206 if (vol != rb->global_settings->volume) { 795 if (vol != rb->global_settings->volume) {
207 rb->sound_set(SOUND_VOLUME, vol); 796 rb->sound_set(SOUND_VOLUME, vol);
208 rb->global_settings->volume = vol; 797 rb->global_settings->volume = vol;
209 rb->snprintf(buffer, sizeof(buffer), "Vol: %d ", vol); 798 draw_display();
210#ifdef HAVE_LCD_BITMAP
211 rb->lcd_puts(10,7, buffer);
212 rb->lcd_update();
213#else
214 rb->lcd_puts(0,1, buffer);
215#endif
216 } 799 }
217} 800}
218 801
219void timer_callback(void){ 802void timer_callback(void)
220 if(minitick>=period){ 803{
221 minitick = 0; 804 if(minitick >= period){
222 if(!sound_active && !sound_paused && !tap_count){ 805 minitick = 0;
223 play_tock(); 806 if(!sound_active && !sound_paused && !tap_count) {
807 play_tock();
808 rb->reset_poweroff_timer();
809 }
224 } 810 }
225 }
226 else { 811 else {
227 minitick++; 812 minitick++;
228 } 813 }
229 814
230 if (tap_count) { 815 if (tap_count) {
231 tap_time++; 816 tap_time++;
232 if (tap_count > 1 && tap_time > tap_timeout) 817 if (tap_count > 1 && tap_time > tap_timeout)
@@ -239,7 +824,7 @@ void cleanup(void *parameter)
239 (void)parameter; 824 (void)parameter;
240 825
241 rb->timer_unregister(); 826 rb->timer_unregister();
242 rb->mp3_play_stop(); /* stop audio ISR */ 827 MET_PLAY_STOP; /* stop audio ISR */
243 led(0); 828 led(0);
244} 829}
245 830
@@ -264,7 +849,8 @@ void tap(void)
264 849
265 tap_count++; 850 tap_count++;
266 minitick = 0; /* sync tock to tapping */ 851 minitick = 0; /* sync tock to tapping */
267 852 play_tock();
853
268 reset_tap = false; 854 reset_tap = false;
269} 855}
270 856
@@ -275,14 +861,17 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter){
275 (void)parameter; 861 (void)parameter;
276 rb = api; 862 rb = api;
277 863
864 if (MET_IS_PLAYING)
865 MET_PLAY_STOP; // stop audio ISR
866
867#if CONFIG_CODEC != SWCODEC
278 rb->bitswap(sound, sizeof(sound)); 868 rb->bitswap(sound, sizeof(sound));
279 869#else
280 if (rb->mp3_is_playing()) 870 rb->pcm_set_frequency(44100);
281 rb->mp3_play_stop(); // stop audio ISR 871#endif
282 872
283 calc_period(); 873 calc_period();
284 rb->timer_register(1, NULL, (*rb->cpu_frequency)/1024, 1, timer_callback); 874 rb->timer_register(1, NULL, CPU_FREQ/1024, 1, timer_callback);
285
286 draw_display(); 875 draw_display();
287 876
288 /* main loop */ 877 /* main loop */
@@ -290,6 +879,52 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter){
290 reset_tap = true; 879 reset_tap = true;
291 880
292 button = rb->button_get(true); 881 button = rb->button_get(true);
882
883#if CONFIG_REMOTE_KEYPAD == H100_REMOTE
884 if(button && BUTTON_REMOTE) {
885 switch(button) {
886 case BUTTON_RC_STOP:
887 button = METRONOME_QUIT;
888 break;
889 case BUTTON_RC_ON:
890 button = METRONOME_PLAYPAUSE;
891 break;
892 case BUTTON_RC_VOL_UP:
893 button = METRONOME_VOL_UP;
894 break;
895 case BUTTON_RC_VOL_UP | BUTTON_REPEAT:
896 button = METRONOME_VOL_UP | BUTTON_REPEAT;
897 break;
898 case BUTTON_RC_VOL_DOWN:
899 button = METRONOME_VOL_DOWN;
900 break;
901 case BUTTON_RC_VOL_DOWN | BUTTON_REPEAT:
902 button = METRONOME_VOL_DOWN | BUTTON_REPEAT;
903 break;
904 case BUTTON_RC_FF:
905 button = BUTTON_RIGHT;
906 break;
907 case BUTTON_RC_FF | BUTTON_REPEAT:
908 button = BUTTON_RIGHT | BUTTON_REPEAT;
909 break;
910 case BUTTON_RC_REW:
911 button = BUTTON_LEFT;
912 break;
913 case BUTTON_RC_REW | BUTTON_REPEAT:
914 button = BUTTON_LEFT | BUTTON_REPEAT;
915 break;
916 case BUTTON_RC_MODE:
917 button = METRONOME_SYNC;
918 break;
919 case BUTTON_RC_REC:
920 case BUTTON_RC_SOURCE:
921 case BUTTON_RC_MENU:
922 case BUTTON_RC_BITRATE:
923 button = METRONOME_TAP;
924 break;
925 }
926 }
927#endif
293 928
294 switch (button) { 929 switch (button) {
295 930
@@ -371,7 +1006,13 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter){
371 tap(); 1006 tap();
372 break; 1007 break;
373#endif 1008#endif
374 1009
1010#ifdef METRONOME_SYNC
1011 case METRONOME_SYNC:
1012 minitick = period;
1013 break;
1014#endif
1015
375 default: 1016 default:
376 if (rb->default_event_handler_ex(button, cleanup, NULL) 1017 if (rb->default_event_handler_ex(button, cleanup, NULL)
377 == SYS_USB_CONNECTED) 1018 == SYS_USB_CONNECTED)