summaryrefslogtreecommitdiff
path: root/apps/recorder/radio.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/radio.c')
-rw-r--r--apps/recorder/radio.c47
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)
172 172
173 mpeg_set_recording_options(global_settings.rec_frequency, 173 mpeg_set_recording_options(global_settings.rec_frequency,
174 global_settings.rec_quality, 174 global_settings.rec_quality,
175 1 /* Line In */, 175 1, /* Line In */
176 global_settings.rec_channels, 176 global_settings.rec_channels,
177 global_settings.rec_editable); 177 global_settings.rec_editable,
178 global_settings.rec_prerecord_time);
178 179
179 180
180 mpeg_set_recording_gain(mpeg_sound_default(SOUND_LEFT_GAIN), 181 mpeg_set_recording_gain(mpeg_sound_default(SOUND_LEFT_GAIN),
@@ -230,7 +231,7 @@ bool radio_screen(void)
230 switch(button) 231 switch(button)
231 { 232 {
232 case BUTTON_OFF: 233 case BUTTON_OFF:
233 if(mpeg_status()) 234 if(mpeg_status() == MPEG_STATUS_RECORD)
234 { 235 {
235 mpeg_stop(); 236 mpeg_stop();
236 status_set_playmode(STATUS_STOP); 237 status_set_playmode(STATUS_STOP);
@@ -244,17 +245,16 @@ bool radio_screen(void)
244 break; 245 break;
245 246
246 case BUTTON_F3: 247 case BUTTON_F3:
247 /* Only act if the mpeg is stopped */ 248 if(mpeg_status() == MPEG_STATUS_RECORD)
248 if(!mpeg_status())
249 { 249 {
250 have_recorded = true; 250 mpeg_new_file(rec_create_filename());
251 mpeg_record(rec_create_filename());
252 status_set_playmode(STATUS_RECORD);
253 update_screen = true; 251 update_screen = true;
254 } 252 }
255 else 253 else
256 { 254 {
257 mpeg_new_file(rec_create_filename()); 255 have_recorded = true;
256 mpeg_record(rec_create_filename());
257 status_set_playmode(STATUS_RECORD);
258 update_screen = true; 258 update_screen = true;
259 } 259 }
260 last_seconds = 0; 260 last_seconds = 0;
@@ -353,11 +353,12 @@ bool radio_screen(void)
353 353
354 case SYS_USB_CONNECTED: 354 case SYS_USB_CONNECTED:
355 /* Only accept USB connection when not recording */ 355 /* Only accept USB connection when not recording */
356 if(!mpeg_status()) 356 if(mpeg_status() != MPEG_STATUS_RECORD)
357 { 357 {
358 usb_screen(); 358 usb_screen();
359 fmradio_set_status(0); 359 fmradio_set_status(0);
360 have_recorded = true; /* Refreshes the browser later on */ 360 screen_freeze = true; /* Cosmetic: makes sure the
361 radio screen doesn't redraw */
361 done = true; 362 done = true;
362 } 363 }
363 break; 364 break;
@@ -368,6 +369,8 @@ bool radio_screen(void)
368 if(!screen_freeze) 369 if(!screen_freeze)
369 { 370 {
370 lcd_setmargins(0, 8); 371 lcd_setmargins(0, 8);
372
373 /* Only display the peak meter when not recording */
371 if(!mpeg_status()) 374 if(!mpeg_status())
372 { 375 {
373 lcd_clearrect(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh); 376 lcd_clearrect(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh);
@@ -415,7 +418,7 @@ bool radio_screen(void)
415 str(LANG_CHANNEL_MONO)); 418 str(LANG_CHANNEL_MONO));
416 lcd_puts(0, top_of_screen + 2, buf); 419 lcd_puts(0, top_of_screen + 2, buf);
417 420
418 if(mpeg_status()) 421 if(mpeg_status() == MPEG_STATUS_RECORD)
419 { 422 {
420 hours = seconds / 3600; 423 hours = seconds / 3600;
421 minutes = (seconds - (hours * 3600)) / 60; 424 minutes = (seconds - (hours * 3600)) / 60;
@@ -424,6 +427,12 @@ bool radio_screen(void)
424 hours, minutes, seconds%60); 427 hours, minutes, seconds%60);
425 lcd_puts(0, top_of_screen + 3, buf); 428 lcd_puts(0, top_of_screen + 3, buf);
426 } 429 }
430 else
431 {
432 snprintf(buf, 32, "%s %02d",
433 str(LANG_RECORD_PRERECORD), seconds%60);
434 lcd_puts(0, top_of_screen + 3, buf);
435 }
427 436
428 /* Only force the redraw if update_screen is true */ 437 /* Only force the redraw if update_screen is true */
429 status_draw(update_screen); 438 status_draw(update_screen);
@@ -687,7 +696,19 @@ bool radio_delete_preset(void)
687 696
688static bool fm_recording_settings(void) 697static bool fm_recording_settings(void)
689{ 698{
690 return recording_menu(true); 699 bool ret;
700
701 ret = recording_menu(true);
702 if(!ret)
703 {
704 mpeg_set_recording_options(global_settings.rec_frequency,
705 global_settings.rec_quality,
706 1, /* Line In */
707 global_settings.rec_channels,
708 global_settings.rec_editable,
709 global_settings.rec_prerecord_time);
710 }
711 return ret;
691} 712}
692 713
693bool radio_menu(void) 714bool radio_menu(void)