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 /apps/recorder/recording.c | |
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
Diffstat (limited to 'apps/recorder/recording.c')
-rw-r--r-- | apps/recorder/recording.c | 45 |
1 files changed, 42 insertions, 3 deletions
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); |