diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2003-11-20 00:33:43 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2003-11-20 00:33:43 +0000 |
commit | aaa99e70ba738cd29f9d1b627d8bf47de1160d3b (patch) | |
tree | 0762ce59af3ee7e5cc27f9c93249701d2e1420e6 | |
parent | 577e571958ab43afb9ffd2526811053731e8d7c1 (diff) | |
download | rockbox-aaa99e70ba738cd29f9d1b627d8bf47de1160d3b.tar.gz rockbox-aaa99e70ba738cd29f9d1b627d8bf47de1160d3b.zip |
Recording in FM screen, USB mode possible in FM and recording screen
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4046 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/lang/english.lang | 10 | ||||
-rw-r--r-- | apps/main_menu.c | 9 | ||||
-rw-r--r-- | apps/recorder/radio.c | 160 | ||||
-rw-r--r-- | apps/recorder/recording.c | 95 | ||||
-rw-r--r-- | apps/settings.c | 26 | ||||
-rw-r--r-- | apps/settings.h | 4 | ||||
-rw-r--r-- | apps/sound_menu.c | 31 | ||||
-rw-r--r-- | apps/sound_menu.h | 2 | ||||
-rw-r--r-- | firmware/mpeg.c | 17 |
9 files changed, 264 insertions, 90 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 2c84763263..0a1cfaeb51 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -1817,3 +1817,13 @@ id: LANG_FM_NO_FREE_PRESETS | |||
1817 | desc: in radio screen | 1817 | desc: in radio screen |
1818 | eng: "The preset list is full" | 1818 | eng: "The preset list is full" |
1819 | new: | 1819 | new: |
1820 | |||
1821 | id: LANG_FM_RADIO | ||
1822 | desc: in main menu | ||
1823 | eng: "FM Radio" | ||
1824 | new: | ||
1825 | |||
1826 | id: LANG_FM_BUTTONBAR_RECORD | ||
1827 | desc: in main menu | ||
1828 | eng: "Record" | ||
1829 | new: | ||
diff --git a/apps/main_menu.c b/apps/main_menu.c index 01aa3dc30c..9a351928ac 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c | |||
@@ -252,6 +252,11 @@ static bool plugin_browse(void) | |||
252 | return rockbox_browse(PLUGIN_DIR, SHOW_PLUGINS); | 252 | return rockbox_browse(PLUGIN_DIR, SHOW_PLUGINS); |
253 | } | 253 | } |
254 | 254 | ||
255 | static bool recording_settings(void) | ||
256 | { | ||
257 | return recording_menu(false); | ||
258 | } | ||
259 | |||
255 | bool main_menu(void) | 260 | bool main_menu(void) |
256 | { | 261 | { |
257 | int m; | 262 | int m; |
@@ -262,11 +267,11 @@ bool main_menu(void) | |||
262 | { str(LANG_SOUND_SETTINGS), sound_menu }, | 267 | { str(LANG_SOUND_SETTINGS), sound_menu }, |
263 | { str(LANG_GENERAL_SETTINGS), settings_menu }, | 268 | { str(LANG_GENERAL_SETTINGS), settings_menu }, |
264 | #ifdef HAVE_FMRADIO | 269 | #ifdef HAVE_FMRADIO |
265 | { "FM Radio", radio_screen }, | 270 | { str(LANG_FM_RADIO), radio_screen }, |
266 | #endif | 271 | #endif |
267 | #ifdef HAVE_MAS3587F | 272 | #ifdef HAVE_MAS3587F |
268 | { str(LANG_RECORDING), recording_screen }, | 273 | { str(LANG_RECORDING), recording_screen }, |
269 | { str(LANG_RECORDING_SETTINGS), recording_menu }, | 274 | { str(LANG_RECORDING_SETTINGS), recording_settings}, |
270 | #endif | 275 | #endif |
271 | { str(LANG_PLAYLIST_MENU), playlist_menu }, | 276 | { str(LANG_PLAYLIST_MENU), playlist_menu }, |
272 | { str(LANG_MENU_SHOW_ID3_INFO), browse_id3 }, | 277 | { str(LANG_MENU_SHOW_ID3_INFO), browse_id3 }, |
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 9688a3a727..44b1661aac 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -43,6 +43,8 @@ | |||
43 | #include "peakmeter.h" | 43 | #include "peakmeter.h" |
44 | #include "lang.h" | 44 | #include "lang.h" |
45 | #include "font.h" | 45 | #include "font.h" |
46 | #include "sound_menu.h" | ||
47 | #include "recording.h" | ||
46 | 48 | ||
47 | #ifdef HAVE_FMRADIO | 49 | #ifdef HAVE_FMRADIO |
48 | 50 | ||
@@ -116,6 +118,11 @@ bool radio_screen(void) | |||
116 | bool update_screen = true; | 118 | bool update_screen = true; |
117 | int timeout = current_tick + HZ/10; | 119 | int timeout = current_tick + HZ/10; |
118 | bool screen_freeze = false; | 120 | bool screen_freeze = false; |
121 | bool have_recorded = false; | ||
122 | unsigned int seconds; | ||
123 | unsigned int last_seconds = 0; | ||
124 | int hours, minutes; | ||
125 | bool keep_playing = false; | ||
119 | 126 | ||
120 | lcd_clear_display(); | 127 | lcd_clear_display(); |
121 | lcd_setmargins(0, 8); | 128 | lcd_setmargins(0, 8); |
@@ -133,11 +140,27 @@ bool radio_screen(void) | |||
133 | 140 | ||
134 | mpeg_stop(); | 141 | mpeg_stop(); |
135 | 142 | ||
136 | /* Enable the Left and right A/D Converter */ | 143 | mpeg_init_recording(); |
137 | mas_codec_writereg(0x0, 0x2227); | ||
138 | 144 | ||
139 | mas_codec_writereg(6, 0x4000); | 145 | mpeg_sound_set(SOUND_VOLUME, global_settings.volume); |
146 | |||
147 | status_set_playmode(STATUS_STOP); | ||
148 | |||
149 | /* Yes, we use the D/A for monitoring */ | ||
150 | peak_meter_playback(true); | ||
151 | |||
152 | peak_meter_enabled = true; | ||
140 | 153 | ||
154 | mpeg_set_recording_options(global_settings.rec_frequency, | ||
155 | global_settings.rec_quality, | ||
156 | 1 /* Line In */, | ||
157 | global_settings.rec_channels, | ||
158 | global_settings.rec_editable); | ||
159 | |||
160 | |||
161 | mpeg_set_recording_gain(mpeg_sound_default(SOUND_LEFT_GAIN), | ||
162 | mpeg_sound_default(SOUND_RIGHT_GAIN), false); | ||
163 | |||
141 | fmradio_set(2, 0x140884); /* 5kHz, 7.2MHz crystal */ | 164 | fmradio_set(2, 0x140884); /* 5kHz, 7.2MHz crystal */ |
142 | radio_set_frequency(curr_freq); | 165 | radio_set_frequency(curr_freq); |
143 | curr_preset = find_preset(curr_freq); | 166 | curr_preset = find_preset(curr_freq); |
@@ -147,7 +170,7 @@ bool radio_screen(void) | |||
147 | peak_meter_enabled = true; | 170 | peak_meter_enabled = true; |
148 | 171 | ||
149 | buttonbar_set(str(LANG_BUTTONBAR_MENU), str(LANG_FM_BUTTONBAR_PRESETS), | 172 | buttonbar_set(str(LANG_BUTTONBAR_MENU), str(LANG_FM_BUTTONBAR_PRESETS), |
150 | NULL); | 173 | str(LANG_FM_BUTTONBAR_RECORD)); |
151 | 174 | ||
152 | while(!done) | 175 | while(!done) |
153 | { | 176 | { |
@@ -188,16 +211,39 @@ bool radio_screen(void) | |||
188 | switch(button) | 211 | switch(button) |
189 | { | 212 | { |
190 | case BUTTON_OFF: | 213 | case BUTTON_OFF: |
191 | radio_stop(); | 214 | if(mpeg_status()) |
215 | { | ||
216 | mpeg_stop(); | ||
217 | status_set_playmode(STATUS_STOP); | ||
218 | } | ||
219 | else | ||
220 | { | ||
221 | radio_stop(); | ||
222 | done = true; | ||
223 | } | ||
224 | update_screen = true; | ||
225 | break; | ||
192 | 226 | ||
193 | /* Turn off the ADC gain */ | 227 | case BUTTON_F3: |
194 | mas_codec_writereg(6, 0x0000); | 228 | /* Only act if the mpeg is stopped */ |
195 | 229 | if(!mpeg_status()) | |
196 | done = true; | 230 | { |
231 | have_recorded = true; | ||
232 | mpeg_record(rec_create_filename()); | ||
233 | status_set_playmode(STATUS_RECORD); | ||
234 | update_screen = true; | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | mpeg_new_file(rec_create_filename()); | ||
239 | update_screen = true; | ||
240 | } | ||
241 | last_seconds = 0; | ||
197 | break; | 242 | break; |
198 | 243 | ||
199 | case BUTTON_ON | BUTTON_REL: | 244 | case BUTTON_ON | BUTTON_REL: |
200 | done = true; | 245 | done = true; |
246 | keep_playing = true; | ||
201 | break; | 247 | break; |
202 | 248 | ||
203 | case BUTTON_LEFT: | 249 | case BUTTON_LEFT: |
@@ -257,7 +303,7 @@ bool radio_screen(void) | |||
257 | lcd_setmargins(0, 8); | 303 | lcd_setmargins(0, 8); |
258 | buttonbar_set(str(LANG_BUTTONBAR_MENU), | 304 | buttonbar_set(str(LANG_BUTTONBAR_MENU), |
259 | str(LANG_FM_BUTTONBAR_PRESETS), | 305 | str(LANG_FM_BUTTONBAR_PRESETS), |
260 | NULL); | 306 | str(LANG_FM_BUTTONBAR_RECORD)); |
261 | update_screen = true; | 307 | update_screen = true; |
262 | break; | 308 | break; |
263 | 309 | ||
@@ -268,11 +314,11 @@ bool radio_screen(void) | |||
268 | lcd_setmargins(0, 8); | 314 | lcd_setmargins(0, 8); |
269 | buttonbar_set(str(LANG_BUTTONBAR_MENU), | 315 | buttonbar_set(str(LANG_BUTTONBAR_MENU), |
270 | str(LANG_FM_BUTTONBAR_PRESETS), | 316 | str(LANG_FM_BUTTONBAR_PRESETS), |
271 | NULL); | 317 | str(LANG_FM_BUTTONBAR_RECORD)); |
272 | update_screen = true; | 318 | update_screen = true; |
273 | break; | 319 | break; |
274 | 320 | ||
275 | case BUTTON_F3: | 321 | case BUTTON_PLAY: |
276 | if(!screen_freeze) | 322 | if(!screen_freeze) |
277 | { | 323 | { |
278 | splash(0, 0, true, "Screen frozen"); | 324 | splash(0, 0, true, "Screen frozen"); |
@@ -287,9 +333,15 @@ bool radio_screen(void) | |||
287 | break; | 333 | break; |
288 | 334 | ||
289 | case SYS_USB_CONNECTED: | 335 | case SYS_USB_CONNECTED: |
290 | usb_screen(); | 336 | /* Only accept USB connection when not recording */ |
291 | fmradio_set_status(0); | 337 | if(!mpeg_status()) |
292 | return true; | 338 | { |
339 | usb_screen(); | ||
340 | fmradio_set_status(0); | ||
341 | have_recorded = true; /* Refreshes the browser later on */ | ||
342 | done = true; | ||
343 | } | ||
344 | break; | ||
293 | } | 345 | } |
294 | 346 | ||
295 | peak_meter_peek(); | 347 | peak_meter_peek(); |
@@ -297,9 +349,12 @@ bool radio_screen(void) | |||
297 | if(!screen_freeze) | 349 | if(!screen_freeze) |
298 | { | 350 | { |
299 | lcd_setmargins(0, 8); | 351 | lcd_setmargins(0, 8); |
300 | lcd_clearrect(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh); | 352 | if(!mpeg_status()) |
301 | peak_meter_draw(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh); | 353 | { |
302 | lcd_update_rect(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh); | 354 | lcd_clearrect(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh); |
355 | peak_meter_draw(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh); | ||
356 | lcd_update_rect(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh); | ||
357 | } | ||
303 | 358 | ||
304 | if(TIME_AFTER(current_tick, timeout)) | 359 | if(TIME_AFTER(current_tick, timeout)) |
305 | { | 360 | { |
@@ -314,8 +369,12 @@ bool radio_screen(void) | |||
314 | } | 369 | } |
315 | } | 370 | } |
316 | 371 | ||
317 | if(update_screen) | 372 | seconds = mpeg_recorded_time() / HZ; |
373 | |||
374 | if(update_screen || seconds > last_seconds) | ||
318 | { | 375 | { |
376 | last_seconds = seconds; | ||
377 | |||
319 | lcd_setfont(FONT_UI); | 378 | lcd_setfont(FONT_UI); |
320 | 379 | ||
321 | if(curr_preset >= 0) | 380 | if(curr_preset >= 0) |
@@ -336,6 +395,16 @@ bool radio_screen(void) | |||
336 | stereo?str(LANG_CHANNEL_STEREO): | 395 | stereo?str(LANG_CHANNEL_STEREO): |
337 | str(LANG_CHANNEL_MONO)); | 396 | str(LANG_CHANNEL_MONO)); |
338 | lcd_puts(0, top_of_screen + 2, buf); | 397 | lcd_puts(0, top_of_screen + 2, buf); |
398 | |||
399 | if(mpeg_status()) | ||
400 | { | ||
401 | hours = seconds / 3600; | ||
402 | minutes = (seconds - (hours * 3600)) / 60; | ||
403 | snprintf(buf, 32, "%s %02d:%02d:%02d", | ||
404 | str(LANG_RECORDING_TIME), | ||
405 | hours, minutes, seconds%60); | ||
406 | lcd_puts(0, top_of_screen + 3, buf); | ||
407 | } | ||
339 | 408 | ||
340 | /* Only force the redraw if update_screen is true */ | 409 | /* Only force the redraw if update_screen is true */ |
341 | status_draw(update_screen); | 410 | status_draw(update_screen); |
@@ -347,10 +416,51 @@ bool radio_screen(void) | |||
347 | update_screen = false; | 416 | update_screen = false; |
348 | } | 417 | } |
349 | } | 418 | } |
419 | |||
420 | if(mpeg_status() & MPEG_STATUS_ERROR) | ||
421 | { | ||
422 | done = true; | ||
423 | } | ||
350 | } | 424 | } |
351 | 425 | ||
426 | |||
427 | if(mpeg_status() & MPEG_STATUS_ERROR) | ||
428 | { | ||
429 | status_set_playmode(STATUS_STOP); | ||
430 | splash(0, 0, true, str(LANG_DISK_FULL)); | ||
431 | status_draw(true); | ||
432 | lcd_update(); | ||
433 | mpeg_error_clear(); | ||
434 | |||
435 | while(1) | ||
436 | { | ||
437 | button = button_get(true); | ||
438 | if(button == (BUTTON_OFF | BUTTON_REL)) | ||
439 | break; | ||
440 | } | ||
441 | } | ||
442 | |||
443 | mpeg_init_playback(); | ||
444 | |||
445 | mpeg_sound_channel_config(global_settings.channel_config); | ||
446 | mpeg_sound_set(SOUND_BASS, global_settings.bass); | ||
447 | mpeg_sound_set(SOUND_TREBLE, global_settings.treble); | ||
448 | mpeg_sound_set(SOUND_BALANCE, global_settings.balance); | ||
449 | mpeg_sound_set(SOUND_VOLUME, global_settings.volume); | ||
450 | mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness); | ||
451 | mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost); | ||
452 | mpeg_sound_set(SOUND_AVC, global_settings.avc); | ||
453 | |||
352 | fmradio_set_status(0); | 454 | fmradio_set_status(0); |
353 | return false; | 455 | |
456 | if(keep_playing) | ||
457 | { | ||
458 | /* Enable the Left and right A/D Converter */ | ||
459 | mpeg_set_recording_gain(mpeg_sound_default(SOUND_LEFT_GAIN), | ||
460 | mpeg_sound_default(SOUND_RIGHT_GAIN), false); | ||
461 | mas_codec_writereg(6, 0x4000); | ||
462 | } | ||
463 | return have_recorded; | ||
354 | } | 464 | } |
355 | 465 | ||
356 | static bool parseline(char* line, char** freq, char** name) | 466 | static bool parseline(char* line, char** freq, char** name) |
@@ -556,11 +666,17 @@ bool radio_delete_preset(void) | |||
556 | return reload_dir; | 666 | return reload_dir; |
557 | } | 667 | } |
558 | 668 | ||
669 | static bool fm_recording_settings(void) | ||
670 | { | ||
671 | return recording_menu(true); | ||
672 | } | ||
673 | |||
559 | bool radio_menu(void) | 674 | bool radio_menu(void) |
560 | { | 675 | { |
561 | struct menu_items radio_menu_items[] = { | 676 | struct menu_items radio_menu_items[] = { |
562 | { str(LANG_FM_SAVE_PRESET), radio_add_preset }, | 677 | { str(LANG_FM_SAVE_PRESET), radio_add_preset }, |
563 | { str(LANG_FM_DELETE_PRESET), radio_delete_preset } | 678 | { str(LANG_FM_DELETE_PRESET), radio_delete_preset }, |
679 | { str(LANG_RECORDING_SETTINGS), fm_recording_settings } | ||
564 | }; | 680 | }; |
565 | int m; | 681 | int m; |
566 | bool result; | 682 | bool result; |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index b440764c9d..ab36e032df 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -45,16 +45,6 @@ | |||
45 | bool f2_rec_screen(void); | 45 | bool f2_rec_screen(void); |
46 | bool f3_rec_screen(void); | 46 | bool f3_rec_screen(void); |
47 | 47 | ||
48 | extern int recording_peak_left; | ||
49 | extern int recording_peak_right; | ||
50 | |||
51 | extern int mp3buf_write; | ||
52 | extern int mp3buf_read; | ||
53 | extern bool recording; | ||
54 | |||
55 | extern unsigned long record_start_frame; /* Frame number where | ||
56 | recording started */ | ||
57 | |||
58 | #define SOURCE_MIC 0 | 48 | #define SOURCE_MIC 0 |
59 | #define SOURCE_LINE 1 | 49 | #define SOURCE_LINE 1 |
60 | #define SOURCE_SPDIF 2 | 50 | #define SOURCE_SPDIF 2 |
@@ -89,25 +79,6 @@ static char *fmtstr[] = | |||
89 | "%d.%02d %s " /* 2 decimals */ | 79 | "%d.%02d %s " /* 2 decimals */ |
90 | }; | 80 | }; |
91 | 81 | ||
92 | /* This array holds the record timer interval lengths, in seconds */ | ||
93 | static unsigned long rec_timer_seconds[] = | ||
94 | { | ||
95 | 0, /* off */ | ||
96 | 5*60, /* 00:05 */ | ||
97 | 10*60, /* 00:10 */ | ||
98 | 15*60, /* 00:15 */ | ||
99 | 30*60, /* 00:30 */ | ||
100 | 60*60, /* 01:00 */ | ||
101 | 2*60*60, /* 02:00 */ | ||
102 | 4*60*60, /* 04:00 */ | ||
103 | 6*60*60, /* 06:00 */ | ||
104 | 8*60*60, /* 08:00 */ | ||
105 | 10*60*60, /* 10:00 */ | ||
106 | 12*60*60, /* 12:00 */ | ||
107 | 18*60*60, /* 18:00 */ | ||
108 | 24*60*60 /* 24:00 */ | ||
109 | }; | ||
110 | |||
111 | char *fmt_gain(int snd, int val, char *str, int len) | 82 | char *fmt_gain(int snd, int val, char *str, int len) |
112 | { | 83 | { |
113 | int tmp, i, d, numdec; | 84 | int tmp, i, d, numdec; |
@@ -169,8 +140,8 @@ bool recording_screen(void) | |||
169 | int w, h; | 140 | int w, h; |
170 | int update_countdown = 1; | 141 | int update_countdown = 1; |
171 | bool have_recorded = false; | 142 | bool have_recorded = false; |
172 | unsigned long seconds; | 143 | unsigned int seconds; |
173 | unsigned long last_seconds = 0; | 144 | unsigned int last_seconds = 0; |
174 | int hours, minutes; | 145 | int hours, minutes; |
175 | 146 | ||
176 | cursor = 0; | 147 | cursor = 0; |
@@ -225,13 +196,13 @@ bool recording_screen(void) | |||
225 | mpeg_record(rec_create_filename()); | 196 | mpeg_record(rec_create_filename()); |
226 | status_set_playmode(STATUS_RECORD); | 197 | status_set_playmode(STATUS_RECORD); |
227 | update_countdown = 1; /* Update immediately */ | 198 | update_countdown = 1; /* Update immediately */ |
228 | last_seconds = 0; | ||
229 | } | 199 | } |
230 | else | 200 | else |
231 | { | 201 | { |
232 | mpeg_new_file(rec_create_filename()); | 202 | mpeg_new_file(rec_create_filename()); |
233 | update_countdown = 1; /* Update immediately */ | 203 | update_countdown = 1; /* Update immediately */ |
234 | } | 204 | } |
205 | last_seconds = 0; | ||
235 | break; | 206 | break; |
236 | 207 | ||
237 | case BUTTON_UP: | 208 | case BUTTON_UP: |
@@ -331,7 +302,7 @@ bool recording_screen(void) | |||
331 | break; | 302 | break; |
332 | 303 | ||
333 | case BUTTON_F1: | 304 | case BUTTON_F1: |
334 | if (recording_menu()) | 305 | if (recording_menu(false)) |
335 | return SYS_USB_CONNECTED; | 306 | return SYS_USB_CONNECTED; |
336 | settings_save(); | 307 | settings_save(); |
337 | mpeg_set_recording_options(global_settings.rec_frequency, | 308 | mpeg_set_recording_options(global_settings.rec_frequency, |
@@ -348,8 +319,12 @@ bool recording_screen(void) | |||
348 | if(!mpeg_status()) | 319 | if(!mpeg_status()) |
349 | { | 320 | { |
350 | if (f2_rec_screen()) | 321 | if (f2_rec_screen()) |
351 | return SYS_USB_CONNECTED; | 322 | { |
352 | update_countdown = 1; /* Update immediately */ | 323 | have_recorded = true; |
324 | done = true; | ||
325 | } | ||
326 | else | ||
327 | update_countdown = 1; /* Update immediately */ | ||
353 | } | 328 | } |
354 | break; | 329 | break; |
355 | 330 | ||
@@ -357,11 +332,24 @@ bool recording_screen(void) | |||
357 | if(!mpeg_status()) | 332 | if(!mpeg_status()) |
358 | { | 333 | { |
359 | if (f3_rec_screen()) | 334 | if (f3_rec_screen()) |
360 | return SYS_USB_CONNECTED; | 335 | { |
361 | update_countdown = 1; /* Update immediately */ | 336 | have_recorded = true; |
337 | done = true; | ||
338 | } | ||
339 | else | ||
340 | update_countdown = 1; /* Update immediately */ | ||
362 | } | 341 | } |
363 | break; | 342 | break; |
364 | 343 | ||
344 | case SYS_USB_CONNECTED: | ||
345 | /* Only accept USB connection when not recording */ | ||
346 | if(!mpeg_status()) | ||
347 | { | ||
348 | usb_screen(); | ||
349 | have_recorded = true; /* Refreshes the browser later on */ | ||
350 | done = true; | ||
351 | } | ||
352 | break; | ||
365 | } | 353 | } |
366 | 354 | ||
367 | peak_meter_peek(); | 355 | peak_meter_peek(); |
@@ -377,6 +365,7 @@ bool recording_screen(void) | |||
377 | update_countdown--; | 365 | update_countdown--; |
378 | if(update_countdown == 0 || seconds > last_seconds) | 366 | if(update_countdown == 0 || seconds > last_seconds) |
379 | { | 367 | { |
368 | unsigned int dseconds, dhours, dminutes; | ||
380 | int pos = 0; | 369 | int pos = 0; |
381 | 370 | ||
382 | update_countdown = 5; | 371 | update_countdown = 5; |
@@ -390,21 +379,13 @@ bool recording_screen(void) | |||
390 | str(LANG_RECORDING_TIME), | 379 | str(LANG_RECORDING_TIME), |
391 | hours, minutes, seconds%60); | 380 | hours, minutes, seconds%60); |
392 | lcd_puts(0, 0, buf); | 381 | lcd_puts(0, 0, buf); |
393 | |||
394 | /* if the record timesplit is active */ | ||
395 | if (global_settings.rec_timesplit) | ||
396 | { | ||
397 | unsigned long dseconds, dhours, dminutes; | ||
398 | int rti = global_settings.rec_timesplit; | ||
399 | dseconds = rec_timer_seconds[rti]; | ||
400 | 382 | ||
401 | if (mpeg_status() && (seconds >= dseconds)) | 383 | dseconds = rec_timesplit_seconds(); |
402 | { | ||
403 | mpeg_new_file(rec_create_filename()); | ||
404 | update_countdown = 1; | ||
405 | last_seconds = 0; | ||
406 | } | ||
407 | 384 | ||
385 | /* Display the split interval if the record timesplit | ||
386 | is active */ | ||
387 | if (global_settings.rec_timesplit) | ||
388 | { | ||
408 | /* Display the record timesplit interval rather than | 389 | /* Display the record timesplit interval rather than |
409 | the file size if the record timer is active */ | 390 | the file size if the record timer is active */ |
410 | dhours = dseconds / 3600; | 391 | dhours = dseconds / 3600; |
@@ -418,6 +399,16 @@ bool recording_screen(void) | |||
418 | num2max5(mpeg_num_recorded_bytes(), buf2)); | 399 | num2max5(mpeg_num_recorded_bytes(), buf2)); |
419 | lcd_puts(0, 1, buf); | 400 | lcd_puts(0, 1, buf); |
420 | 401 | ||
402 | /* We will do file splitting regardless, since the OFF | ||
403 | setting really means 24 hours. This is to make sure | ||
404 | that the recorded files don't get too big. */ | ||
405 | if (mpeg_status() && (seconds >= dseconds)) | ||
406 | { | ||
407 | mpeg_new_file(rec_create_filename()); | ||
408 | update_countdown = 1; | ||
409 | last_seconds = 0; | ||
410 | } | ||
411 | |||
421 | peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); | 412 | peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); |
422 | 413 | ||
423 | /* Show mic gain if input source is Mic */ | 414 | /* Show mic gain if input source is Mic */ |
@@ -518,12 +509,10 @@ bool recording_screen(void) | |||
518 | mpeg_sound_set(SOUND_TREBLE, global_settings.treble); | 509 | mpeg_sound_set(SOUND_TREBLE, global_settings.treble); |
519 | mpeg_sound_set(SOUND_BALANCE, global_settings.balance); | 510 | mpeg_sound_set(SOUND_BALANCE, global_settings.balance); |
520 | mpeg_sound_set(SOUND_VOLUME, global_settings.volume); | 511 | mpeg_sound_set(SOUND_VOLUME, global_settings.volume); |
521 | |||
522 | #ifdef HAVE_MAS3587F | ||
523 | mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness); | 512 | mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness); |
524 | mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost); | 513 | mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost); |
525 | mpeg_sound_set(SOUND_AVC, global_settings.avc); | 514 | mpeg_sound_set(SOUND_AVC, global_settings.avc); |
526 | #endif | 515 | |
527 | lcd_setfont(FONT_UI); | 516 | lcd_setfont(FONT_UI); |
528 | return have_recorded; | 517 | return have_recorded; |
529 | } | 518 | } |
diff --git a/apps/settings.c b/apps/settings.c index 1f3382f460..68e382a2dd 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -1988,3 +1988,29 @@ bool set_time(char* string, int timedate[]) | |||
1988 | return false; | 1988 | return false; |
1989 | } | 1989 | } |
1990 | #endif | 1990 | #endif |
1991 | |||
1992 | #ifdef HAVE_MAS3587F | ||
1993 | /* This array holds the record timer interval lengths, in seconds */ | ||
1994 | static unsigned long rec_timer_seconds[] = | ||
1995 | { | ||
1996 | 24*60*60, /* OFF really means 24 hours, to avoid >2Gbyte files */ | ||
1997 | 5*60, /* 00:05 */ | ||
1998 | 10*60, /* 00:10 */ | ||
1999 | 15*60, /* 00:15 */ | ||
2000 | 30*60, /* 00:30 */ | ||
2001 | 60*60, /* 01:00 */ | ||
2002 | 2*60*60, /* 02:00 */ | ||
2003 | 4*60*60, /* 04:00 */ | ||
2004 | 6*60*60, /* 06:00 */ | ||
2005 | 8*60*60, /* 08:00 */ | ||
2006 | 10*60*60, /* 10:00 */ | ||
2007 | 12*60*60, /* 12:00 */ | ||
2008 | 18*60*60, /* 18:00 */ | ||
2009 | 24*60*60 /* 24:00 */ | ||
2010 | }; | ||
2011 | |||
2012 | unsigned int rec_timesplit_seconds(void) | ||
2013 | { | ||
2014 | return rec_timer_seconds[global_settings.rec_timesplit]; | ||
2015 | } | ||
2016 | #endif | ||
diff --git a/apps/settings.h b/apps/settings.h index 93516d86cf..c0e785489a 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -199,6 +199,10 @@ bool set_int(char* string, char* unit, int* variable, | |||
199 | bool set_time(char* string, int timedate[]); | 199 | bool set_time(char* string, int timedate[]); |
200 | void set_file(char* filename, char* setting, int maxlen); | 200 | void set_file(char* filename, char* setting, int maxlen); |
201 | 201 | ||
202 | #ifdef HAVE_MAS3587F | ||
203 | unsigned int rec_timesplit_seconds(void); | ||
204 | #endif | ||
205 | |||
202 | /* global settings */ | 206 | /* global settings */ |
203 | extern struct user_settings global_settings; | 207 | extern struct user_settings global_settings; |
204 | /* name of directory where configuration, fonts and other data | 208 | /* name of directory where configuration, fonts and other data |
diff --git a/apps/sound_menu.c b/apps/sound_menu.c index 0c875400d3..c5e254794e 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c | |||
@@ -290,20 +290,29 @@ bool sound_menu(void) | |||
290 | } | 290 | } |
291 | 291 | ||
292 | #ifdef HAVE_MAS3587F | 292 | #ifdef HAVE_MAS3587F |
293 | bool recording_menu(void) | 293 | bool recording_menu(bool no_source) |
294 | { | 294 | { |
295 | int m; | 295 | int m; |
296 | int i = 0; | ||
297 | struct menu_items menu[6]; | ||
296 | bool result; | 298 | bool result; |
297 | struct menu_items items[] = { | 299 | |
298 | { str(LANG_RECORDING_QUALITY), recquality }, | 300 | menu[i].desc = str(LANG_RECORDING_QUALITY); |
299 | { str(LANG_RECORDING_FREQUENCY), recfrequency }, | 301 | menu[i++].function = recquality; |
300 | { str(LANG_RECORDING_SOURCE), recsource }, | 302 | menu[i].desc = str(LANG_RECORDING_FREQUENCY); |
301 | { str(LANG_RECORDING_CHANNELS), recchannels }, | 303 | menu[i++].function = recfrequency; |
302 | { str(LANG_RECORDING_EDITABLE), receditable }, | 304 | if(!no_source) { |
303 | { str(LANG_RECORD_TIMESPLIT), rectimesplit }, | 305 | menu[i].desc = str(LANG_RECORDING_SOURCE); |
304 | }; | 306 | menu[i++].function = recsource; |
305 | 307 | } | |
306 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); | 308 | menu[i].desc = str(LANG_RECORDING_CHANNELS); |
309 | menu[i++].function = recchannels; | ||
310 | menu[i].desc = str(LANG_RECORDING_EDITABLE); | ||
311 | menu[i++].function = receditable; | ||
312 | menu[i].desc = str(LANG_RECORD_TIMESPLIT); | ||
313 | menu[i++].function = rectimesplit; | ||
314 | |||
315 | m=menu_init( menu, i ); | ||
307 | result = menu_run(m); | 316 | result = menu_run(m); |
308 | menu_exit(m); | 317 | menu_exit(m); |
309 | 318 | ||
diff --git a/apps/sound_menu.h b/apps/sound_menu.h index 8c1f4db089..206d1e3715 100644 --- a/apps/sound_menu.h +++ b/apps/sound_menu.h | |||
@@ -22,6 +22,6 @@ | |||
22 | #include "menu.h" | 22 | #include "menu.h" |
23 | 23 | ||
24 | bool sound_menu(void); | 24 | bool sound_menu(void); |
25 | bool recording_menu(void); | 25 | bool recording_menu(bool no_source); |
26 | 26 | ||
27 | #endif | 27 | #endif |
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index b51f9b9732..0610e9890f 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -167,7 +167,7 @@ static int defaultval[] = | |||
167 | 0, /* AVC */ | 167 | 0, /* AVC */ |
168 | 0, /* Channels */ | 168 | 0, /* Channels */ |
169 | 8, /* Left gain */ | 169 | 8, /* Left gain */ |
170 | 2, /* Right gain */ | 170 | 8, /* Right gain */ |
171 | 2, /* Mic gain */ | 171 | 2, /* Mic gain */ |
172 | }; | 172 | }; |
173 | 173 | ||
@@ -2157,6 +2157,21 @@ static void mpeg_thread(void) | |||
2157 | init_playback(); | 2157 | init_playback(); |
2158 | init_playback_done = true; | 2158 | init_playback_done = true; |
2159 | break; | 2159 | break; |
2160 | |||
2161 | case SYS_USB_CONNECTED: | ||
2162 | is_playing = false; | ||
2163 | paused = false; | ||
2164 | stop_playing(); | ||
2165 | #ifndef SIMULATOR | ||
2166 | |||
2167 | /* Tell the USB thread that we are safe */ | ||
2168 | DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n"); | ||
2169 | usb_acknowledge(SYS_USB_CONNECTED_ACK); | ||
2170 | |||
2171 | /* Wait until the USB cable is extracted again */ | ||
2172 | usb_wait_for_disconnect(&mpeg_queue); | ||
2173 | #endif | ||
2174 | break; | ||
2160 | } | 2175 | } |
2161 | } | 2176 | } |
2162 | #endif | 2177 | #endif |