From ce05addf52ed784026d9ca8397f3c2e239ff9ed4 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sun, 15 Apr 2007 22:16:28 +0000 Subject: Revert recording/repeat timer for now. It is useful as a feature, but didn't receive enough testing on multiple targets, and fixing it is non-trivial. Later reversal would be complicated because of .lng spreading. * The patch should probably redone in a different way, as it's huge for what it does... * Issues: (1) The repeat timer setting has NULL pointer hits. (2) The multi-int setting screen breaks with proportional fonts, and with somewhat larger fonts. (3) On some targets, all values except the leftmost one are unreachable. * Hint: The timer itself would be much simpler if it'd just store & compare ticks (497 days before it wraps). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13172 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/icons.c | 10 +-- apps/recorder/icons.h | 7 --- apps/recorder/recording.c | 152 ++-------------------------------------------- apps/recorder/recording.h | 17 ------ 4 files changed, 7 insertions(+), 179 deletions(-) (limited to 'apps/recorder') diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index bf6500fb1f..ccb42d5919 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c @@ -44,14 +44,6 @@ const unsigned char bitmap_icons_5x8[][5] = #endif }; -const unsigned char bitmap_icons_7x7[][7] = -{ - [Icon_Timer] = - {0x1c, 0x22, 0x41, 0x4f, 0x49, 0x22, 0x1d}, /* Recording timer icon */ - [Icon_Timer_rep]= - {0x17, 0x26, 0x45, 0x41, 0x51, 0x32, 0x74}, /* Recording repeat timer icon */ -}; - const unsigned char bitmap_icons_6x8[][6] = { { 0x60, 0x7f, 0x03, 0x33, 0x3f, 0x00 }, /* Musical note */ @@ -167,7 +159,7 @@ const unsigned char bitmap_icon_disk[12] = #ifdef HAVE_MMC {0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; #else - {0x1c,0x2e,0x4f,0x77,0x79,0x3a,0x1c,0x00,0x00,0x00,0x00,0x00}; + {0x00,0x00,0x00,0x1c,0x2e,0x4f,0x77,0x79,0x3a,0x1c,0x00,0x00}; #endif /* diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index 09aadf0888..7682d44733 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h @@ -49,12 +49,6 @@ enum icons_5x8 { Icon5x8Last }; -enum icons_7x7 { - Icon_Timer, - Icon_Timer_rep, - Icon7x7Last -}; - /* If any icons are added to this enum, they must be added to the unused_but_needed enum in ../player/icons.h */ enum icons_6x8 { @@ -150,7 +144,6 @@ extern const unsigned char bitmap_formats_18x8[Format_18x8Last][18]; #endif /* CONFIG_CODEC == SWCODEC && defined (HAVE_RECORDING) */ extern const unsigned char bitmap_icons_5x8[Icon5x8Last][5]; -extern const unsigned char bitmap_icons_7x7[Icon7x7Last][7]; extern const unsigned char bitmap_icons_6x8[Icon6x8Last][6]; extern const unsigned char bitmap_icons_7x8[Icon7x8Last][7]; extern const unsigned char bitmap_icon_disk[]; diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 7a332228e5..025480cf91 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -70,8 +70,6 @@ #include "radio.h" #ifdef HAVE_RECORDING -static struct timer timer; - static bool in_screen = false; bool in_recording_screen(void) @@ -747,37 +745,6 @@ static void trigger_listener(int trigger_status) } } -/* countdown timer tick task */ -void timer_tick_task(void) -{ - static int mini_tick = 0; - - mini_tick ++; - /* the countdown */ - if ((mini_tick >= HZ) && (timer.countdown)) - { - mini_tick = 0; - if (timer.secs) timer.secs -= 1; - else{ - timer.secs = 59; - if (timer.mins) timer.mins -= 1; - else{ - timer.mins = 59; - if (timer.hrs) timer.hrs -= 1; - else{ - timer.hrs = 23; - if (timer.days) timer.days -= 1; - else{ - timer.days = timer.hrs = timer.mins = timer.secs = 0; - /* switch timer display on/off when countdown finished */ - timer.timer_display = !timer.timer_display; - } - } - } - } - } -} - bool recording_start_automatic = false; bool recording_screen(bool no_source) @@ -789,7 +756,7 @@ bool recording_screen(bool no_source) int w, h; int update_countdown = 1; bool have_recorded = false; - unsigned int seconds, prerec = 0; + unsigned int seconds; int hours, minutes; char filename[13]; bool been_in_usb_mode = false; @@ -826,9 +793,6 @@ bool recording_screen(bool no_source) int trig_xpos[NB_SCREENS]; int trig_ypos[NB_SCREENS]; int trig_width[NB_SCREENS]; - int countdown_offset = 0; - bool repeat_timer_start = false; - unsigned int repeat_timer; static const unsigned char *byte_units[] = { ID2P(LANG_BYTE), @@ -840,11 +804,6 @@ bool recording_screen(bool no_source) struct audio_recording_options rec_options; in_screen = true; - - /* Stop countdown if countdown settings changed */ - if (!timer.countdown) - tick_remove_task(timer_tick_task); - cursor = 0; #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) ata_set_led_enabled(false); @@ -978,25 +937,6 @@ bool recording_screen(bool no_source) last_audio_stat = audio_stat; } - /* repeat_timer is the repeat time in seconds */ - repeat_timer = (timer.mins_rpt * 60 + timer.hrs_rpt * - 3600 + timer.days_rpt * 3600 * 24); - - /* decide on repeat timer status */ - if ((repeat_timer > rec_timesplit_seconds()) && - global_settings.rec_timesplit) - timer.repeater = true; - else - timer.repeater = false; - - /* When countdown timer reaches zero fake a new file button press */ - if (timer.countdown && !timer.days && !timer.hrs && !timer.mins && - !timer.secs) - { - tick_remove_task(timer_tick_task); - button = ACTION_REC_NEWFILE; - timer.countdown = false; - } if (recording_start_automatic) { @@ -1051,27 +991,7 @@ bool recording_screen(bool no_source) case ACTION_REC_NEWFILE: /* Only act if the mpeg is stopped */ if(!(audio_stat & AUDIO_STATUS_RECORD)) - { /* if countdown timer is set, start countdown */ - if (timer.days || timer.hrs || timer.mins || timer.secs) - { - if (button == ACTION_REC_PAUSE) - { - timer.countdown = !timer.countdown; - if (timer.countdown) - tick_add_task(timer_tick_task); - else - tick_remove_task(timer_tick_task); - break; - } - else - { - /* if newfile button pressed and countdown timer is on, - start new file and reset timer */ - tick_remove_task(timer_tick_task); - timer.days = timer.hrs = timer.mins = timer.secs = 0; - timer.countdown = false; - } - } + { /* is this manual or triggered recording? */ if ((global_settings.rec_trigger_mode == TRIG_MODE_OFF) || (peak_meter_trigger_status() != TRIG_OFF)) @@ -1079,11 +999,6 @@ bool recording_screen(bool no_source) /* manual recording */ have_recorded = true; rec_record(); - repeat_timer_start = true; /* allow access to repeat timer - code */ - /* amount of file that has been prerecorded - needed for - syncing repeat timer */ - prerec = audio_recorded_time() / HZ; last_seconds = 0; if (talk_menu) { /* no voice possible here, but a beep */ @@ -1282,6 +1197,7 @@ bool recording_screen(bool no_source) #ifdef HAVE_FMRADIO_IN const int prev_rec_source = global_settings.rec_source; #endif + #if (CONFIG_LED == LED_REAL) /* led is restored at begin of loop / end of function */ led(false); @@ -1305,10 +1221,6 @@ bool recording_screen(bool no_source) && prev_rec_source == AUDIO_SRC_FMRADIO) radio_status = FMRADIO_OFF; #endif - /* if countdown timer settings changed in menu, - stop counting and reset */ - if (!timer.countdown) - tick_remove_task(timer_tick_task); #if CONFIG_CODEC == SWCODEC /* reinit after submenu exit */ @@ -1407,9 +1319,6 @@ bool recording_screen(bool no_source) break; } /* end switch */ - /* display timer status in status bar if countdown enabled */ - timer.timer_display = timer.countdown; - #ifdef HAVE_AGC peak_read = !peak_read; if (peak_read) { /* every 2nd run of loop */ @@ -1460,13 +1369,11 @@ bool recording_screen(bool no_source) #endif /* CONFIG_CODEC == SWCODEC */ if ((global_settings.rec_sizesplit) && (global_settings.rec_split_method)) { - countdown_offset = 1; dmb = dsize/1024/1024; snprintf(buf, sizeof(buf), "%s %dMB", str(LANG_SYSFONT_SPLIT_SIZE), dmb); } - /* only display recording time if countdown timer is off */ - else if (!timer.days && !timer.hrs && !timer.mins && !timer.secs) + else { hours = seconds / 3600; minutes = (seconds - (hours * 3600)) / 60; @@ -1474,11 +1381,6 @@ bool recording_screen(bool no_source) str(LANG_SYSFONT_RECORDING_TIME), hours, minutes, seconds%60); } - else - { - countdown_offset = 0; - snprintf(buf, 32, ""); - } for(i = 0; i < screen_update; i++) screens[i].puts(0, 0, buf); @@ -1502,8 +1404,7 @@ bool recording_screen(bool no_source) str(LANG_SYSFONT_RECORD_TIMESPLIT_REC), dhours, dminutes); } - /* only display recording size if countdown timer is off */ - else if (!timer.days && !timer.hrs && !timer.mins && !timer.secs) + else { output_dyn_value(buf2, sizeof buf2, num_recorded_bytes, @@ -1515,16 +1416,6 @@ bool recording_screen(bool no_source) for(i = 0; i < screen_update; i++) screens[i].puts(0, 1, buf); - /* display countdown timer if set */ - if (timer.days || timer.hrs || timer.mins || timer.secs) - { - snprintf(buf, 32, "%s %d:%02d:%02d:%02d", str(LANG_REC_TIMER), - timer.days, timer.hrs, timer.mins, timer.secs); - - for(i = 0; i < screen_update; i++) - screens[i].puts(0, countdown_offset, buf); - } - for(i = 0; i < screen_update; i++) { if (filename_offset[i] > 0) @@ -1558,36 +1449,11 @@ bool recording_screen(bool no_source) rec_new_file(); last_seconds = 0; } - else if (repeat_timer_start) + else { peak_meter_trigger(false); peak_meter_set_trigger_listener(NULL); audio_stop_recording(); - - /* stop any more attempts to access this code until a new - recording is started */ - repeat_timer_start = false; - - /* start repeat countdown if set and only if - stop time < repeat time */ - if (timer.repeater) - { - repeat_timer -= dseconds; - timer.days = repeat_timer / (3600 * 24); - timer.hrs = (repeat_timer - (timer.days * 3600 * 24)) / - 3600; - timer.mins = (repeat_timer - (timer.hrs * 3600)) / 60; - timer.secs = prerec; /* add prerecorded time to timer */ - - /* This is not really a toggle so much as a safety feature - so that it is impossible to start the timer more than - once */ - timer.countdown = !timer.countdown; - if (timer.countdown) - tick_add_task(timer_tick_task); - else - tick_remove_task(timer_tick_task); - } } update_countdown = 1; } @@ -2169,12 +2035,6 @@ static bool f3_rec_screen(void) } #endif /* CONFIG_KEYPAD == RECORDER_PAD */ -struct timer *get_timerstat(void) -{ - return &timer; -} - - #if CONFIG_CODEC == SWCODEC void audio_beep(int duration) { diff --git a/apps/recorder/recording.h b/apps/recorder/recording.h index 4fba37b68a..3ca1f35834 100644 --- a/apps/recorder/recording.h +++ b/apps/recorder/recording.h @@ -25,22 +25,6 @@ bool recording_screen(bool no_source); char *rec_create_filename(char *buf); int rec_create_directory(void); -struct timer -{ - bool countdown; - bool timer_display; - unsigned int days; - unsigned int hrs; - unsigned int mins; - unsigned int secs; - unsigned int days_rpt; - unsigned int hrs_rpt; - unsigned int mins_rpt; - bool repeater; -}; - -struct timer *get_timerstat(void); - /* If true, start recording automatically when recording_sreen() is entered */ extern bool recording_start_automatic; @@ -49,7 +33,6 @@ extern bool recording_start_automatic; void rec_set_source(int source, unsigned flags); #endif /* CONFIG_CODEC == SW_CODEC */ -struct audio_recording_options; /* Initializes a recording_options structure with global settings. pass returned data to audio_set_recording_options or rec_set_recording_options */ -- cgit v1.2.3