diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-11-10 16:42:31 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-11-10 16:42:31 +0000 |
commit | 1325c9d9febf3f1544b7530feda11baf0af37bb6 (patch) | |
tree | eedf4dc5614740ff34871ed6b7bf432190a47839 | |
parent | 893095d4cea12ce8d480e1ecb9397ce72d2e623e (diff) | |
download | rockbox-1325c9d9febf3f1544b7530feda11baf0af37bb6.tar.gz rockbox-1325c9d9febf3f1544b7530feda11baf0af37bb6.zip |
Added recording functionality
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2816 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/lang/english.lang | 40 | ||||
-rw-r--r-- | apps/main_menu.c | 7 | ||||
-rw-r--r-- | apps/recorder/recording.c | 528 | ||||
-rw-r--r-- | apps/recorder/recording.h | 24 |
4 files changed, 599 insertions, 0 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 3b036725b5..d190614a78 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -1082,3 +1082,43 @@ id: LANG_PM_MAX | |||
1082 | desc: in the peak meter menu | 1082 | desc: in the peak meter menu |
1083 | eng: "Maximum of range" | 1083 | eng: "Maximum of range" |
1084 | new: | 1084 | new: |
1085 | |||
1086 | id: LANG_RECORDING | ||
1087 | desc: in the main menu | ||
1088 | eng: "Recording" | ||
1089 | new: | ||
1090 | |||
1091 | id: LANG_RECORDING_GAIN | ||
1092 | desc: in the recording screen | ||
1093 | eng: "Gain" | ||
1094 | new: | ||
1095 | |||
1096 | id: LANG_RECORDING_LEFT | ||
1097 | desc: in the recording screen | ||
1098 | eng: "Left" | ||
1099 | new: | ||
1100 | |||
1101 | id: LANG_RECORDING_RIGHT | ||
1102 | desc: in the recording screen | ||
1103 | eng: "Right" | ||
1104 | new: | ||
1105 | |||
1106 | id: LANG_RECORDING_QUALITY | ||
1107 | desc: in the recording settings | ||
1108 | eng: "Quality" | ||
1109 | new: | ||
1110 | |||
1111 | id: LANG_RECORDING_FREQUENCY | ||
1112 | desc: in the recording settings | ||
1113 | eng: "Frequency" | ||
1114 | new: | ||
1115 | |||
1116 | id: LANG_RECORDING_SOURCE | ||
1117 | desc: in the recording settings | ||
1118 | eng: "Source" | ||
1119 | new: | ||
1120 | |||
1121 | id: LANG_RECORDING_CHANNEL | ||
1122 | desc: in the recording settings | ||
1123 | eng: "Channel" | ||
1124 | new: | ||
diff --git a/apps/main_menu.c b/apps/main_menu.c index 9a31687500..5399c996c9 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c | |||
@@ -41,6 +41,10 @@ | |||
41 | 41 | ||
42 | #include "lang.h" | 42 | #include "lang.h" |
43 | 43 | ||
44 | #ifdef HAVE_MAS3587F | ||
45 | #include "recording.h" | ||
46 | #endif | ||
47 | |||
44 | #ifdef HAVE_LCD_BITMAP | 48 | #ifdef HAVE_LCD_BITMAP |
45 | #include "bmp.h" | 49 | #include "bmp.h" |
46 | #include "icons.h" | 50 | #include "icons.h" |
@@ -223,6 +227,9 @@ bool main_menu(void) | |||
223 | struct menu_items items[] = { | 227 | struct menu_items items[] = { |
224 | { str(LANG_SOUND_SETTINGS), sound_menu }, | 228 | { str(LANG_SOUND_SETTINGS), sound_menu }, |
225 | { str(LANG_GENERAL_SETTINGS), settings_menu }, | 229 | { str(LANG_GENERAL_SETTINGS), settings_menu }, |
230 | #ifdef HAVE_MAS3587F | ||
231 | { str(LANG_RECORDING), recording_screen }, | ||
232 | #endif | ||
226 | #ifdef HAVE_LCD_BITMAP | 233 | #ifdef HAVE_LCD_BITMAP |
227 | #ifdef USE_GAMES | 234 | #ifdef USE_GAMES |
228 | { str(LANG_GAMES), games_menu }, | 235 | { str(LANG_GAMES), games_menu }, |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c new file mode 100644 index 0000000000..3ec4249f3c --- /dev/null +++ b/apps/recorder/recording.c | |||
@@ -0,0 +1,528 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "config.h" | ||
21 | |||
22 | #include <stdio.h> | ||
23 | #include <stdbool.h> | ||
24 | |||
25 | #include "system.h" | ||
26 | #include "lcd.h" | ||
27 | #include "mpeg.h" | ||
28 | #include "button.h" | ||
29 | #include "kernel.h" | ||
30 | #include "settings.h" | ||
31 | #include "lang.h" | ||
32 | #include "font.h" | ||
33 | #include "icons.h" | ||
34 | #include "screens.h" | ||
35 | #include "peakmeter.h" | ||
36 | #include "status.h" | ||
37 | #include "menu.h" | ||
38 | |||
39 | bool f2_rec_screen(void); | ||
40 | bool f3_rec_screen(void); | ||
41 | |||
42 | extern int recording_peak_left; | ||
43 | extern int recording_peak_right; | ||
44 | |||
45 | extern int mp3buf_write; | ||
46 | extern int mp3buf_read; | ||
47 | extern bool recording; | ||
48 | |||
49 | int mic_gain = 8; | ||
50 | int left_gain = 2; | ||
51 | int right_gain = 2; | ||
52 | unsigned int recording_quality = 5; | ||
53 | unsigned int recording_frequency = 0; | ||
54 | unsigned int recording_channel_mode = 0; | ||
55 | unsigned int recording_source = 0; | ||
56 | |||
57 | #define SOURCE_MIC 0 | ||
58 | #define SOURCE_LINE 1 | ||
59 | #define SOURCE_SPDIF 2 | ||
60 | |||
61 | char *freq_str[6] = | ||
62 | { | ||
63 | "44.1kHz", | ||
64 | "48kHz", | ||
65 | "32kHz", | ||
66 | "22.05kHz", | ||
67 | "24kHz", | ||
68 | "16kHz" | ||
69 | }; | ||
70 | |||
71 | static void set_gain(void) | ||
72 | { | ||
73 | if(recording_source == SOURCE_MIC) | ||
74 | { | ||
75 | mpeg_set_recording_gain(left_gain, 0, mic_gain); | ||
76 | } | ||
77 | else | ||
78 | { | ||
79 | mpeg_set_recording_gain(left_gain, right_gain, 0); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | static char *fmtstr[] = | ||
84 | { | ||
85 | "", /* no decimals */ | ||
86 | "%d.%d %s ", /* 1 decimal */ | ||
87 | "%d.%02d %s " /* 2 decimals */ | ||
88 | }; | ||
89 | |||
90 | char *fmt_gain(int snd, int val, char *str, int len) | ||
91 | { | ||
92 | int tmp, i, d, numdec; | ||
93 | char *unit; | ||
94 | |||
95 | tmp = mpeg_val2phys(snd, val); | ||
96 | numdec = mpeg_sound_numdecimals(snd); | ||
97 | unit = mpeg_sound_unit(snd); | ||
98 | |||
99 | i = tmp / (10*numdec); | ||
100 | d = tmp % (10*numdec); | ||
101 | |||
102 | snprintf(str, len, fmtstr[numdec], i, d, unit); | ||
103 | return str; | ||
104 | } | ||
105 | |||
106 | int cursor; | ||
107 | |||
108 | void adjust_cursor(void) | ||
109 | { | ||
110 | if(recording_source == SOURCE_LINE) | ||
111 | { | ||
112 | if(cursor < 0) | ||
113 | cursor = 0; | ||
114 | |||
115 | if(cursor > 2) | ||
116 | cursor = 2; | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | cursor = 0; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | bool recording_screen(void) | ||
125 | { | ||
126 | int button; | ||
127 | bool done = false; | ||
128 | char buf[32]; | ||
129 | char buf2[32]; | ||
130 | long timeout = current_tick + HZ/10; | ||
131 | int gain; | ||
132 | int w, h; | ||
133 | int update_countdown = 1; | ||
134 | |||
135 | cursor = 0; | ||
136 | mpeg_init_recording(); | ||
137 | status_set_playmode(STATUS_STOP); | ||
138 | |||
139 | peak_meter_playback(false); | ||
140 | |||
141 | peak_meter_enabled = true; | ||
142 | |||
143 | mpeg_set_recording_options(recording_frequency, recording_quality, | ||
144 | recording_source, recording_channel_mode); | ||
145 | |||
146 | lcd_setfont(FONT_UI); | ||
147 | lcd_getstringsize("M", &w, &h); | ||
148 | lcd_setmargins(w, 8); | ||
149 | |||
150 | while(!done) | ||
151 | { | ||
152 | button = button_get(false); | ||
153 | switch(button) | ||
154 | { | ||
155 | case BUTTON_OFF: | ||
156 | if(mpeg_status()) | ||
157 | { | ||
158 | mpeg_stop(); | ||
159 | status_set_playmode(STATUS_STOP); | ||
160 | } | ||
161 | else | ||
162 | { | ||
163 | peak_meter_playback(true); | ||
164 | peak_meter_enabled = false; | ||
165 | done = true; | ||
166 | } | ||
167 | update_countdown = 1; /* Update immediately */ | ||
168 | break; | ||
169 | |||
170 | case BUTTON_PLAY: | ||
171 | mpeg_record(""); | ||
172 | status_set_playmode(STATUS_RECORD); | ||
173 | update_countdown = 1; /* Update immediately */ | ||
174 | break; | ||
175 | |||
176 | case BUTTON_UP: | ||
177 | cursor--; | ||
178 | adjust_cursor(); | ||
179 | update_countdown = 1; /* Update immediately */ | ||
180 | break; | ||
181 | |||
182 | case BUTTON_DOWN: | ||
183 | cursor++; | ||
184 | adjust_cursor(); | ||
185 | update_countdown = 1; /* Update immediately */ | ||
186 | break; | ||
187 | |||
188 | case BUTTON_RIGHT: | ||
189 | switch(cursor) | ||
190 | { | ||
191 | case 0: | ||
192 | if(recording_source == SOURCE_MIC) | ||
193 | { | ||
194 | mic_gain++; | ||
195 | if(mic_gain > mpeg_sound_max(SOUND_MIC_GAIN)) | ||
196 | mic_gain = mpeg_sound_max(SOUND_MIC_GAIN); | ||
197 | } | ||
198 | else | ||
199 | { | ||
200 | gain = MAX(left_gain, right_gain) + 1; | ||
201 | if(gain > mpeg_sound_max(SOUND_MIC_GAIN)) | ||
202 | gain = mpeg_sound_max(SOUND_MIC_GAIN); | ||
203 | left_gain = gain; | ||
204 | right_gain = gain; | ||
205 | } | ||
206 | break; | ||
207 | case 1: | ||
208 | left_gain++; | ||
209 | if(left_gain > mpeg_sound_max(SOUND_LEFT_GAIN)) | ||
210 | left_gain = mpeg_sound_max(SOUND_LEFT_GAIN); | ||
211 | break; | ||
212 | case 2: | ||
213 | right_gain++; | ||
214 | if(right_gain > mpeg_sound_max(SOUND_RIGHT_GAIN)) | ||
215 | right_gain = mpeg_sound_max(SOUND_RIGHT_GAIN); | ||
216 | break; | ||
217 | } | ||
218 | set_gain(); | ||
219 | update_countdown = 1; /* Update immediately */ | ||
220 | break; | ||
221 | |||
222 | case BUTTON_LEFT: | ||
223 | switch(cursor) | ||
224 | { | ||
225 | case 0: | ||
226 | if(recording_source == SOURCE_MIC) | ||
227 | { | ||
228 | mic_gain--; | ||
229 | if(mic_gain < mpeg_sound_min(SOUND_MIC_GAIN)) | ||
230 | mic_gain = mpeg_sound_min(SOUND_MIC_GAIN); | ||
231 | } | ||
232 | else | ||
233 | { | ||
234 | gain = MAX(left_gain, right_gain) - 1; | ||
235 | if(gain < mpeg_sound_min(SOUND_LEFT_GAIN)) | ||
236 | gain = mpeg_sound_min(SOUND_LEFT_GAIN); | ||
237 | left_gain = gain; | ||
238 | right_gain = gain; | ||
239 | } | ||
240 | break; | ||
241 | case 1: | ||
242 | left_gain--; | ||
243 | if(left_gain < mpeg_sound_min(SOUND_LEFT_GAIN)) | ||
244 | left_gain = mpeg_sound_min(SOUND_LEFT_GAIN); | ||
245 | break; | ||
246 | case 2: | ||
247 | right_gain--; | ||
248 | if(right_gain < mpeg_sound_min(SOUND_MIC_GAIN)) | ||
249 | right_gain = mpeg_sound_min(SOUND_MIC_GAIN); | ||
250 | break; | ||
251 | } | ||
252 | set_gain(); | ||
253 | update_countdown = 1; /* Update immediately */ | ||
254 | break; | ||
255 | |||
256 | case BUTTON_F2: | ||
257 | if (f2_rec_screen()) | ||
258 | return SYS_USB_CONNECTED; | ||
259 | update_countdown = 1; /* Update immediately */ | ||
260 | break; | ||
261 | |||
262 | case BUTTON_F3: | ||
263 | if (f3_rec_screen()) | ||
264 | return SYS_USB_CONNECTED; | ||
265 | update_countdown = 1; /* Update immediately */ | ||
266 | break; | ||
267 | |||
268 | } | ||
269 | |||
270 | peak_meter_peek(); | ||
271 | |||
272 | if(TIME_AFTER(current_tick, timeout)) | ||
273 | { | ||
274 | timeout = current_tick + HZ/10; | ||
275 | |||
276 | update_countdown--; | ||
277 | if(update_countdown == 0) | ||
278 | { | ||
279 | update_countdown = 10; | ||
280 | |||
281 | lcd_clear_display(); | ||
282 | peak_meter_draw(0, 8 + h, LCD_WIDTH, h); | ||
283 | |||
284 | /* Show mic gain if input source is Mic */ | ||
285 | if(recording_source == 0) | ||
286 | { | ||
287 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), | ||
288 | fmt_gain(SOUND_MIC_GAIN, mic_gain, | ||
289 | buf2, sizeof(buf2))); | ||
290 | lcd_puts(0, 3, buf); | ||
291 | } | ||
292 | else | ||
293 | { | ||
294 | if(recording_source == SOURCE_LINE) | ||
295 | { | ||
296 | gain = MAX(left_gain, right_gain); | ||
297 | |||
298 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), | ||
299 | fmt_gain(SOUND_LEFT_GAIN, gain, | ||
300 | buf2, sizeof(buf2))); | ||
301 | lcd_puts(0, 3, buf); | ||
302 | |||
303 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_LEFT), | ||
304 | fmt_gain(SOUND_LEFT_GAIN, left_gain, | ||
305 | buf2, sizeof(buf2))); | ||
306 | lcd_puts(0, 4, buf); | ||
307 | |||
308 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_RIGHT), | ||
309 | fmt_gain(SOUND_RIGHT_GAIN, right_gain, | ||
310 | buf2, sizeof(buf2))); | ||
311 | lcd_puts(0, 5, buf); | ||
312 | } | ||
313 | } | ||
314 | |||
315 | status_draw(); | ||
316 | |||
317 | if(recording_source != SOURCE_SPDIF) | ||
318 | put_cursorxy(0, 3 + cursor, true); | ||
319 | |||
320 | snprintf(buf, 32, "%s %s [%d]", | ||
321 | freq_str[recording_frequency], | ||
322 | recording_channel_mode? | ||
323 | str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO), | ||
324 | recording_quality); | ||
325 | lcd_puts(0, 6, buf); | ||
326 | } | ||
327 | else | ||
328 | { | ||
329 | lcd_clearrect(0, 8 + h, LCD_WIDTH, h); | ||
330 | peak_meter_draw(0, 8 + h, LCD_WIDTH, h); | ||
331 | lcd_update_rect(0, 8 + h, LCD_WIDTH, h); | ||
332 | } | ||
333 | lcd_update(); | ||
334 | } | ||
335 | } | ||
336 | |||
337 | mpeg_init_playback(); | ||
338 | |||
339 | return false; | ||
340 | } | ||
341 | |||
342 | bool f2_rec_screen(void) | ||
343 | { | ||
344 | bool exit = false; | ||
345 | bool used = false; | ||
346 | int w, h; | ||
347 | char buf[32]; | ||
348 | |||
349 | lcd_setfont(FONT_SYSFIXED); | ||
350 | lcd_getstringsize("A",&w,&h); | ||
351 | lcd_stop_scroll(); | ||
352 | |||
353 | while (!exit) { | ||
354 | char* ptr=NULL; | ||
355 | |||
356 | lcd_clear_display(); | ||
357 | |||
358 | /* Recording quality */ | ||
359 | lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_QUALITY)); | ||
360 | snprintf(buf, 32, "%d", recording_quality); | ||
361 | lcd_putsxy(0, LCD_HEIGHT/2-h, buf); | ||
362 | lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], | ||
363 | LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); | ||
364 | |||
365 | /* Frequency */ | ||
366 | snprintf(buf, sizeof buf, "%s:", str(LANG_RECORDING_FREQUENCY)); | ||
367 | lcd_getstringsize(buf,&w,&h); | ||
368 | lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf); | ||
369 | ptr = freq_str[recording_frequency]; | ||
370 | lcd_getstringsize(ptr, &w, &h); | ||
371 | lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr); | ||
372 | lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], | ||
373 | LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true); | ||
374 | |||
375 | /* Channel mode */ | ||
376 | switch ( recording_channel_mode ) { | ||
377 | case 0: | ||
378 | ptr = str(LANG_CHANNEL_STEREO); | ||
379 | break; | ||
380 | |||
381 | case 1: | ||
382 | ptr = str(LANG_CHANNEL_MONO); | ||
383 | break; | ||
384 | } | ||
385 | |||
386 | lcd_getstringsize(str(LANG_RECORDING_CHANNEL), &w, &h); | ||
387 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, | ||
388 | str(LANG_RECORDING_CHANNEL)); | ||
389 | lcd_getstringsize(str(LANG_F2_MODE), &w, &h); | ||
390 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); | ||
391 | lcd_getstringsize(ptr, &w, &h); | ||
392 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr); | ||
393 | lcd_bitmap(bitmap_icons_7x8[Icon_FastForward], | ||
394 | LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true); | ||
395 | |||
396 | lcd_update(); | ||
397 | |||
398 | switch (button_get(true)) { | ||
399 | case BUTTON_LEFT: | ||
400 | case BUTTON_F2 | BUTTON_LEFT: | ||
401 | recording_quality++; | ||
402 | if(recording_quality > 7) | ||
403 | recording_quality = 0; | ||
404 | used = true; | ||
405 | break; | ||
406 | |||
407 | case BUTTON_DOWN: | ||
408 | case BUTTON_F2 | BUTTON_DOWN: | ||
409 | recording_frequency++; | ||
410 | if(recording_frequency > 5) | ||
411 | recording_frequency = 0; | ||
412 | used = true; | ||
413 | break; | ||
414 | |||
415 | case BUTTON_RIGHT: | ||
416 | case BUTTON_F2 | BUTTON_RIGHT: | ||
417 | recording_channel_mode++; | ||
418 | if(recording_channel_mode > 1) | ||
419 | recording_channel_mode = 0; | ||
420 | used = true; | ||
421 | break; | ||
422 | |||
423 | case BUTTON_F2 | BUTTON_REL: | ||
424 | if ( used ) | ||
425 | exit = true; | ||
426 | used = true; | ||
427 | break; | ||
428 | |||
429 | case BUTTON_F2 | BUTTON_REPEAT: | ||
430 | used = true; | ||
431 | break; | ||
432 | |||
433 | case SYS_USB_CONNECTED: | ||
434 | usb_screen(); | ||
435 | return true; | ||
436 | } | ||
437 | } | ||
438 | |||
439 | mpeg_set_recording_options(recording_frequency, recording_quality, | ||
440 | recording_source, recording_channel_mode); | ||
441 | |||
442 | // settings_save(); | ||
443 | lcd_setfont(FONT_UI); | ||
444 | |||
445 | return false; | ||
446 | } | ||
447 | |||
448 | char *src_str[] = | ||
449 | { | ||
450 | "Mic", | ||
451 | "Line In", | ||
452 | "Digital" | ||
453 | }; | ||
454 | |||
455 | bool f3_rec_screen(void) | ||
456 | { | ||
457 | bool exit = false; | ||
458 | bool used = false; | ||
459 | int w, h; | ||
460 | |||
461 | lcd_setfont(FONT_SYSFIXED); | ||
462 | lcd_getstringsize("A",&w,&h); | ||
463 | lcd_stop_scroll(); | ||
464 | |||
465 | while (!exit) { | ||
466 | char* ptr=NULL; | ||
467 | |||
468 | lcd_clear_display(); | ||
469 | |||
470 | /* Recording source */ | ||
471 | lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_SOURCE)); | ||
472 | ptr = src_str[recording_source]; | ||
473 | lcd_getstringsize(ptr, &w, &h); | ||
474 | lcd_putsxy(0, LCD_HEIGHT/2-h, ptr); | ||
475 | lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], | ||
476 | LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); | ||
477 | |||
478 | lcd_update(); | ||
479 | |||
480 | switch (button_get(true)) { | ||
481 | case BUTTON_LEFT: | ||
482 | case BUTTON_F3 | BUTTON_LEFT: | ||
483 | recording_source++; | ||
484 | if(recording_source > 2) | ||
485 | recording_source = 0; | ||
486 | used = true; | ||
487 | break; | ||
488 | |||
489 | case BUTTON_DOWN: | ||
490 | case BUTTON_F3 | BUTTON_DOWN: | ||
491 | recording_frequency++; | ||
492 | if(recording_frequency > 5) | ||
493 | recording_frequency = 0; | ||
494 | used = true; | ||
495 | break; | ||
496 | |||
497 | case BUTTON_RIGHT: | ||
498 | case BUTTON_F3 | BUTTON_RIGHT: | ||
499 | recording_channel_mode++; | ||
500 | if(recording_channel_mode > 1) | ||
501 | recording_channel_mode = 0; | ||
502 | used = true; | ||
503 | break; | ||
504 | |||
505 | case BUTTON_F3 | BUTTON_REL: | ||
506 | if ( used ) | ||
507 | exit = true; | ||
508 | used = true; | ||
509 | break; | ||
510 | |||
511 | case BUTTON_F3 | BUTTON_REPEAT: | ||
512 | used = true; | ||
513 | break; | ||
514 | |||
515 | case SYS_USB_CONNECTED: | ||
516 | usb_screen(); | ||
517 | return true; | ||
518 | } | ||
519 | } | ||
520 | |||
521 | mpeg_set_recording_options(recording_frequency, recording_quality, | ||
522 | recording_source, recording_channel_mode); | ||
523 | |||
524 | // settings_save(); | ||
525 | lcd_setfont(FONT_UI); | ||
526 | |||
527 | return false; | ||
528 | } | ||
diff --git a/apps/recorder/recording.h b/apps/recorder/recording.h new file mode 100644 index 0000000000..4818b42b1f --- /dev/null +++ b/apps/recorder/recording.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef RECORDING_H | ||
20 | #define RECORDING_H | ||
21 | |||
22 | bool recording_screen(void); | ||
23 | |||
24 | #endif | ||