summaryrefslogtreecommitdiff
path: root/apps/wps.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/wps.c')
-rw-r--r--apps/wps.c74
1 files changed, 73 insertions, 1 deletions
diff --git a/apps/wps.c b/apps/wps.c
index 6302626004..bf0283015f 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -51,6 +51,7 @@
51#include "misc.h" 51#include "misc.h"
52#include "sound.h" 52#include "sound.h"
53#include "onplay.h" 53#include "onplay.h"
54#include "abrepeat.h"
54 55
55#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ 56#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
56 /* 3% of 30min file == 54s step size */ 57 /* 3% of 30min file == 54s step size */
@@ -347,6 +348,11 @@ long wps_show(void)
347 lcd_setmargins(0, 0); 348 lcd_setmargins(0, 0);
348#endif 349#endif
349 350
351#ifdef AB_REPEAT_ENABLE
352 ab_repeat_init();
353 ab_reset_markers();
354#endif
355
350 ff_rewind = false; 356 ff_rewind = false;
351 357
352 if(audio_status() & AUDIO_STATUS_PLAY) 358 if(audio_status() & AUDIO_STATUS_PLAY)
@@ -585,6 +591,19 @@ long wps_show(void)
585 break; 591 break;
586#endif 592#endif
587#endif 593#endif
594
595#ifdef AB_REPEAT_ENABLE
596 /* if we're in A/B repeat mode and the current position
597 is past the A marker, jump back to the A marker... */
598 if ( ab_repeat_mode_enabled() && ab_after_A_marker(id3->elapsed) )
599 {
600 ab_jump_to_A_marker();
601 update_track = true;
602 break;
603 }
604 /* ...otherwise, do it normally */
605#endif
606
588 if (!id3 || (id3->elapsed < 3*1000)) { 607 if (!id3 || (id3->elapsed < 3*1000)) {
589 audio_prev(); 608 audio_prev();
590 } 609 }
@@ -612,6 +631,19 @@ long wps_show(void)
612 break; 631 break;
613#endif 632#endif
614#endif 633#endif
634
635#ifdef AB_REPEAT_ENABLE
636 /* if we're in A/B repeat mode and the current position is
637 before the A marker, jump to the A marker... */
638 if ( ab_repeat_mode_enabled() && ab_before_A_marker(id3->elapsed) )
639 {
640 ab_jump_to_A_marker();
641 update_track = true;
642 break;
643 }
644 /* ...otherwise, do it normally */
645#endif
646
615 audio_next(); 647 audio_next();
616 break; 648 break;
617 649
@@ -674,7 +706,8 @@ long wps_show(void)
674 706
675 /* pitch screen */ 707 /* pitch screen */
676#if CONFIG_KEYPAD == RECORDER_PAD 708#if CONFIG_KEYPAD == RECORDER_PAD
677 case BUTTON_ON | BUTTON_REPEAT: 709 case BUTTON_ON | BUTTON_UP:
710 case BUTTON_ON | BUTTON_DOWN:
678 if (2 == pitch_screen()) 711 if (2 == pitch_screen())
679 return SYS_USB_CONNECTED; 712 return SYS_USB_CONNECTED;
680 restore = true; 713 restore = true;
@@ -682,6 +715,41 @@ long wps_show(void)
682#endif 715#endif
683#endif 716#endif
684 717
718#ifdef AB_REPEAT_ENABLE
719
720#ifdef WPS_AB_SET_A_MARKER
721 /* set A marker for A-B repeat */
722 case WPS_AB_SET_A_MARKER:
723 if (ab_repeat_mode_enabled())
724 ab_set_A_marker(id3->elapsed);
725 break;
726#endif
727
728#ifdef WPS_AB_SET_B_MARKER
729 /* set B marker for A-B repeat and jump to A */
730 case WPS_AB_SET_B_MARKER:
731 if (ab_repeat_mode_enabled())
732 {
733 ab_set_B_marker(id3->elapsed);
734 ab_jump_to_A_marker();
735 update_track = true;
736 }
737 break;
738#endif
739
740#ifdef WPS_AB_RESET_AB_MARKERS
741 /* reset A&B markers */
742 case WPS_AB_RESET_AB_MARKERS:
743 if (ab_repeat_mode_enabled())
744 {
745 ab_reset_markers();
746 update_track = true;
747 }
748 break;
749#endif
750
751#endif /* AB_REPEAT_ENABLE */
752
685 /* stop and exit wps */ 753 /* stop and exit wps */
686#ifdef WPS_EXIT 754#ifdef WPS_EXIT
687 case WPS_EXIT: 755 case WPS_EXIT:
@@ -706,6 +774,7 @@ long wps_show(void)
706 default: 774 default:
707 if(default_event_handler(button) == SYS_USB_CONNECTED) 775 if(default_event_handler(button) == SYS_USB_CONNECTED)
708 return SYS_USB_CONNECTED; 776 return SYS_USB_CONNECTED;
777 update_track = true;
709 break; 778 break;
710 } 779 }
711 780
@@ -734,6 +803,9 @@ long wps_show(void)
734 lcd_stop_scroll(); 803 lcd_stop_scroll();
735 bookmark_autobookmark(); 804 bookmark_autobookmark();
736 audio_stop(); 805 audio_stop();
806#ifdef AB_REPEAT_ENABLE
807 ab_reset_markers();
808#endif
737 809
738 /* Keys can be locked when exiting, so either unlock here 810 /* Keys can be locked when exiting, so either unlock here
739 or implement key locking in tree.c too */ 811 or implement key locking in tree.c too */