diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2003-12-31 03:13:29 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2003-12-31 03:13:29 +0000 |
commit | 74976c1484d7c8a89a290ffc7e4a7525874278b4 (patch) | |
tree | 23f6f2e53f5f8ab6e9476b412cc56e15801914dd /apps | |
parent | 1c4ea83bba9ce7ec7ede6141c1ee66c12c20f1d6 (diff) | |
download | rockbox-74976c1484d7c8a89a290ffc7e4a7525874278b4.tar.gz rockbox-74976c1484d7c8a89a290ffc7e4a7525874278b4.zip |
New recording feature: Prerecord up to 30 seconds before you press the Play key. Especially useful for FM radio recording. Also fixed a bug which didn't apply the recording settings correctly in the Radio screen.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4183 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/english.lang | 10 | ||||
-rw-r--r-- | apps/recorder/radio.c | 47 | ||||
-rw-r--r-- | apps/recorder/recording.c | 75 | ||||
-rw-r--r-- | apps/settings.c | 30 | ||||
-rw-r--r-- | apps/settings.h | 2 | ||||
-rw-r--r-- | apps/sound_menu.c | 18 |
6 files changed, 121 insertions, 61 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index ffdc12b306..5cad562a7f 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -1847,3 +1847,13 @@ id: LANG_FLIP_DISPLAY | |||
1847 | desc: in settings_menu, option to turn display+buttos by 180 degreed | 1847 | desc: in settings_menu, option to turn display+buttos by 180 degreed |
1848 | eng: "Upside Down" | 1848 | eng: "Upside Down" |
1849 | new: | 1849 | new: |
1850 | |||
1851 | id: LANG_RECORD_PRERECORD | ||
1852 | desc: in recording and radio screen | ||
1853 | eng: "Prerecording" | ||
1854 | new: | ||
1855 | |||
1856 | id: LANG_RECORD_PRERECORD_TIME | ||
1857 | desc: in recording settings_menu | ||
1858 | eng: "Prerecord time" | ||
1859 | new: | ||
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index ab0c1eb004..519e919964 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -172,9 +172,10 @@ bool radio_screen(void) | |||
172 | 172 | ||
173 | mpeg_set_recording_options(global_settings.rec_frequency, | 173 | mpeg_set_recording_options(global_settings.rec_frequency, |
174 | global_settings.rec_quality, | 174 | global_settings.rec_quality, |
175 | 1 /* Line In */, | 175 | 1, /* Line In */ |
176 | global_settings.rec_channels, | 176 | global_settings.rec_channels, |
177 | global_settings.rec_editable); | 177 | global_settings.rec_editable, |
178 | global_settings.rec_prerecord_time); | ||
178 | 179 | ||
179 | 180 | ||
180 | mpeg_set_recording_gain(mpeg_sound_default(SOUND_LEFT_GAIN), | 181 | mpeg_set_recording_gain(mpeg_sound_default(SOUND_LEFT_GAIN), |
@@ -230,7 +231,7 @@ bool radio_screen(void) | |||
230 | switch(button) | 231 | switch(button) |
231 | { | 232 | { |
232 | case BUTTON_OFF: | 233 | case BUTTON_OFF: |
233 | if(mpeg_status()) | 234 | if(mpeg_status() == MPEG_STATUS_RECORD) |
234 | { | 235 | { |
235 | mpeg_stop(); | 236 | mpeg_stop(); |
236 | status_set_playmode(STATUS_STOP); | 237 | status_set_playmode(STATUS_STOP); |
@@ -244,17 +245,16 @@ bool radio_screen(void) | |||
244 | break; | 245 | break; |
245 | 246 | ||
246 | case BUTTON_F3: | 247 | case BUTTON_F3: |
247 | /* Only act if the mpeg is stopped */ | 248 | if(mpeg_status() == MPEG_STATUS_RECORD) |
248 | if(!mpeg_status()) | ||
249 | { | 249 | { |
250 | have_recorded = true; | 250 | mpeg_new_file(rec_create_filename()); |
251 | mpeg_record(rec_create_filename()); | ||
252 | status_set_playmode(STATUS_RECORD); | ||
253 | update_screen = true; | 251 | update_screen = true; |
254 | } | 252 | } |
255 | else | 253 | else |
256 | { | 254 | { |
257 | mpeg_new_file(rec_create_filename()); | 255 | have_recorded = true; |
256 | mpeg_record(rec_create_filename()); | ||
257 | status_set_playmode(STATUS_RECORD); | ||
258 | update_screen = true; | 258 | update_screen = true; |
259 | } | 259 | } |
260 | last_seconds = 0; | 260 | last_seconds = 0; |
@@ -353,11 +353,12 @@ bool radio_screen(void) | |||
353 | 353 | ||
354 | case SYS_USB_CONNECTED: | 354 | case SYS_USB_CONNECTED: |
355 | /* Only accept USB connection when not recording */ | 355 | /* Only accept USB connection when not recording */ |
356 | if(!mpeg_status()) | 356 | if(mpeg_status() != MPEG_STATUS_RECORD) |
357 | { | 357 | { |
358 | usb_screen(); | 358 | usb_screen(); |
359 | fmradio_set_status(0); | 359 | fmradio_set_status(0); |
360 | have_recorded = true; /* Refreshes the browser later on */ | 360 | screen_freeze = true; /* Cosmetic: makes sure the |
361 | radio screen doesn't redraw */ | ||
361 | done = true; | 362 | done = true; |
362 | } | 363 | } |
363 | break; | 364 | break; |
@@ -368,6 +369,8 @@ bool radio_screen(void) | |||
368 | if(!screen_freeze) | 369 | if(!screen_freeze) |
369 | { | 370 | { |
370 | lcd_setmargins(0, 8); | 371 | lcd_setmargins(0, 8); |
372 | |||
373 | /* Only display the peak meter when not recording */ | ||
371 | if(!mpeg_status()) | 374 | if(!mpeg_status()) |
372 | { | 375 | { |
373 | lcd_clearrect(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh); | 376 | lcd_clearrect(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh); |
@@ -415,7 +418,7 @@ bool radio_screen(void) | |||
415 | str(LANG_CHANNEL_MONO)); | 418 | str(LANG_CHANNEL_MONO)); |
416 | lcd_puts(0, top_of_screen + 2, buf); | 419 | lcd_puts(0, top_of_screen + 2, buf); |
417 | 420 | ||
418 | if(mpeg_status()) | 421 | if(mpeg_status() == MPEG_STATUS_RECORD) |
419 | { | 422 | { |
420 | hours = seconds / 3600; | 423 | hours = seconds / 3600; |
421 | minutes = (seconds - (hours * 3600)) / 60; | 424 | minutes = (seconds - (hours * 3600)) / 60; |
@@ -424,6 +427,12 @@ bool radio_screen(void) | |||
424 | hours, minutes, seconds%60); | 427 | hours, minutes, seconds%60); |
425 | lcd_puts(0, top_of_screen + 3, buf); | 428 | lcd_puts(0, top_of_screen + 3, buf); |
426 | } | 429 | } |
430 | else | ||
431 | { | ||
432 | snprintf(buf, 32, "%s %02d", | ||
433 | str(LANG_RECORD_PRERECORD), seconds%60); | ||
434 | lcd_puts(0, top_of_screen + 3, buf); | ||
435 | } | ||
427 | 436 | ||
428 | /* Only force the redraw if update_screen is true */ | 437 | /* Only force the redraw if update_screen is true */ |
429 | status_draw(update_screen); | 438 | status_draw(update_screen); |
@@ -687,7 +696,19 @@ bool radio_delete_preset(void) | |||
687 | 696 | ||
688 | static bool fm_recording_settings(void) | 697 | static bool fm_recording_settings(void) |
689 | { | 698 | { |
690 | return recording_menu(true); | 699 | bool ret; |
700 | |||
701 | ret = recording_menu(true); | ||
702 | if(!ret) | ||
703 | { | ||
704 | mpeg_set_recording_options(global_settings.rec_frequency, | ||
705 | global_settings.rec_quality, | ||
706 | 1, /* Line In */ | ||
707 | global_settings.rec_channels, | ||
708 | global_settings.rec_editable, | ||
709 | global_settings.rec_prerecord_time); | ||
710 | } | ||
711 | return ret; | ||
691 | } | 712 | } |
692 | 713 | ||
693 | bool radio_menu(void) | 714 | bool radio_menu(void) |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index d94508e547..bc26ff8495 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -160,7 +160,8 @@ bool recording_screen(void) | |||
160 | global_settings.rec_quality, | 160 | global_settings.rec_quality, |
161 | global_settings.rec_source, | 161 | global_settings.rec_source, |
162 | global_settings.rec_channels, | 162 | global_settings.rec_channels, |
163 | global_settings.rec_editable); | 163 | global_settings.rec_editable, |
164 | global_settings.rec_prerecord_time); | ||
164 | 165 | ||
165 | set_gain(); | 166 | set_gain(); |
166 | 167 | ||
@@ -174,7 +175,7 @@ bool recording_screen(void) | |||
174 | switch(button) | 175 | switch(button) |
175 | { | 176 | { |
176 | case BUTTON_OFF: | 177 | case BUTTON_OFF: |
177 | if(mpeg_status()) | 178 | if(mpeg_status() & MPEG_STATUS_RECORD) |
178 | { | 179 | { |
179 | mpeg_stop(); | 180 | mpeg_stop(); |
180 | status_set_playmode(STATUS_STOP); | 181 | status_set_playmode(STATUS_STOP); |
@@ -190,7 +191,7 @@ bool recording_screen(void) | |||
190 | 191 | ||
191 | case BUTTON_PLAY: | 192 | case BUTTON_PLAY: |
192 | /* Only act if the mpeg is stopped */ | 193 | /* Only act if the mpeg is stopped */ |
193 | if(!mpeg_status()) | 194 | if(!(mpeg_status() & MPEG_STATUS_RECORD)) |
194 | { | 195 | { |
195 | have_recorded = true; | 196 | have_recorded = true; |
196 | mpeg_record(rec_create_filename()); | 197 | mpeg_record(rec_create_filename()); |
@@ -305,13 +306,16 @@ bool recording_screen(void) | |||
305 | if (recording_menu(false)) | 306 | if (recording_menu(false)) |
306 | return SYS_USB_CONNECTED; | 307 | return SYS_USB_CONNECTED; |
307 | settings_save(); | 308 | settings_save(); |
309 | |||
308 | mpeg_set_recording_options(global_settings.rec_frequency, | 310 | mpeg_set_recording_options(global_settings.rec_frequency, |
309 | global_settings.rec_quality, | 311 | global_settings.rec_quality, |
310 | global_settings.rec_source, | 312 | global_settings.rec_source, |
311 | global_settings.rec_channels, | 313 | global_settings.rec_channels, |
312 | global_settings.rec_editable); | 314 | global_settings.rec_editable, |
315 | global_settings.rec_prerecord_time); | ||
313 | 316 | ||
314 | set_gain(); | 317 | set_gain(); |
318 | |||
315 | update_countdown = 1; /* Update immediately */ | 319 | update_countdown = 1; /* Update immediately */ |
316 | 320 | ||
317 | lcd_setfont(FONT_SYSFIXED); | 321 | lcd_setfont(FONT_SYSFIXED); |
@@ -319,7 +323,7 @@ bool recording_screen(void) | |||
319 | break; | 323 | break; |
320 | 324 | ||
321 | case BUTTON_F2: | 325 | case BUTTON_F2: |
322 | if(!mpeg_status()) | 326 | if(mpeg_status() != MPEG_STATUS_RECORD) |
323 | { | 327 | { |
324 | if (f2_rec_screen()) | 328 | if (f2_rec_screen()) |
325 | { | 329 | { |
@@ -332,7 +336,7 @@ bool recording_screen(void) | |||
332 | break; | 336 | break; |
333 | 337 | ||
334 | case BUTTON_F3: | 338 | case BUTTON_F3: |
335 | if(!mpeg_status()) | 339 | if(mpeg_status() != MPEG_STATUS_RECORD) |
336 | { | 340 | { |
337 | if (f3_rec_screen()) | 341 | if (f3_rec_screen()) |
338 | { | 342 | { |
@@ -346,14 +350,12 @@ bool recording_screen(void) | |||
346 | 350 | ||
347 | case SYS_USB_CONNECTED: | 351 | case SYS_USB_CONNECTED: |
348 | /* Only accept USB connection when not recording */ | 352 | /* Only accept USB connection when not recording */ |
349 | if(!mpeg_status()) | 353 | if(mpeg_status() != MPEG_STATUS_RECORD) |
350 | { | 354 | { |
351 | usb_screen(); | 355 | usb_screen(); |
352 | have_recorded = true; /* Refreshes the browser later on */ | 356 | have_recorded = true; /* Refreshes the browser later on */ |
353 | done = true; | 357 | done = true; |
354 | } | 358 | } |
355 | lcd_setfont(FONT_SYSFIXED); | ||
356 | lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); | ||
357 | break; | 359 | break; |
358 | } | 360 | } |
359 | 361 | ||
@@ -387,21 +389,28 @@ bool recording_screen(void) | |||
387 | 389 | ||
388 | dseconds = rec_timesplit_seconds(); | 390 | dseconds = rec_timesplit_seconds(); |
389 | 391 | ||
390 | /* Display the split interval if the record timesplit | 392 | if(mpeg_status() & MPEG_STATUS_PRERECORD) |
391 | is active */ | ||
392 | if (global_settings.rec_timesplit) | ||
393 | { | 393 | { |
394 | /* Display the record timesplit interval rather than | 394 | snprintf(buf, 32, "%s...", str(LANG_RECORD_PRERECORD)); |
395 | the file size if the record timer is active */ | ||
396 | dhours = dseconds / 3600; | ||
397 | dminutes = (dseconds - (dhours * 3600)) / 60; | ||
398 | snprintf(buf, 32, "%s %02d:%02d", | ||
399 | str(LANG_RECORD_TIMESPLIT_REC), | ||
400 | dhours, dminutes); | ||
401 | } | 395 | } |
402 | else | 396 | else |
403 | snprintf(buf, 32, "%s %s", str(LANG_RECORDING_SIZE), | 397 | { |
404 | num2max5(mpeg_num_recorded_bytes(), buf2)); | 398 | /* Display the split interval if the record timesplit |
399 | is active */ | ||
400 | if (global_settings.rec_timesplit) | ||
401 | { | ||
402 | /* Display the record timesplit interval rather than | ||
403 | the file size if the record timer is active */ | ||
404 | dhours = dseconds / 3600; | ||
405 | dminutes = (dseconds - (dhours * 3600)) / 60; | ||
406 | snprintf(buf, 32, "%s %02d:%02d", | ||
407 | str(LANG_RECORD_TIMESPLIT_REC), | ||
408 | dhours, dminutes); | ||
409 | } | ||
410 | else | ||
411 | snprintf(buf, 32, "%s %s", str(LANG_RECORDING_SIZE), | ||
412 | num2max5(mpeg_num_recorded_bytes(), buf2)); | ||
413 | } | ||
405 | lcd_puts(0, 1, buf); | 414 | lcd_puts(0, 1, buf); |
406 | 415 | ||
407 | /* We will do file splitting regardless, since the OFF | 416 | /* We will do file splitting regardless, since the OFF |
@@ -622,7 +631,8 @@ bool f2_rec_screen(void) | |||
622 | global_settings.rec_quality, | 631 | global_settings.rec_quality, |
623 | global_settings.rec_source, | 632 | global_settings.rec_source, |
624 | global_settings.rec_channels, | 633 | global_settings.rec_channels, |
625 | global_settings.rec_editable); | 634 | global_settings.rec_editable, |
635 | global_settings.rec_prerecord_time); | ||
626 | 636 | ||
627 | set_gain(); | 637 | set_gain(); |
628 | 638 | ||
@@ -671,22 +681,6 @@ bool f3_rec_screen(void) | |||
671 | used = true; | 681 | used = true; |
672 | break; | 682 | break; |
673 | 683 | ||
674 | case BUTTON_DOWN: | ||
675 | case BUTTON_F3 | BUTTON_DOWN: | ||
676 | global_settings.rec_frequency++; | ||
677 | if(global_settings.rec_frequency > 5) | ||
678 | global_settings.rec_frequency = 0; | ||
679 | used = true; | ||
680 | break; | ||
681 | |||
682 | case BUTTON_RIGHT: | ||
683 | case BUTTON_F3 | BUTTON_RIGHT: | ||
684 | global_settings.rec_channels++; | ||
685 | if(global_settings.rec_channels > 1) | ||
686 | global_settings.rec_channels = 0; | ||
687 | used = true; | ||
688 | break; | ||
689 | |||
690 | case BUTTON_F3 | BUTTON_REL: | 684 | case BUTTON_F3 | BUTTON_REL: |
691 | if ( used ) | 685 | if ( used ) |
692 | exit = true; | 686 | exit = true; |
@@ -707,10 +701,11 @@ bool f3_rec_screen(void) | |||
707 | global_settings.rec_quality, | 701 | global_settings.rec_quality, |
708 | global_settings.rec_source, | 702 | global_settings.rec_source, |
709 | global_settings.rec_channels, | 703 | global_settings.rec_channels, |
710 | global_settings.rec_editable); | 704 | global_settings.rec_editable, |
705 | global_settings.rec_prerecord_time); | ||
711 | 706 | ||
712 | set_gain(); | 707 | set_gain(); |
713 | 708 | ||
714 | settings_save(); | 709 | settings_save(); |
715 | lcd_setfont(FONT_UI); | 710 | lcd_setfont(FONT_UI); |
716 | 711 | ||
diff --git a/apps/settings.c b/apps/settings.c index b2fa22170b..35e75d12ca 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -129,6 +129,9 @@ location used, and reset the setting in question with a factory default if | |||
129 | needed. Memory locations not used by a given version should not be | 129 | needed. Memory locations not used by a given version should not be |
130 | modified unless the header & checksum test fails. | 130 | modified unless the header & checksum test fails. |
131 | 131 | ||
132 | Because 0xff mean that the byte is unused, care must be taken so that | ||
133 | a used byte can't have the value 0xff. Either use only 7 bits, or make sure | ||
134 | that the value will never be 0xff. | ||
132 | 135 | ||
133 | Rest of config block, only saved to disk: | 136 | Rest of config block, only saved to disk: |
134 | 0xA8 (char)jump scroll mode (only for player) | 137 | 0xA8 (char)jump scroll mode (only for player) |
@@ -151,9 +154,8 @@ Rest of config block, only saved to disk: | |||
151 | 0xB8 (char[20]) WPS file | 154 | 0xB8 (char[20]) WPS file |
152 | 0xCC (char[20]) Lang file | 155 | 0xCC (char[20]) Lang file |
153 | 0xE0 (char[20]) Font file | 156 | 0xE0 (char[20]) Font file |
154 | 0xF4 <unused> | 157 | 0xF4 Prerecording time (bit 0-4) |
155 | 0xF8 <unused> | 158 | 0xF5-0xFF <unused> |
156 | 0xFC <unused> | ||
157 | 159 | ||
158 | *************************************/ | 160 | *************************************/ |
159 | 161 | ||
@@ -432,6 +434,8 @@ int settings_save( void ) | |||
432 | strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME); | 434 | strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME); |
433 | strncpy(&config_block[0xe0], global_settings.font_file, MAX_FILENAME); | 435 | strncpy(&config_block[0xe0], global_settings.font_file, MAX_FILENAME); |
434 | 436 | ||
437 | config_block[0xf4]=(unsigned char)global_settings.rec_prerecord_time; | ||
438 | |||
435 | if(save_config_buffer()) | 439 | if(save_config_buffer()) |
436 | { | 440 | { |
437 | lcd_clear_display(); | 441 | lcd_clear_display(); |
@@ -756,6 +760,10 @@ void settings_load(void) | |||
756 | strncpy(global_settings.wps_file, &config_block[0xb8], MAX_FILENAME); | 760 | strncpy(global_settings.wps_file, &config_block[0xb8], MAX_FILENAME); |
757 | strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME); | 761 | strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME); |
758 | strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME); | 762 | strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME); |
763 | |||
764 | if (config_block[0xf4] != 0xff) | ||
765 | global_settings.rec_prerecord_time = config_block[0xf4]; | ||
766 | |||
759 | #ifdef HAVE_LCD_CHARCELLS | 767 | #ifdef HAVE_LCD_CHARCELLS |
760 | if (config_block[0xa8] != 0xff) | 768 | if (config_block[0xa8] != 0xff) |
761 | global_settings.jump_scroll = config_block[0xa8]; | 769 | global_settings.jump_scroll = config_block[0xa8]; |
@@ -1079,6 +1087,9 @@ bool settings_load_config(char* file) | |||
1079 | else if (!strcasecmp(name, "editable recordings")) { | 1087 | else if (!strcasecmp(name, "editable recordings")) { |
1080 | set_cfg_bool(&global_settings.rec_editable, value); | 1088 | set_cfg_bool(&global_settings.rec_editable, value); |
1081 | } | 1089 | } |
1090 | else if (!strcasecmp(name, "prerecording time")) { | ||
1091 | set_cfg_int(&global_settings.rec_prerecord_time, value, 0, 30); | ||
1092 | } | ||
1082 | #endif | 1093 | #endif |
1083 | else if (!strcasecmp(name, "idle poweroff")) { | 1094 | else if (!strcasecmp(name, "idle poweroff")) { |
1084 | static char* options[] = {"off","1","2","3","4","5","6","7","8", | 1095 | static char* options[] = {"off","1","2","3","4","5","6","7","8", |
@@ -1379,6 +1390,10 @@ bool settings_save_config(void) | |||
1379 | fprintf(fd, "line in: %s\r\n", boolopt[global_settings.line_in]); | 1390 | fprintf(fd, "line in: %s\r\n", boolopt[global_settings.line_in]); |
1380 | #endif | 1391 | #endif |
1381 | 1392 | ||
1393 | fprintf(fd, "max files in dir: %d\r\n", global_settings.max_files_in_dir); | ||
1394 | fprintf(fd, "max files in playlist: %d\r\n", | ||
1395 | global_settings.max_files_in_playlist); | ||
1396 | |||
1382 | #ifdef HAVE_MAS3587F | 1397 | #ifdef HAVE_MAS3587F |
1383 | fprintf(fd, "#\r\n# Recording\r\n#\r\n"); | 1398 | fprintf(fd, "#\r\n# Recording\r\n#\r\n"); |
1384 | fprintf(fd, "rec quality: %d\r\n", global_settings.rec_quality); | 1399 | fprintf(fd, "rec quality: %d\r\n", global_settings.rec_quality); |
@@ -1409,12 +1424,12 @@ bool settings_save_config(void) | |||
1409 | fprintf(fd, "editable recordings: %s\r\n", | 1424 | fprintf(fd, "editable recordings: %s\r\n", |
1410 | boolopt[global_settings.rec_editable]); | 1425 | boolopt[global_settings.rec_editable]); |
1411 | 1426 | ||
1427 | fprintf(fd, "prerecording time: %d\r\n", | ||
1428 | global_settings.rec_prerecord_time); | ||
1429 | |||
1412 | #endif | 1430 | #endif |
1413 | 1431 | ||
1414 | fprintf(fd, "max files in dir: %d\r\n", global_settings.max_files_in_dir); | 1432 | fprintf(fd, "#\r\n# Playlists\r\n#\r\n"); |
1415 | fprintf(fd, "max files in playlist: %d\r\n", | ||
1416 | global_settings.max_files_in_playlist); | ||
1417 | |||
1418 | { | 1433 | { |
1419 | static char* options[] = {"off", "on", "ask"}; | 1434 | static char* options[] = {"off", "on", "ask"}; |
1420 | fprintf(fd, "recursive directory insert: %s\r\n", | 1435 | fprintf(fd, "recursive directory insert: %s\r\n", |
@@ -1454,6 +1469,7 @@ void settings_reset(void) { | |||
1454 | global_settings.rec_left_gain = 2; /* 0dB */ | 1469 | global_settings.rec_left_gain = 2; /* 0dB */ |
1455 | global_settings.rec_right_gain = 2; /* 0dB */ | 1470 | global_settings.rec_right_gain = 2; /* 0dB */ |
1456 | global_settings.rec_editable = false; | 1471 | global_settings.rec_editable = false; |
1472 | global_settings.rec_prerecord_time = 0; | ||
1457 | global_settings.resume = RESUME_ASK; | 1473 | global_settings.resume = RESUME_ASK; |
1458 | global_settings.contrast = lcd_default_contrast(); | 1474 | global_settings.contrast = lcd_default_contrast(); |
1459 | global_settings.invert = DEFAULT_INVERT_SETTING; | 1475 | global_settings.invert = DEFAULT_INVERT_SETTING; |
diff --git a/apps/settings.h b/apps/settings.h index 074be0690a..49327b2f80 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -85,6 +85,8 @@ struct user_settings | |||
85 | 5 = 01:00, 6 = 02:00, 7 = 04:00, 8 = 06:00 | 85 | 5 = 01:00, 6 = 02:00, 7 = 04:00, 8 = 06:00 |
86 | 9 = 08:00, 10= 10:00, 11= 12:00, 12= 18:00, | 86 | 9 = 08:00, 10= 10:00, 11= 12:00, 12= 18:00, |
87 | 13= 24:00 */ | 87 | 13= 24:00 */ |
88 | |||
89 | int rec_prerecord_time; /* In seconds, 0-30, 0 means OFF */ | ||
88 | 90 | ||
89 | /* device settings */ | 91 | /* device settings */ |
90 | 92 | ||
diff --git a/apps/sound_menu.c b/apps/sound_menu.c index c5e254794e..557013df8a 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c | |||
@@ -241,6 +241,20 @@ static bool rectimesplit(void) | |||
241 | names, 14, NULL ); | 241 | names, 14, NULL ); |
242 | } | 242 | } |
243 | 243 | ||
244 | static bool recprerecord(void) | ||
245 | { | ||
246 | char *names[] = { | ||
247 | str(LANG_OFF),"1s","2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s", | ||
248 | "10s", "11s", "12s", "13s", "14s", "15s", "16s", "17s", "18s", "19s", | ||
249 | "20s", "21s", "22s", "23s", "24s", "25s", "26s", "27s", "28s", "29s", | ||
250 | "30s" | ||
251 | }; | ||
252 | |||
253 | return set_option(str(LANG_RECORD_PRERECORD_TIME), | ||
254 | &global_settings.rec_prerecord_time, INT, | ||
255 | names, 31, NULL ); | ||
256 | } | ||
257 | |||
244 | #endif /* HAVE_MAS3587F */ | 258 | #endif /* HAVE_MAS3587F */ |
245 | 259 | ||
246 | static void set_chanconf(int val) | 260 | static void set_chanconf(int val) |
@@ -294,7 +308,7 @@ bool recording_menu(bool no_source) | |||
294 | { | 308 | { |
295 | int m; | 309 | int m; |
296 | int i = 0; | 310 | int i = 0; |
297 | struct menu_items menu[6]; | 311 | struct menu_items menu[7]; |
298 | bool result; | 312 | bool result; |
299 | 313 | ||
300 | menu[i].desc = str(LANG_RECORDING_QUALITY); | 314 | menu[i].desc = str(LANG_RECORDING_QUALITY); |
@@ -311,6 +325,8 @@ bool recording_menu(bool no_source) | |||
311 | menu[i++].function = receditable; | 325 | menu[i++].function = receditable; |
312 | menu[i].desc = str(LANG_RECORD_TIMESPLIT); | 326 | menu[i].desc = str(LANG_RECORD_TIMESPLIT); |
313 | menu[i++].function = rectimesplit; | 327 | menu[i++].function = rectimesplit; |
328 | menu[i].desc = str(LANG_RECORD_PRERECORD_TIME); | ||
329 | menu[i++].function = recprerecord; | ||
314 | 330 | ||
315 | m=menu_init( menu, i ); | 331 | m=menu_init( menu, i ); |
316 | result = menu_run(m); | 332 | result = menu_run(m); |