summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/abrepeat.h33
-rw-r--r--apps/gui/wps.c25
-rw-r--r--apps/playback.c3
3 files changed, 39 insertions, 22 deletions
diff --git a/apps/abrepeat.h b/apps/abrepeat.h
index f7ee65247c..4d2c4ea001 100644
--- a/apps/abrepeat.h
+++ b/apps/abrepeat.h
@@ -20,9 +20,38 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21#ifndef _ABREPEAT_H_ 21#ifndef _ABREPEAT_H_
22#define _ABREPEAT_H_ 22#define _ABREPEAT_H_
23
24#ifdef AB_REPEAT_ENABLE
25#include <stdbool.h> 23#include <stdbool.h>
24
25#ifndef AB_REPEAT_ENABLE /* Dummy functions */
26static inline bool ab_repeat_mode_enabled(void)
27{
28 return false;
29}
30static inline bool ab_bool_dummy_marker(unsigned int song_position)
31{
32 (void) song_position;
33 return false;
34}
35static inline void ab_void_dummy_marker(unsigned int song_position)
36{
37 (void) song_position;
38}
39static inline void ab_dummy_voidfn(void){}
40
41#define ab_repeat_init ab_dummy_voidfn
42#define ab_before_A_marker ab_bool_dummy_marker
43#define ab_after_A_marker ab_bool_dummy_marker
44#define ab_jump_to_A_marker ab_dummy_voidfn
45#define ab_reset_markers ab_dummy_voidfn
46#define ab_set_A_marker ab_void_dummy_marker
47#define ab_set_B_marker ab_void_dummy_marker
48#define ab_get_A_marker ab_bool_dummy_marker
49#define ab_get_B_marker ab_bool_dummy_marker
50#define ab_end_of_track_report ab_dummy_voidfn
51#define ab_reached_B_marker ab_bool_dummy_marker
52#define ab_position_report ab_void_dummy_marker
53
54#else /*def AB_REPEAT_ENABLE*/
26#include "audio.h" 55#include "audio.h"
27#include "kernel.h" /* needed for HZ */ 56#include "kernel.h" /* needed for HZ */
28 57
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 8b74b0e02b..f8fd99930f 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -613,9 +613,9 @@ static long do_wps_exit(long action, bool bookmark)
613 if (bookmark) 613 if (bookmark)
614 bookmark_autobookmark(true); 614 bookmark_autobookmark(true);
615 audio_stop(); 615 audio_stop();
616#ifdef AB_REPEAT_ENABLE 616
617 ab_reset_markers(); 617 ab_reset_markers();
618#endif 618
619 gwps_leave_wps(true); 619 gwps_leave_wps(true);
620#ifdef HAVE_RECORDING 620#ifdef HAVE_RECORDING
621 if (action == ACTION_WPS_REC) 621 if (action == ACTION_WPS_REC)
@@ -678,10 +678,9 @@ long gui_wps_show(void)
678 long last_left = 0, last_right = 0; 678 long last_left = 0, last_right = 0;
679 struct wps_state *state = get_wps_state(); 679 struct wps_state *state = get_wps_state();
680 680
681#ifdef AB_REPEAT_ENABLE
682 ab_repeat_init(); 681 ab_repeat_init();
683 ab_reset_markers(); 682 ab_reset_markers();
684#endif 683
685 wps_state_init(); 684 wps_state_init();
686 while ( 1 ) 685 while ( 1 )
687 { 686 {
@@ -904,7 +903,7 @@ long gui_wps_show(void)
904 /* prev / restart */ 903 /* prev / restart */
905 case ACTION_WPS_SKIPPREV: 904 case ACTION_WPS_SKIPPREV:
906 last_left = current_tick; 905 last_left = current_tick;
907#ifdef AB_REPEAT_ENABLE 906
908 /* if we're in A/B repeat mode and the current position 907 /* if we're in A/B repeat mode and the current position
909 is past the A marker, jump back to the A marker... */ 908 is past the A marker, jump back to the A marker... */
910 if ( ab_repeat_mode_enabled() && ab_after_A_marker(state->id3->elapsed) ) 909 if ( ab_repeat_mode_enabled() && ab_after_A_marker(state->id3->elapsed) )
@@ -912,9 +911,7 @@ long gui_wps_show(void)
912 ab_jump_to_A_marker(); 911 ab_jump_to_A_marker();
913 break; 912 break;
914 } 913 }
915 else 914 else /* ...otherwise, do it normally */
916 /* ...otherwise, do it normally */
917#endif
918 play_hop(-1); 915 play_hop(-1);
919 break; 916 break;
920 917
@@ -922,7 +919,7 @@ long gui_wps_show(void)
922 OR if skip length set, hop by predetermined amount. */ 919 OR if skip length set, hop by predetermined amount. */
923 case ACTION_WPS_SKIPNEXT: 920 case ACTION_WPS_SKIPNEXT:
924 last_right = current_tick; 921 last_right = current_tick;
925#ifdef AB_REPEAT_ENABLE 922
926 /* if we're in A/B repeat mode and the current position is 923 /* if we're in A/B repeat mode and the current position is
927 before the A marker, jump to the A marker... */ 924 before the A marker, jump to the A marker... */
928 if ( ab_repeat_mode_enabled() ) 925 if ( ab_repeat_mode_enabled() )
@@ -933,32 +930,26 @@ long gui_wps_show(void)
933 break; 930 break;
934 } 931 }
935 } 932 }
936 else 933 else /* ...otherwise, do it normally */
937 /* ...otherwise, do it normally */
938#endif
939 play_hop(1); 934 play_hop(1);
940 break; 935 break;
941 /* next / prev directories */ 936 /* next / prev directories */
942 /* and set A-B markers if in a-b mode */ 937 /* and set A-B markers if in a-b mode */
943 case ACTION_WPS_ABSETB_NEXTDIR: 938 case ACTION_WPS_ABSETB_NEXTDIR:
944#if defined(AB_REPEAT_ENABLE)
945 if (ab_repeat_mode_enabled()) 939 if (ab_repeat_mode_enabled())
946 { 940 {
947 ab_set_B_marker(state->id3->elapsed); 941 ab_set_B_marker(state->id3->elapsed);
948 ab_jump_to_A_marker(); 942 ab_jump_to_A_marker();
949 } 943 }
950 else 944 else
951#endif
952 { 945 {
953 change_dir(1); 946 change_dir(1);
954 } 947 }
955 break; 948 break;
956 case ACTION_WPS_ABSETA_PREVDIR: 949 case ACTION_WPS_ABSETA_PREVDIR:
957#if defined(AB_REPEAT_ENABLE)
958 if (ab_repeat_mode_enabled()) 950 if (ab_repeat_mode_enabled())
959 ab_set_A_marker(state->id3->elapsed); 951 ab_set_A_marker(state->id3->elapsed);
960 else 952 else
961#endif
962 { 953 {
963 change_dir(-1); 954 change_dir(-1);
964 } 955 }
@@ -1010,7 +1001,6 @@ long gui_wps_show(void)
1010 break; 1001 break;
1011#endif /* HAVE_PITCHCONTROL */ 1002#endif /* HAVE_PITCHCONTROL */
1012 1003
1013#ifdef AB_REPEAT_ENABLE
1014 /* reset A&B markers */ 1004 /* reset A&B markers */
1015 case ACTION_WPS_ABRESET: 1005 case ACTION_WPS_ABRESET:
1016 if (ab_repeat_mode_enabled()) 1006 if (ab_repeat_mode_enabled())
@@ -1019,7 +1009,6 @@ long gui_wps_show(void)
1019 update = true; 1009 update = true;
1020 } 1010 }
1021 break; 1011 break;
1022#endif /* AB_REPEAT_ENABLE */
1023 1012
1024 /* stop and exit wps */ 1013 /* stop and exit wps */
1025 case ACTION_WPS_STOP: 1014 case ACTION_WPS_STOP:
diff --git a/apps/playback.c b/apps/playback.c
index 7eaa149f2c..c4d84145b2 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -3479,9 +3479,8 @@ static void buffer_event_finished_callback(unsigned short id, void *ev_data)
3479/* Update elapsed time for next PCM insert */ 3479/* Update elapsed time for next PCM insert */
3480void audio_codec_update_elapsed(unsigned long elapsed) 3480void audio_codec_update_elapsed(unsigned long elapsed)
3481{ 3481{
3482#ifdef AB_REPEAT_ENABLE
3483 ab_position_report(elapsed); 3482 ab_position_report(elapsed);
3484#endif 3483
3485 /* Save in codec's id3 where it is used at next pcm insert */ 3484 /* Save in codec's id3 where it is used at next pcm insert */
3486 id3_get(CODEC_ID3)->elapsed = elapsed; 3485 id3_get(CODEC_ID3)->elapsed = elapsed;
3487} 3486}