From 56f771e76a8b7707553c472d08b745e45f79c64f Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Wed, 4 Jun 2003 13:48:50 +0000 Subject: Dave Jones' recording time split feature (patch #697373) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3725 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 10 ++++++++++ apps/recorder/recording.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- apps/settings.c | 8 +++++++- apps/settings.h | 10 ++++++++++ apps/sound_menu.c | 12 ++++++++++++ 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 desc: (player) Delay before making a jump scroll eng: "Jump Scroll Delay" new: + +id: LANG_RECORD_TIMESPLIT +desc: Prompt for record timer interval setting, in the record settings menu +eng: "Time Split" +new: + +id: LANG_RECORD_TIMESPLIT_REC +decs: Display of record timer interval setting, on the record screen +eng: "Split time:" +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[] = "%d.%02d %s " /* 2 decimals */ }; +/* This array holds the record timer interval lengths, in seconds */ +static unsigned long rec_timer_seconds[] = +{ + 0, /* off */ + 300, /* 00:05 */ + 600, /* 00:10 */ + 900, /* 00:15 */ + 1800, /* 00:30 */ + 3600, /* 01:00 */ + 7200, /* 02:00 */ + 14400, /* 04:00 */ +}; + char *fmt_gain(int snd, int val, char *str, int len) { int tmp, i, d, numdec; @@ -349,7 +362,7 @@ bool recording_screen(void) timeout = current_tick + HZ/10; seconds = mpeg_recorded_time() / HZ; - + update_countdown--; if(update_countdown == 0 || seconds > last_seconds) { @@ -367,8 +380,34 @@ bool recording_screen(void) hours, minutes, seconds%60); lcd_puts(0, 0, buf); - snprintf(buf, 32, "%s %s", str(LANG_RECORDING_SIZE), - num2max5(mpeg_num_recorded_bytes(), buf2)); + /* if the record timesplit is active */ + if (global_settings.rec_timesplit) + { + unsigned long dseconds, dhours, dminutes; + int rti = global_settings.rec_timesplit; + dseconds = rec_timer_seconds[rti]; + + if (mpeg_status() && (seconds >= dseconds)) + { + /* stop and restart recording */ + mpeg_stop(); + have_recorded = true; + mpeg_record(create_filename()); + update_countdown = 1; + last_seconds = 0; + } + + /* Display the record timesplit interval rather than + the file size if the record timer is active */ + dhours = dseconds / 3600; + dminutes = (dseconds - (dhours * 3600)) / 60; + snprintf(buf, 32, "%s %02d:%02d", + str(LANG_RECORD_TIMESPLIT_REC), + dhours, dminutes); + } + else + snprintf(buf, 32, "%s %s", str(LANG_RECORDING_SIZE), + num2max5(mpeg_num_recorded_bytes(), buf2)); lcd_puts(0, 1, buf); 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) set_sound(value, SOUND_RIGHT_GAIN, &global_settings.rec_right_gain); else if (!strcasecmp(name, "rec quality")) set_cfg_int(&global_settings.rec_quality, value, 0, 7); + else if (!strcasecmp(name, "rec timesplit")){ + static char* options[] = {"off", "00:05","00:10","00:15", + "00:30","01:00","02:00","04:00"}; + set_cfg_option(&global_settings.rec_timesplit, value, + options, 8); + } else if (!strcasecmp(name, "rec source")) { static char* options[] = {"mic", "line", "spdif"}; - set_cfg_option(&global_settings.rec_source, value, options, 3); + set_cfg_option(&global_settings.rec_source, value, options, 3); } else if (!strcasecmp(name, "rec frequency")) { 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 int rec_left_gain; /* 0-15 */ int rec_right_gain; /* 0-15 */ bool rec_editable; /* true means that the bit reservoir is off */ + + /* note: timesplit setting is not saved */ + int rec_timesplit; /* 0 = off + 1 = 00:05 + 2 = 00:10 + 3 = 00:15 + 4 = 00:30 + 5 = 01:00 + 6 = 02:00 + 7 = 04:00 */ /* device settings */ 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) return set_bool(str(LANG_RECORDING_EDITABLE), &global_settings.rec_editable); } + +static bool rectimesplit(void) +{ + char *names[] = {str(LANG_OFF), "00:05","00:10","00:15", + "00:30","01:00","02:00","04:00"}; + + return set_option(str(LANG_RECORD_TIMESPLIT), + &global_settings.rec_timesplit, + names, 8, NULL ); +} + #endif /* HAVE_MAS3587F */ static void set_chanconf(int val) @@ -282,6 +293,7 @@ bool recording_menu(void) { str(LANG_RECORDING_SOURCE), recsource }, { str(LANG_RECORDING_CHANNELS), recchannels }, { str(LANG_RECORDING_EDITABLE), receditable }, + { str(LANG_RECORD_TIMESPLIT), rectimesplit }, }; 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 José Maria Garcia-Valdecasas Bernal Stevie Oh Jörg Hohensohn +Dave Jones -- cgit v1.2.3