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/recording.c | |
parent | 1c4ea83bba9ce7ec7ede6141c1ee66c12c20f1d6 (diff) | |
download | rockbox-74976c1484d7c8a89a290ffc7e4a7525874278b4.tar.gz rockbox-74976c1484d7c8a89a290ffc7e4a7525874278b4.zip |
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/recording.c')
-rw-r--r-- | apps/recorder/recording.c | 75 |
1 files changed, 35 insertions, 40 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index d94508e547..bc26ff8495 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -160,7 +160,8 @@ bool recording_screen(void) | |||
160 | global_settings.rec_quality, | 160 | global_settings.rec_quality, |
161 | global_settings.rec_source, | 161 | global_settings.rec_source, |
162 | global_settings.rec_channels, | 162 | global_settings.rec_channels, |
163 | global_settings.rec_editable); | 163 | global_settings.rec_editable, |
164 | global_settings.rec_prerecord_time); | ||
164 | 165 | ||
165 | set_gain(); | 166 | set_gain(); |
166 | 167 | ||
@@ -174,7 +175,7 @@ bool recording_screen(void) | |||
174 | switch(button) | 175 | switch(button) |
175 | { | 176 | { |
176 | case BUTTON_OFF: | 177 | case BUTTON_OFF: |
177 | if(mpeg_status()) | 178 | if(mpeg_status() & MPEG_STATUS_RECORD) |
178 | { | 179 | { |
179 | mpeg_stop(); | 180 | mpeg_stop(); |
180 | status_set_playmode(STATUS_STOP); | 181 | status_set_playmode(STATUS_STOP); |
@@ -190,7 +191,7 @@ bool recording_screen(void) | |||
190 | 191 | ||
191 | case BUTTON_PLAY: | 192 | case BUTTON_PLAY: |
192 | /* Only act if the mpeg is stopped */ | 193 | /* Only act if the mpeg is stopped */ |
193 | if(!mpeg_status()) | 194 | if(!(mpeg_status() & MPEG_STATUS_RECORD)) |
194 | { | 195 | { |
195 | have_recorded = true; | 196 | have_recorded = true; |
196 | mpeg_record(rec_create_filename()); | 197 | mpeg_record(rec_create_filename()); |
@@ -305,13 +306,16 @@ bool recording_screen(void) | |||
305 | if (recording_menu(false)) | 306 | if (recording_menu(false)) |
306 | return SYS_USB_CONNECTED; | 307 | return SYS_USB_CONNECTED; |
307 | settings_save(); | 308 | settings_save(); |
309 | |||
308 | mpeg_set_recording_options(global_settings.rec_frequency, | 310 | mpeg_set_recording_options(global_settings.rec_frequency, |
309 | global_settings.rec_quality, | 311 | global_settings.rec_quality, |
310 | global_settings.rec_source, | 312 | global_settings.rec_source, |
311 | global_settings.rec_channels, | 313 | global_settings.rec_channels, |
312 | global_settings.rec_editable); | 314 | global_settings.rec_editable, |
315 | global_settings.rec_prerecord_time); | ||
313 | 316 | ||
314 | set_gain(); | 317 | set_gain(); |
318 | |||
315 | update_countdown = 1; /* Update immediately */ | 319 | update_countdown = 1; /* Update immediately */ |
316 | 320 | ||
317 | lcd_setfont(FONT_SYSFIXED); | 321 | lcd_setfont(FONT_SYSFIXED); |
@@ -319,7 +323,7 @@ bool recording_screen(void) | |||
319 | break; | 323 | break; |
320 | 324 | ||
321 | case BUTTON_F2: | 325 | case BUTTON_F2: |
322 | if(!mpeg_status()) | 326 | if(mpeg_status() != MPEG_STATUS_RECORD) |
323 | { | 327 | { |
324 | if (f2_rec_screen()) | 328 | if (f2_rec_screen()) |
325 | { | 329 | { |
@@ -332,7 +336,7 @@ bool recording_screen(void) | |||
332 | break; | 336 | break; |
333 | 337 | ||
334 | case BUTTON_F3: | 338 | case BUTTON_F3: |
335 | if(!mpeg_status()) | 339 | if(mpeg_status() != MPEG_STATUS_RECORD) |
336 | { | 340 | { |
337 | if (f3_rec_screen()) | 341 | if (f3_rec_screen()) |
338 | { | 342 | { |
@@ -346,14 +350,12 @@ bool recording_screen(void) | |||
346 | 350 | ||
347 | case SYS_USB_CONNECTED: | 351 | case SYS_USB_CONNECTED: |
348 | /* Only accept USB connection when not recording */ | 352 | /* Only accept USB connection when not recording */ |
349 | if(!mpeg_status()) | 353 | if(mpeg_status() != MPEG_STATUS_RECORD) |
350 | { | 354 | { |
351 | usb_screen(); | 355 | usb_screen(); |
352 | have_recorded = true; /* Refreshes the browser later on */ | 356 | have_recorded = true; /* Refreshes the browser later on */ |
353 | done = true; | 357 | done = true; |
354 | } | 358 | } |
355 | lcd_setfont(FONT_SYSFIXED); | ||
356 | lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); | ||
357 | break; | 359 | break; |
358 | } | 360 | } |
359 | 361 | ||
@@ -387,21 +389,28 @@ bool recording_screen(void) | |||
387 | 389 | ||
388 | dseconds = rec_timesplit_seconds(); | 390 | dseconds = rec_timesplit_seconds(); |
389 | 391 | ||
390 | /* Display the split interval if the record timesplit | 392 | if(mpeg_status() & MPEG_STATUS_PRERECORD) |
391 | is active */ | ||
392 | if (global_settings.rec_timesplit) | ||
393 | { | 393 | { |
394 | /* Display the record timesplit interval rather than | 394 | snprintf(buf, 32, "%s...", str(LANG_RECORD_PRERECORD)); |
395 | the file size if the record timer is active */ | ||
396 | dhours = dseconds / 3600; | ||
397 | dminutes = (dseconds - (dhours * 3600)) / 60; | ||
398 | snprintf(buf, 32, "%s %02d:%02d", | ||
399 | str(LANG_RECORD_TIMESPLIT_REC), | ||
400 | dhours, dminutes); | ||
401 | } | 395 | } |
402 | else | 396 | else |
403 | snprintf(buf, 32, "%s %s", str(LANG_RECORDING_SIZE), | 397 | { |
404 | num2max5(mpeg_num_recorded_bytes(), buf2)); | 398 | /* Display the split interval if the record timesplit |
399 | is active */ | ||
400 | if (global_settings.rec_timesplit) | ||
401 | { | ||
402 | /* Display the record timesplit interval rather than | ||
403 | the file size if the record timer is active */ | ||
404 | dhours = dseconds / 3600; | ||
405 | dminutes = (dseconds - (dhours * 3600)) / 60; | ||
406 | snprintf(buf, 32, "%s %02d:%02d", | ||
407 | str(LANG_RECORD_TIMESPLIT_REC), | ||
408 | dhours, dminutes); | ||
409 | } | ||
410 | else | ||
411 | snprintf(buf, 32, "%s %s", str(LANG_RECORDING_SIZE), | ||
412 | num2max5(mpeg_num_recorded_bytes(), buf2)); | ||
413 | } | ||
405 | lcd_puts(0, 1, buf); | 414 | lcd_puts(0, 1, buf); |
406 | 415 | ||
407 | /* We will do file splitting regardless, since the OFF | 416 | /* We will do file splitting regardless, since the OFF |
@@ -622,7 +631,8 @@ bool f2_rec_screen(void) | |||
622 | global_settings.rec_quality, | 631 | global_settings.rec_quality, |
623 | global_settings.rec_source, | 632 | global_settings.rec_source, |
624 | global_settings.rec_channels, | 633 | global_settings.rec_channels, |
625 | global_settings.rec_editable); | 634 | global_settings.rec_editable, |
635 | global_settings.rec_prerecord_time); | ||
626 | 636 | ||
627 | set_gain(); | 637 | set_gain(); |
628 | 638 | ||
@@ -671,22 +681,6 @@ bool f3_rec_screen(void) | |||
671 | used = true; | 681 | used = true; |
672 | break; | 682 | break; |
673 | 683 | ||
674 | case BUTTON_DOWN: | ||
675 | case BUTTON_F3 | BUTTON_DOWN: | ||
676 | global_settings.rec_frequency++; | ||
677 | if(global_settings.rec_frequency > 5) | ||
678 | global_settings.rec_frequency = 0; | ||
679 | used = true; | ||
680 | break; | ||
681 | |||
682 | case BUTTON_RIGHT: | ||
683 | case BUTTON_F3 | BUTTON_RIGHT: | ||
684 | global_settings.rec_channels++; | ||
685 | if(global_settings.rec_channels > 1) | ||
686 | global_settings.rec_channels = 0; | ||
687 | used = true; | ||
688 | break; | ||
689 | |||
690 | case BUTTON_F3 | BUTTON_REL: | 684 | case BUTTON_F3 | BUTTON_REL: |
691 | if ( used ) | 685 | if ( used ) |
692 | exit = true; | 686 | exit = true; |
@@ -707,10 +701,11 @@ bool f3_rec_screen(void) | |||
707 | global_settings.rec_quality, | 701 | global_settings.rec_quality, |
708 | global_settings.rec_source, | 702 | global_settings.rec_source, |
709 | global_settings.rec_channels, | 703 | global_settings.rec_channels, |
710 | global_settings.rec_editable); | 704 | global_settings.rec_editable, |
705 | global_settings.rec_prerecord_time); | ||
711 | 706 | ||
712 | set_gain(); | 707 | set_gain(); |
713 | 708 | ||
714 | settings_save(); | 709 | settings_save(); |
715 | lcd_setfont(FONT_UI); | 710 | lcd_setfont(FONT_UI); |
716 | 711 | ||