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/recorder/radio.c | |
parent | 1c4ea83bba9ce7ec7ede6141c1ee66c12c20f1d6 (diff) |
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/recorder/radio.c')
-rw-r--r-- | apps/recorder/radio.c | 47 |
1 files changed, 34 insertions, 13 deletions
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) mpeg_set_recording_options(global_settings.rec_frequency, global_settings.rec_quality, - 1 /* Line In */, + 1, /* Line In */ global_settings.rec_channels, - global_settings.rec_editable); + global_settings.rec_editable, + global_settings.rec_prerecord_time); mpeg_set_recording_gain(mpeg_sound_default(SOUND_LEFT_GAIN), @@ -230,7 +231,7 @@ bool radio_screen(void) switch(button) { case BUTTON_OFF: - if(mpeg_status()) + if(mpeg_status() == MPEG_STATUS_RECORD) { mpeg_stop(); status_set_playmode(STATUS_STOP); @@ -244,17 +245,16 @@ bool radio_screen(void) break; case BUTTON_F3: - /* Only act if the mpeg is stopped */ - if(!mpeg_status()) + if(mpeg_status() == MPEG_STATUS_RECORD) { - have_recorded = true; - mpeg_record(rec_create_filename()); - status_set_playmode(STATUS_RECORD); + mpeg_new_file(rec_create_filename()); update_screen = true; } else { - mpeg_new_file(rec_create_filename()); + have_recorded = true; + mpeg_record(rec_create_filename()); + status_set_playmode(STATUS_RECORD); update_screen = true; } last_seconds = 0; @@ -353,11 +353,12 @@ bool radio_screen(void) case SYS_USB_CONNECTED: /* Only accept USB connection when not recording */ - if(!mpeg_status()) + if(mpeg_status() != MPEG_STATUS_RECORD) { usb_screen(); fmradio_set_status(0); - have_recorded = true; /* Refreshes the browser later on */ + screen_freeze = true; /* Cosmetic: makes sure the + radio screen doesn't redraw */ done = true; } break; @@ -368,6 +369,8 @@ bool radio_screen(void) if(!screen_freeze) { lcd_setmargins(0, 8); + + /* Only display the peak meter when not recording */ if(!mpeg_status()) { lcd_clearrect(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh); @@ -415,7 +418,7 @@ bool radio_screen(void) str(LANG_CHANNEL_MONO)); lcd_puts(0, top_of_screen + 2, buf); - if(mpeg_status()) + if(mpeg_status() == MPEG_STATUS_RECORD) { hours = seconds / 3600; minutes = (seconds - (hours * 3600)) / 60; @@ -424,6 +427,12 @@ bool radio_screen(void) hours, minutes, seconds%60); lcd_puts(0, top_of_screen + 3, buf); } + else + { + snprintf(buf, 32, "%s %02d", + str(LANG_RECORD_PRERECORD), seconds%60); + lcd_puts(0, top_of_screen + 3, buf); + } /* Only force the redraw if update_screen is true */ status_draw(update_screen); @@ -687,7 +696,19 @@ bool radio_delete_preset(void) static bool fm_recording_settings(void) { - return recording_menu(true); + bool ret; + + ret = recording_menu(true); + if(!ret) + { + mpeg_set_recording_options(global_settings.rec_frequency, + global_settings.rec_quality, + 1, /* Line In */ + global_settings.rec_channels, + global_settings.rec_editable, + global_settings.rec_prerecord_time); + } + return ret; } bool radio_menu(void) |