diff options
author | Björn Stenberg <bjorn@haxx.se> | 2003-06-04 13:48:50 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2003-06-04 13:48:50 +0000 |
commit | 56f771e76a8b7707553c472d08b745e45f79c64f (patch) | |
tree | cdba768235c5f06fa3888498d66be409bf79bdf2 | |
parent | b817f601ba36d5651f8b9945ac8f576c83ea387c (diff) | |
download | rockbox-56f771e76a8b7707553c472d08b745e45f79c64f.tar.gz rockbox-56f771e76a8b7707553c472d08b745e45f79c64f.zip |
Dave Jones' recording time split feature (patch #697373)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3725 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/lang/english.lang | 10 | ||||
-rw-r--r-- | apps/recorder/recording.c | 45 | ||||
-rw-r--r-- | apps/settings.c | 8 | ||||
-rw-r--r-- | apps/settings.h | 10 | ||||
-rw-r--r-- | apps/sound_menu.c | 12 | ||||
-rw-r--r-- | docs/CREDITS | 1 |
6 files changed, 82 insertions, 4 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index a35db446ec..f36c2f7990 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -1537,3 +1537,13 @@ id: LANG_JUMP_SCROLL_DELAY | |||
1537 | desc: (player) Delay before making a jump scroll | 1537 | desc: (player) Delay before making a jump scroll |
1538 | eng: "Jump Scroll Delay" | 1538 | eng: "Jump Scroll Delay" |
1539 | new: | 1539 | new: |
1540 | |||
1541 | id: LANG_RECORD_TIMESPLIT | ||
1542 | desc: Prompt for record timer interval setting, in the record settings menu | ||
1543 | eng: "Time Split" | ||
1544 | new: | ||
1545 | |||
1546 | id: LANG_RECORD_TIMESPLIT_REC | ||
1547 | decs: Display of record timer interval setting, on the record screen | ||
1548 | eng: "Split time:" | ||
1549 | new: | ||
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index de4705f4d4..97198b9d18 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -89,6 +89,19 @@ static char *fmtstr[] = | |||
89 | "%d.%02d %s " /* 2 decimals */ | 89 | "%d.%02d %s " /* 2 decimals */ |
90 | }; | 90 | }; |
91 | 91 | ||
92 | /* This array holds the record timer interval lengths, in seconds */ | ||
93 | static unsigned long rec_timer_seconds[] = | ||
94 | { | ||
95 | 0, /* off */ | ||
96 | 300, /* 00:05 */ | ||
97 | 600, /* 00:10 */ | ||
98 | 900, /* 00:15 */ | ||
99 | 1800, /* 00:30 */ | ||
100 | 3600, /* 01:00 */ | ||
101 | 7200, /* 02:00 */ | ||
102 | 14400, /* 04:00 */ | ||
103 | }; | ||
104 | |||
92 | char *fmt_gain(int snd, int val, char *str, int len) | 105 | char *fmt_gain(int snd, int val, char *str, int len) |
93 | { | 106 | { |
94 | int tmp, i, d, numdec; | 107 | int tmp, i, d, numdec; |
@@ -349,7 +362,7 @@ bool recording_screen(void) | |||
349 | timeout = current_tick + HZ/10; | 362 | timeout = current_tick + HZ/10; |
350 | 363 | ||
351 | seconds = mpeg_recorded_time() / HZ; | 364 | seconds = mpeg_recorded_time() / HZ; |
352 | 365 | ||
353 | update_countdown--; | 366 | update_countdown--; |
354 | if(update_countdown == 0 || seconds > last_seconds) | 367 | if(update_countdown == 0 || seconds > last_seconds) |
355 | { | 368 | { |
@@ -367,8 +380,34 @@ bool recording_screen(void) | |||
367 | hours, minutes, seconds%60); | 380 | hours, minutes, seconds%60); |
368 | lcd_puts(0, 0, buf); | 381 | lcd_puts(0, 0, buf); |
369 | 382 | ||
370 | snprintf(buf, 32, "%s %s", str(LANG_RECORDING_SIZE), | 383 | /* if the record timesplit is active */ |
371 | num2max5(mpeg_num_recorded_bytes(), buf2)); | 384 | if (global_settings.rec_timesplit) |
385 | { | ||
386 | unsigned long dseconds, dhours, dminutes; | ||
387 | int rti = global_settings.rec_timesplit; | ||
388 | dseconds = rec_timer_seconds[rti]; | ||
389 | |||
390 | if (mpeg_status() && (seconds >= dseconds)) | ||
391 | { | ||
392 | /* stop and restart recording */ | ||
393 | mpeg_stop(); | ||
394 | have_recorded = true; | ||
395 | mpeg_record(create_filename()); | ||
396 | update_countdown = 1; | ||
397 | last_seconds = 0; | ||
398 | } | ||
399 | |||
400 | /* Display the record timesplit interval rather than | ||
401 | the file size if the record timer is active */ | ||
402 | dhours = dseconds / 3600; | ||
403 | dminutes = (dseconds - (dhours * 3600)) / 60; | ||
404 | snprintf(buf, 32, "%s %02d:%02d", | ||
405 | str(LANG_RECORD_TIMESPLIT_REC), | ||
406 | dhours, dminutes); | ||
407 | } | ||
408 | else | ||
409 | snprintf(buf, 32, "%s %s", str(LANG_RECORDING_SIZE), | ||
410 | num2max5(mpeg_num_recorded_bytes(), buf2)); | ||
372 | lcd_puts(0, 1, buf); | 411 | lcd_puts(0, 1, buf); |
373 | 412 | ||
374 | peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); | 413 | peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); |
diff --git a/apps/settings.c b/apps/settings.c index 965037b0a8..7805518872 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -1032,9 +1032,15 @@ bool settings_load_config(char* file) | |||
1032 | set_sound(value, SOUND_RIGHT_GAIN, &global_settings.rec_right_gain); | 1032 | set_sound(value, SOUND_RIGHT_GAIN, &global_settings.rec_right_gain); |
1033 | else if (!strcasecmp(name, "rec quality")) | 1033 | else if (!strcasecmp(name, "rec quality")) |
1034 | set_cfg_int(&global_settings.rec_quality, value, 0, 7); | 1034 | set_cfg_int(&global_settings.rec_quality, value, 0, 7); |
1035 | else if (!strcasecmp(name, "rec timesplit")){ | ||
1036 | static char* options[] = {"off", "00:05","00:10","00:15", | ||
1037 | "00:30","01:00","02:00","04:00"}; | ||
1038 | set_cfg_option(&global_settings.rec_timesplit, value, | ||
1039 | options, 8); | ||
1040 | } | ||
1035 | else if (!strcasecmp(name, "rec source")) { | 1041 | else if (!strcasecmp(name, "rec source")) { |
1036 | static char* options[] = {"mic", "line", "spdif"}; | 1042 | static char* options[] = {"mic", "line", "spdif"}; |
1037 | set_cfg_option(&global_settings.rec_source, value, options, 3); | 1043 | set_cfg_option(&global_settings.rec_source, value, options, 3); |
1038 | } | 1044 | } |
1039 | else if (!strcasecmp(name, "rec frequency")) { | 1045 | else if (!strcasecmp(name, "rec frequency")) { |
1040 | static char* options[] = {"44", "48", "32", "22", "24", "16"}; | 1046 | static char* options[] = {"44", "48", "32", "22", "24", "16"}; |
diff --git a/apps/settings.h b/apps/settings.h index 56bba8878d..49f4d588f2 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -75,6 +75,16 @@ struct user_settings | |||
75 | int rec_left_gain; /* 0-15 */ | 75 | int rec_left_gain; /* 0-15 */ |
76 | int rec_right_gain; /* 0-15 */ | 76 | int rec_right_gain; /* 0-15 */ |
77 | bool rec_editable; /* true means that the bit reservoir is off */ | 77 | bool rec_editable; /* true means that the bit reservoir is off */ |
78 | |||
79 | /* note: timesplit setting is not saved */ | ||
80 | int rec_timesplit; /* 0 = off | ||
81 | 1 = 00:05 | ||
82 | 2 = 00:10 | ||
83 | 3 = 00:15 | ||
84 | 4 = 00:30 | ||
85 | 5 = 01:00 | ||
86 | 6 = 02:00 | ||
87 | 7 = 04:00 */ | ||
78 | 88 | ||
79 | /* device settings */ | 89 | /* device settings */ |
80 | 90 | ||
diff --git a/apps/sound_menu.c b/apps/sound_menu.c index 26f37ea0e7..f101b5d8a4 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c | |||
@@ -225,6 +225,17 @@ static bool receditable(void) | |||
225 | return set_bool(str(LANG_RECORDING_EDITABLE), | 225 | return set_bool(str(LANG_RECORDING_EDITABLE), |
226 | &global_settings.rec_editable); | 226 | &global_settings.rec_editable); |
227 | } | 227 | } |
228 | |||
229 | static bool rectimesplit(void) | ||
230 | { | ||
231 | char *names[] = {str(LANG_OFF), "00:05","00:10","00:15", | ||
232 | "00:30","01:00","02:00","04:00"}; | ||
233 | |||
234 | return set_option(str(LANG_RECORD_TIMESPLIT), | ||
235 | &global_settings.rec_timesplit, | ||
236 | names, 8, NULL ); | ||
237 | } | ||
238 | |||
228 | #endif /* HAVE_MAS3587F */ | 239 | #endif /* HAVE_MAS3587F */ |
229 | 240 | ||
230 | static void set_chanconf(int val) | 241 | static void set_chanconf(int val) |
@@ -282,6 +293,7 @@ bool recording_menu(void) | |||
282 | { str(LANG_RECORDING_SOURCE), recsource }, | 293 | { str(LANG_RECORDING_SOURCE), recsource }, |
283 | { str(LANG_RECORDING_CHANNELS), recchannels }, | 294 | { str(LANG_RECORDING_CHANNELS), recchannels }, |
284 | { str(LANG_RECORDING_EDITABLE), receditable }, | 295 | { str(LANG_RECORDING_EDITABLE), receditable }, |
296 | { str(LANG_RECORD_TIMESPLIT), rectimesplit }, | ||
285 | }; | 297 | }; |
286 | 298 | ||
287 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); | 299 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); |
diff --git a/docs/CREDITS b/docs/CREDITS index d7eeb08d99..16463d0750 100644 --- a/docs/CREDITS +++ b/docs/CREDITS | |||
@@ -67,3 +67,4 @@ Craig Sather | |||
67 | José Maria Garcia-Valdecasas Bernal | 67 | José Maria Garcia-Valdecasas Bernal |
68 | Stevie Oh | 68 | Stevie Oh |
69 | Jörg Hohensohn | 69 | Jörg Hohensohn |
70 | Dave Jones | ||