diff options
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/recording.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 39e94739b5..9ef6d4a521 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "lcd.h" | 27 | #include "lcd.h" |
28 | #include "led.h" | 28 | #include "led.h" |
29 | #include "mpeg.h" | 29 | #include "mpeg.h" |
30 | #include "audio.h" | ||
30 | #include "mp3_playback.h" | 31 | #include "mp3_playback.h" |
31 | #include "mas.h" | 32 | #include "mas.h" |
32 | #include "button.h" | 33 | #include "button.h" |
@@ -256,7 +257,7 @@ static void trigger_listener(int trigger_status) | |||
256 | switch (trigger_status) | 257 | switch (trigger_status) |
257 | { | 258 | { |
258 | case TRIG_GO: | 259 | case TRIG_GO: |
259 | if((mpeg_status() & MPEG_STATUS_RECORD) != MPEG_STATUS_RECORD) | 260 | if((audio_status() & AUDIO_STATUS_RECORD) != AUDIO_STATUS_RECORD) |
260 | { | 261 | { |
261 | talk_buffer_steal(); /* we use the mp3 buffer */ | 262 | talk_buffer_steal(); /* we use the mp3 buffer */ |
262 | mpeg_record(rec_create_filename(path_buffer)); | 263 | mpeg_record(rec_create_filename(path_buffer)); |
@@ -276,9 +277,9 @@ static void trigger_listener(int trigger_status) | |||
276 | 277 | ||
277 | /* A _change_ to TRIG_READY means the current recording has stopped */ | 278 | /* A _change_ to TRIG_READY means the current recording has stopped */ |
278 | case TRIG_READY: | 279 | case TRIG_READY: |
279 | if(mpeg_status() & MPEG_STATUS_RECORD) | 280 | if(audio_status() & AUDIO_STATUS_RECORD) |
280 | { | 281 | { |
281 | mpeg_stop(); | 282 | audio_stop(); |
282 | if (global_settings.rec_trigger_mode != TRIG_MODE_REARM) | 283 | if (global_settings.rec_trigger_mode != TRIG_MODE_REARM) |
283 | { | 284 | { |
284 | peak_meter_set_trigger_listener(NULL); | 285 | peak_meter_set_trigger_listener(NULL); |
@@ -306,7 +307,7 @@ bool recording_screen(void) | |||
306 | int hours, minutes; | 307 | int hours, minutes; |
307 | char path_buffer[MAX_PATH]; | 308 | char path_buffer[MAX_PATH]; |
308 | bool been_in_usb_mode = false; | 309 | bool been_in_usb_mode = false; |
309 | int last_mpeg_stat = -1; | 310 | int last_audio_stat = -1; |
310 | bool last_led_stat = false; | 311 | bool last_led_stat = false; |
311 | 312 | ||
312 | const unsigned char *byte_units[] = { | 313 | const unsigned char *byte_units[] = { |
@@ -352,15 +353,15 @@ bool recording_screen(void) | |||
352 | 353 | ||
353 | while(!done) | 354 | while(!done) |
354 | { | 355 | { |
355 | int mpeg_stat = mpeg_status(); | 356 | int audio_stat = audio_status(); |
356 | 357 | ||
357 | /* | 358 | /* |
358 | * Flash the LED while waiting to record. Turn it on while | 359 | * Flash the LED while waiting to record. Turn it on while |
359 | * recording. | 360 | * recording. |
360 | */ | 361 | */ |
361 | if(mpeg_stat & MPEG_STATUS_RECORD) | 362 | if(audio_stat & AUDIO_STATUS_RECORD) |
362 | { | 363 | { |
363 | if (mpeg_stat & MPEG_STATUS_PAUSE) | 364 | if (audio_stat & AUDIO_STATUS_PAUSE) |
364 | { | 365 | { |
365 | /* | 366 | /* |
366 | This is supposed to be the same as | 367 | This is supposed to be the same as |
@@ -411,24 +412,24 @@ bool recording_screen(void) | |||
411 | /* Wait for a button while drawing the peak meter */ | 412 | /* Wait for a button while drawing the peak meter */ |
412 | button = peak_meter_draw_get_btn(0, 8 + h*2, LCD_WIDTH, h); | 413 | button = peak_meter_draw_get_btn(0, 8 + h*2, LCD_WIDTH, h); |
413 | 414 | ||
414 | if (last_mpeg_stat != mpeg_stat) | 415 | if (last_audio_stat != audio_stat) |
415 | { | 416 | { |
416 | if (mpeg_stat == MPEG_STATUS_RECORD) | 417 | if (audio_stat == AUDIO_STATUS_RECORD) |
417 | { | 418 | { |
418 | have_recorded = true; | 419 | have_recorded = true; |
419 | } | 420 | } |
420 | last_mpeg_stat = mpeg_stat; | 421 | last_audio_stat = audio_stat; |
421 | } | 422 | } |
422 | 423 | ||
423 | switch(button) | 424 | switch(button) |
424 | { | 425 | { |
425 | case REC_STOPEXIT: | 426 | case REC_STOPEXIT: |
426 | if(mpeg_stat & MPEG_STATUS_RECORD) | 427 | if(audio_stat & AUDIO_STATUS_RECORD) |
427 | { | 428 | { |
428 | /* turn off the trigger */ | 429 | /* turn off the trigger */ |
429 | peak_meter_trigger(false); | 430 | peak_meter_trigger(false); |
430 | peak_meter_set_trigger_listener(NULL); | 431 | peak_meter_set_trigger_listener(NULL); |
431 | mpeg_stop(); | 432 | audio_stop(); |
432 | } | 433 | } |
433 | else | 434 | else |
434 | { | 435 | { |
@@ -444,7 +445,7 @@ bool recording_screen(void) | |||
444 | 445 | ||
445 | case REC_RECPAUSE: | 446 | case REC_RECPAUSE: |
446 | /* Only act if the mpeg is stopped */ | 447 | /* Only act if the mpeg is stopped */ |
447 | if(!(mpeg_stat & MPEG_STATUS_RECORD)) | 448 | if(!(audio_stat & AUDIO_STATUS_RECORD)) |
448 | { | 449 | { |
449 | /* is this manual or triggered recording? */ | 450 | /* is this manual or triggered recording? */ |
450 | if ((global_settings.rec_trigger_mode == TRIG_MODE_OFF) || | 451 | if ((global_settings.rec_trigger_mode == TRIG_MODE_OFF) || |
@@ -458,7 +459,7 @@ bool recording_screen(void) | |||
458 | last_seconds = 0; | 459 | last_seconds = 0; |
459 | if (global_settings.talk_menu) | 460 | if (global_settings.talk_menu) |
460 | { /* no voice possible here, but a beep */ | 461 | { /* no voice possible here, but a beep */ |
461 | mpeg_beep(HZ/2); /* longer beep on start */ | 462 | audio_beep(HZ/2); /* longer beep on start */ |
462 | } | 463 | } |
463 | } | 464 | } |
464 | 465 | ||
@@ -476,12 +477,12 @@ bool recording_screen(void) | |||
476 | } | 477 | } |
477 | else | 478 | else |
478 | { | 479 | { |
479 | if(mpeg_stat & MPEG_STATUS_PAUSE) | 480 | if(audio_stat & AUDIO_STATUS_PAUSE) |
480 | { | 481 | { |
481 | mpeg_resume_recording(); | 482 | mpeg_resume_recording(); |
482 | if (global_settings.talk_menu) | 483 | if (global_settings.talk_menu) |
483 | { /* no voice possible here, but a beep */ | 484 | { /* no voice possible here, but a beep */ |
484 | mpeg_beep(HZ/4); /* short beep on resume */ | 485 | audio_beep(HZ/4); /* short beep on resume */ |
485 | } | 486 | } |
486 | } | 487 | } |
487 | else | 488 | else |
@@ -594,7 +595,7 @@ bool recording_screen(void) | |||
594 | 595 | ||
595 | #ifdef REC_SETTINGS | 596 | #ifdef REC_SETTINGS |
596 | case REC_SETTINGS: | 597 | case REC_SETTINGS: |
597 | if(mpeg_stat != MPEG_STATUS_RECORD) | 598 | if(audio_stat != AUDIO_STATUS_RECORD) |
598 | { | 599 | { |
599 | /* led is restored at begin of loop / end of function */ | 600 | /* led is restored at begin of loop / end of function */ |
600 | led(false); | 601 | led(false); |
@@ -625,7 +626,7 @@ bool recording_screen(void) | |||
625 | 626 | ||
626 | #ifdef REC_F2 | 627 | #ifdef REC_F2 |
627 | case REC_F2: | 628 | case REC_F2: |
628 | if(mpeg_stat != MPEG_STATUS_RECORD) | 629 | if(audio_stat != AUDIO_STATUS_RECORD) |
629 | { | 630 | { |
630 | /* led is restored at begin of loop / end of function */ | 631 | /* led is restored at begin of loop / end of function */ |
631 | led(false); | 632 | led(false); |
@@ -642,14 +643,14 @@ bool recording_screen(void) | |||
642 | 643 | ||
643 | #ifdef REC_F3 | 644 | #ifdef REC_F3 |
644 | case REC_F3: | 645 | case REC_F3: |
645 | if(mpeg_stat & MPEG_STATUS_RECORD) | 646 | if(audio_stat & AUDIO_STATUS_RECORD) |
646 | { | 647 | { |
647 | mpeg_new_file(rec_create_filename(path_buffer)); | 648 | mpeg_new_file(rec_create_filename(path_buffer)); |
648 | last_seconds = 0; | 649 | last_seconds = 0; |
649 | } | 650 | } |
650 | else | 651 | else |
651 | { | 652 | { |
652 | if(mpeg_stat != MPEG_STATUS_RECORD) | 653 | if(audio_stat != AUDIO_STATUS_RECORD) |
653 | { | 654 | { |
654 | /* led is restored at begin of loop / end of function */ | 655 | /* led is restored at begin of loop / end of function */ |
655 | led(false); | 656 | led(false); |
@@ -667,7 +668,7 @@ bool recording_screen(void) | |||
667 | 668 | ||
668 | case SYS_USB_CONNECTED: | 669 | case SYS_USB_CONNECTED: |
669 | /* Only accept USB connection when not recording */ | 670 | /* Only accept USB connection when not recording */ |
670 | if(mpeg_stat != MPEG_STATUS_RECORD) | 671 | if(audio_stat != AUDIO_STATUS_RECORD) |
671 | { | 672 | { |
672 | default_event_handler(SYS_USB_CONNECTED); | 673 | default_event_handler(SYS_USB_CONNECTED); |
673 | done = true; | 674 | done = true; |
@@ -708,7 +709,7 @@ bool recording_screen(void) | |||
708 | 709 | ||
709 | dseconds = rec_timesplit_seconds(); | 710 | dseconds = rec_timesplit_seconds(); |
710 | 711 | ||
711 | if(mpeg_stat & MPEG_STATUS_PRERECORD) | 712 | if(audio_stat & AUDIO_STATUS_PRERECORD) |
712 | { | 713 | { |
713 | snprintf(buf, 32, "%s...", str(LANG_RECORD_PRERECORD)); | 714 | snprintf(buf, 32, "%s...", str(LANG_RECORD_PRERECORD)); |
714 | } | 715 | } |
@@ -741,7 +742,7 @@ bool recording_screen(void) | |||
741 | /* We will do file splitting regardless, since the OFF | 742 | /* We will do file splitting regardless, since the OFF |
742 | setting really means 24 hours. This is to make sure | 743 | setting really means 24 hours. This is to make sure |
743 | that the recorded files don't get too big. */ | 744 | that the recorded files don't get too big. */ |
744 | if (mpeg_stat && (seconds >= dseconds)) | 745 | if (audio_stat && (seconds >= dseconds)) |
745 | { | 746 | { |
746 | mpeg_new_file(rec_create_filename(path_buffer)); | 747 | mpeg_new_file(rec_create_filename(path_buffer)); |
747 | update_countdown = 1; | 748 | update_countdown = 1; |
@@ -822,7 +823,7 @@ bool recording_screen(void) | |||
822 | } | 823 | } |
823 | } | 824 | } |
824 | 825 | ||
825 | if(mpeg_stat & MPEG_STATUS_ERROR) | 826 | if(audio_stat & AUDIO_STATUS_ERROR) |
826 | { | 827 | { |
827 | done = true; | 828 | done = true; |
828 | } | 829 | } |
@@ -830,12 +831,12 @@ bool recording_screen(void) | |||
830 | 831 | ||
831 | invert_led(false); | 832 | invert_led(false); |
832 | 833 | ||
833 | if(mpeg_status() & MPEG_STATUS_ERROR) | 834 | if(audio_status() & AUDIO_STATUS_ERROR) |
834 | { | 835 | { |
835 | splash(0, true, str(LANG_DISK_FULL)); | 836 | splash(0, true, str(LANG_DISK_FULL)); |
836 | status_draw(true); | 837 | status_draw(true); |
837 | lcd_update(); | 838 | lcd_update(); |
838 | mpeg_error_clear(); | 839 | audio_error_clear(); |
839 | 840 | ||
840 | while(1) | 841 | while(1) |
841 | { | 842 | { |
@@ -845,7 +846,7 @@ bool recording_screen(void) | |||
845 | } | 846 | } |
846 | } | 847 | } |
847 | 848 | ||
848 | mpeg_init_playback(); | 849 | audio_init_playback(); |
849 | 850 | ||
850 | /* make sure the trigger is really turned off */ | 851 | /* make sure the trigger is really turned off */ |
851 | peak_meter_trigger(false); | 852 | peak_meter_trigger(false); |