diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/abrepeat.c | 108 | ||||
-rw-r--r-- | apps/abrepeat.h | 80 | ||||
-rw-r--r-- | apps/bookmark.c | 2 | ||||
-rw-r--r-- | apps/gui/gwps-common.c | 5 | ||||
-rw-r--r-- | apps/gui/gwps.c | 55 | ||||
-rw-r--r-- | apps/gui/gwps.h | 6 | ||||
-rw-r--r-- | apps/gui/quickscreen.c | 1 | ||||
-rw-r--r-- | apps/gui/statusbar.c | 4 | ||||
-rw-r--r-- | apps/gui/yesno.c | 1 | ||||
-rw-r--r-- | apps/playback.c | 9 | ||||
-rw-r--r-- | apps/playlist.c | 4 | ||||
-rw-r--r-- | apps/screens.c | 3 | ||||
-rw-r--r-- | apps/settings.h | 3 | ||||
-rw-r--r-- | apps/settings_menu.c | 2 |
14 files changed, 192 insertions, 91 deletions
diff --git a/apps/abrepeat.c b/apps/abrepeat.c index 3a3d5b394d..b83a7b6aa3 100644 --- a/apps/abrepeat.c +++ b/apps/abrepeat.c | |||
@@ -19,16 +19,20 @@ | |||
19 | 19 | ||
20 | #include "abrepeat.h" | 20 | #include "abrepeat.h" |
21 | 21 | ||
22 | #include "settings.h" | ||
23 | #include "audio.h" | ||
24 | #include "kernel.h" | ||
25 | |||
26 | #ifdef HAVE_LCD_BITMAP | ||
27 | #include "lcd.h" | ||
28 | #endif | ||
29 | |||
30 | #ifdef AB_REPEAT_ENABLE | 22 | #ifdef AB_REPEAT_ENABLE |
31 | 23 | ||
24 | unsigned int ab_A_marker IDATA_ATTR = AB_MARKER_NONE; | ||
25 | unsigned int ab_B_marker IDATA_ATTR = AB_MARKER_NONE; | ||
26 | |||
27 | #if (CONFIG_CODEC == SWCODEC) | ||
28 | void ab_end_of_track_report(void) | ||
29 | { | ||
30 | if ( ab_A_marker_set() && ! ab_B_marker_set() ) | ||
31 | { | ||
32 | ab_jump_to_A_marker(); | ||
33 | } | ||
34 | } | ||
35 | #else | ||
32 | static int ab_audio_event_handler(unsigned short event, unsigned long data) | 36 | static int ab_audio_event_handler(unsigned short event, unsigned long data) |
33 | { | 37 | { |
34 | int rc = AUDIO_EVENT_RC_IGNORED; | 38 | int rc = AUDIO_EVENT_RC_IGNORED; |
@@ -38,7 +42,8 @@ static int ab_audio_event_handler(unsigned short event, unsigned long data) | |||
38 | { | 42 | { |
39 | case AUDIO_EVENT_POS_REPORT: | 43 | case AUDIO_EVENT_POS_REPORT: |
40 | { | 44 | { |
41 | if ( ! (audio_status() & AUDIO_STATUS_PAUSE) && ab_reached_B_marker(data) ) | 45 | if ( ! (audio_status() & AUDIO_STATUS_PAUSE) && |
46 | ab_reached_B_marker(data) ) | ||
42 | { | 47 | { |
43 | ab_jump_to_A_marker(); | 48 | ab_jump_to_A_marker(); |
44 | rc = AUDIO_EVENT_RC_HANDLED; | 49 | rc = AUDIO_EVENT_RC_HANDLED; |
@@ -58,6 +63,7 @@ static int ab_audio_event_handler(unsigned short event, unsigned long data) | |||
58 | } | 63 | } |
59 | return rc; | 64 | return rc; |
60 | } | 65 | } |
66 | #endif | ||
61 | 67 | ||
62 | void ab_repeat_init(void) | 68 | void ab_repeat_init(void) |
63 | { | 69 | { |
@@ -65,30 +71,13 @@ void ab_repeat_init(void) | |||
65 | if ( ! ab_initialized ) | 71 | if ( ! ab_initialized ) |
66 | { | 72 | { |
67 | ab_initialized = true; | 73 | ab_initialized = true; |
74 | #if (CONFIG_CODEC != SWCODEC) | ||
68 | audio_register_event_handler(ab_audio_event_handler, | 75 | audio_register_event_handler(ab_audio_event_handler, |
69 | AUDIO_EVENT_POS_REPORT | AUDIO_EVENT_END_OF_TRACK ); | 76 | AUDIO_EVENT_POS_REPORT | AUDIO_EVENT_END_OF_TRACK ); |
77 | #endif | ||
70 | } | 78 | } |
71 | } | 79 | } |
72 | 80 | ||
73 | static unsigned int ab_A_marker = AB_MARKER_NONE; | ||
74 | static unsigned int ab_B_marker = AB_MARKER_NONE; | ||
75 | |||
76 | bool ab_repeat_mode_enabled(void) | ||
77 | { | ||
78 | extern struct user_settings global_settings; | ||
79 | return global_settings.repeat_mode == REPEAT_AB; | ||
80 | } | ||
81 | |||
82 | bool ab_A_marker_set(void) | ||
83 | { | ||
84 | return ab_A_marker != AB_MARKER_NONE; | ||
85 | } | ||
86 | |||
87 | bool ab_B_marker_set(void) | ||
88 | { | ||
89 | return ab_B_marker != AB_MARKER_NONE; | ||
90 | } | ||
91 | |||
92 | unsigned int ab_get_A_marker(void) | 81 | unsigned int ab_get_A_marker(void) |
93 | { | 82 | { |
94 | return ab_A_marker; | 83 | return ab_A_marker; |
@@ -99,24 +88,6 @@ unsigned int ab_get_B_marker(void) | |||
99 | return ab_B_marker; | 88 | return ab_B_marker; |
100 | } | 89 | } |
101 | 90 | ||
102 | bool ab_reached_B_marker(unsigned int song_position) | ||
103 | { | ||
104 | /* following is the size of the window in which we'll detect that the B marker | ||
105 | was hit; it must be larger than the frequency (in milliseconds) at which this | ||
106 | function is called otherwise detection of the B marker will be unreliable; | ||
107 | we assume that this function will be called on each system tick and derive | ||
108 | the window size from this with a generous margin of error (note: the number | ||
109 | of ticks per second is given by HZ) */ | ||
110 | #define B_MARKER_DETECT_WINDOW ((1000/HZ)*10) | ||
111 | if (ab_B_marker != AB_MARKER_NONE) | ||
112 | { | ||
113 | if ( (song_position >= ab_B_marker) | ||
114 | && (song_position <= (ab_B_marker+B_MARKER_DETECT_WINDOW)) ) | ||
115 | return true; | ||
116 | } | ||
117 | return false; | ||
118 | } | ||
119 | |||
120 | /* determines if the given song position is earlier than the A mark; | 91 | /* determines if the given song position is earlier than the A mark; |
121 | intended for use in handling the jump NEXT and PREV commands */ | 92 | intended for use in handling the jump NEXT and PREV commands */ |
122 | bool ab_before_A_marker(unsigned int song_position) | 93 | bool ab_before_A_marker(unsigned int song_position) |
@@ -129,9 +100,9 @@ bool ab_before_A_marker(unsigned int song_position) | |||
129 | intended for use in handling the jump PREV command */ | 100 | intended for use in handling the jump PREV command */ |
130 | bool ab_after_A_marker(unsigned int song_position) | 101 | bool ab_after_A_marker(unsigned int song_position) |
131 | { | 102 | { |
132 | /* following is the size of the virtual A marker; we pretend that the A marker is | 103 | /* following is the size of the virtual A marker; we pretend that the A marker |
133 | larger than a single instant in order to give the user time to hit PREV again to | 104 | is larger than a single instant in order to give the user time to hit PREV again |
134 | jump back to the start of the song; it should be large enough to allow a | 105 | to jump back to the start of the song; it should be large enough to allow a |
135 | reasonable amount of time for the typical user to react */ | 106 | reasonable amount of time for the typical user to react */ |
136 | #define A_MARKER_VIRTUAL_SIZE 1000 | 107 | #define A_MARKER_VIRTUAL_SIZE 1000 |
137 | return (ab_A_marker != AB_MARKER_NONE) | 108 | return (ab_A_marker != AB_MARKER_NONE) |
@@ -140,12 +111,16 @@ reasonable amount of time for the typical user to react */ | |||
140 | 111 | ||
141 | void ab_jump_to_A_marker(void) | 112 | void ab_jump_to_A_marker(void) |
142 | { | 113 | { |
114 | #if (CONFIG_CODEC == SWCODEC) | ||
115 | audio_seamless_seek(ab_A_marker); | ||
116 | #else | ||
143 | bool paused = (audio_status() & AUDIO_STATUS_PAUSE) != 0; | 117 | bool paused = (audio_status() & AUDIO_STATUS_PAUSE) != 0; |
144 | if ( ! paused ) | 118 | if ( ! paused ) |
145 | audio_pause(); | 119 | audio_pause(); |
146 | audio_ff_rewind(ab_A_marker); | 120 | audio_ff_rewind(ab_A_marker); |
147 | if ( ! paused ) | 121 | if ( ! paused ) |
148 | audio_resume(); | 122 | audio_resume(); |
123 | #endif | ||
149 | } | 124 | } |
150 | 125 | ||
151 | void ab_reset_markers(void) | 126 | void ab_reset_markers(void) |
@@ -182,37 +157,42 @@ void ab_set_B_marker(unsigned int song_position) | |||
182 | 157 | ||
183 | #ifdef HAVE_LCD_BITMAP | 158 | #ifdef HAVE_LCD_BITMAP |
184 | 159 | ||
185 | static int ab_calc_mark_x_pos(int mark, int capacity, int offset, int size) | 160 | static inline int ab_calc_mark_x_pos(int mark, int capacity, |
161 | int offset, int size) | ||
186 | { | 162 | { |
187 | int w = size - offset; | 163 | int w = size - offset; |
188 | return offset + ( (w * mark) / capacity ); | 164 | return offset + ( (w * mark) / capacity ); |
189 | } | 165 | } |
190 | 166 | ||
191 | static void ab_draw_veritcal_line_mark(int x, int y, int h) | 167 | static inline void ab_draw_veritcal_line_mark(struct screen * screen, |
168 | int x, int y, int h) | ||
192 | { | 169 | { |
193 | lcd_set_drawmode(DRMODE_COMPLEMENT); | 170 | screen->set_drawmode(DRMODE_COMPLEMENT); |
194 | lcd_vline(x, y, y+h-1); | 171 | screen->vline(x, y, y+h-1); |
195 | } | 172 | } |
196 | 173 | ||
197 | #define DIRECTION_RIGHT 1 | 174 | #define DIRECTION_RIGHT 1 |
198 | #define DIRECTION_LEFT -1 | 175 | #define DIRECTION_LEFT -1 |
199 | 176 | ||
200 | static void ab_draw_arrow_mark(int x, int y, int h, int direction) | 177 | static inline void ab_draw_arrow_mark(struct screen * screen, |
178 | int x, int y, int h, int direction) | ||
201 | { | 179 | { |
202 | /* draw lines in decreasing size until a height of zero is reached */ | 180 | /* draw lines in decreasing size until a height of zero is reached */ |
203 | lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 181 | screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
204 | while( h > 0 ) | 182 | while( h > 0 ) |
205 | { | 183 | { |
206 | lcd_vline(x, y, y+h-1); | 184 | screen->vline(x, y, y+h-1); |
207 | h -= 2; | 185 | h -= 2; |
208 | y++; | 186 | y++; |
209 | x += direction; | 187 | x += direction; |
210 | lcd_set_drawmode(DRMODE_COMPLEMENT); | 188 | screen->set_drawmode(DRMODE_COMPLEMENT); |
211 | } | 189 | } |
212 | } | 190 | } |
213 | 191 | ||
214 | void ab_draw_markers(int capacity, int x, int y, int w, int h) | 192 | void ab_draw_markers(struct screen * screen, int capacity, |
193 | int x, int y, int h) | ||
215 | { | 194 | { |
195 | int w = screen->width; | ||
216 | /* if both markers are set, determine if they're far enough apart | 196 | /* if both markers are set, determine if they're far enough apart |
217 | to draw arrows */ | 197 | to draw arrows */ |
218 | if ( ab_A_marker_set() && ab_B_marker_set() ) | 198 | if ( ab_A_marker_set() && ab_B_marker_set() ) |
@@ -222,13 +202,13 @@ void ab_draw_markers(int capacity, int x, int y, int w, int h) | |||
222 | int arrow_width = (h+1) / 2; | 202 | int arrow_width = (h+1) / 2; |
223 | if ( (xb-xa) < (arrow_width*2) ) | 203 | if ( (xb-xa) < (arrow_width*2) ) |
224 | { | 204 | { |
225 | ab_draw_veritcal_line_mark(xa, y, h); | 205 | ab_draw_veritcal_line_mark(screen, xa, y, h); |
226 | ab_draw_veritcal_line_mark(xb, y, h); | 206 | ab_draw_veritcal_line_mark(screen, xb, y, h); |
227 | } | 207 | } |
228 | else | 208 | else |
229 | { | 209 | { |
230 | ab_draw_arrow_mark(xa, y, h, DIRECTION_RIGHT); | 210 | ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT); |
231 | ab_draw_arrow_mark(xb, y, h, DIRECTION_LEFT); | 211 | ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT); |
232 | } | 212 | } |
233 | } | 213 | } |
234 | else | 214 | else |
@@ -236,12 +216,12 @@ void ab_draw_markers(int capacity, int x, int y, int w, int h) | |||
236 | if (ab_A_marker_set()) | 216 | if (ab_A_marker_set()) |
237 | { | 217 | { |
238 | int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x, w); | 218 | int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x, w); |
239 | ab_draw_arrow_mark(xa, y, h, DIRECTION_RIGHT); | 219 | ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT); |
240 | } | 220 | } |
241 | if (ab_B_marker_set()) | 221 | if (ab_B_marker_set()) |
242 | { | 222 | { |
243 | int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x, w); | 223 | int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x, w); |
244 | ab_draw_arrow_mark(xb, y, h, DIRECTION_LEFT); | 224 | ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT); |
245 | } | 225 | } |
246 | } | 226 | } |
247 | } | 227 | } |
diff --git a/apps/abrepeat.h b/apps/abrepeat.h index 113a1f5ee6..143e57b371 100644 --- a/apps/abrepeat.h +++ b/apps/abrepeat.h | |||
@@ -20,27 +20,95 @@ | |||
20 | #define _ABREPEAT_H_ | 20 | #define _ABREPEAT_H_ |
21 | 21 | ||
22 | #include "system.h" | 22 | #include "system.h" |
23 | #include <stdbool.h> | ||
24 | 23 | ||
25 | #ifdef AB_REPEAT_ENABLE | 24 | #ifdef AB_REPEAT_ENABLE |
25 | #include "audio.h" | ||
26 | #include "kernel.h" | ||
27 | #include <stdbool.h> | ||
26 | 28 | ||
27 | #define AB_MARKER_NONE 0 | 29 | #define AB_MARKER_NONE 0 |
28 | 30 | ||
31 | #if (AB_REPEAT_ENABLE == 1) | ||
32 | #include "settings.h" | ||
33 | #endif | ||
34 | |||
29 | void ab_repeat_init(void); | 35 | void ab_repeat_init(void); |
30 | bool ab_repeat_mode_enabled(void); // test if a/b repeat is enabled | ||
31 | bool ab_A_marker_set(void); | ||
32 | bool ab_B_marker_set(void); | ||
33 | unsigned int ab_get_A_marker(void); | 36 | unsigned int ab_get_A_marker(void); |
34 | unsigned int ab_get_B_marker(void); | 37 | unsigned int ab_get_B_marker(void); |
35 | bool ab_reached_B_marker(unsigned int song_position); | ||
36 | bool ab_before_A_marker(unsigned int song_position); | 38 | bool ab_before_A_marker(unsigned int song_position); |
37 | bool ab_after_A_marker(unsigned int song_position); | 39 | bool ab_after_A_marker(unsigned int song_position); |
38 | void ab_jump_to_A_marker(void); | 40 | void ab_jump_to_A_marker(void); |
39 | void ab_reset_markers(void); | 41 | void ab_reset_markers(void); |
40 | void ab_set_A_marker(unsigned int song_position); | 42 | void ab_set_A_marker(unsigned int song_position); |
41 | void ab_set_B_marker(unsigned int song_position); | 43 | void ab_set_B_marker(unsigned int song_position); |
44 | #if (CONFIG_CODEC == SWCODEC) | ||
45 | void ab_end_of_track_report(void); | ||
46 | #endif | ||
42 | #ifdef HAVE_LCD_BITMAP | 47 | #ifdef HAVE_LCD_BITMAP |
43 | void ab_draw_markers(int capacity, int x, int y, int w, int h); | 48 | #include "screen_access.h" |
49 | void ab_draw_markers(struct screen * screen, int capacity, | ||
50 | int x, int y, int h); | ||
51 | #endif | ||
52 | |||
53 | /* These functions really need to be inlined for speed */ | ||
54 | extern unsigned int ab_A_marker; | ||
55 | extern unsigned int ab_B_marker; | ||
56 | |||
57 | static inline bool ab_A_marker_set(void) | ||
58 | { | ||
59 | return ab_A_marker != AB_MARKER_NONE; | ||
60 | } | ||
61 | |||
62 | static inline bool ab_B_marker_set(void) | ||
63 | { | ||
64 | return ab_B_marker != AB_MARKER_NONE; | ||
65 | } | ||
66 | |||
67 | static inline bool ab_repeat_mode_enabled(void) | ||
68 | { | ||
69 | #if (AB_REPEAT_ENABLE == 2) | ||
70 | return ab_A_marker_set() || ab_B_marker_set(); | ||
71 | #else | ||
72 | return global_settings.repeat_mode == REPEAT_AB; | ||
73 | #endif | ||
74 | } | ||
75 | |||
76 | static inline bool ab_reached_B_marker(unsigned int song_position) | ||
77 | { | ||
78 | /* following is the size of the window in which we'll detect that the B marker | ||
79 | was hit; it must be larger than the frequency (in milliseconds) at which this | ||
80 | function is called otherwise detection of the B marker will be unreliable */ | ||
81 | #if (CONFIG_CODEC == SWCODEC) | ||
82 | /* On swcodec, the worst case seems to be 9600kHz with 1024 samples between | ||
83 | * calls, meaning ~9 calls per second, look within 1/5 of a second */ | ||
84 | #define B_MARKER_DETECT_WINDOW 200 | ||
85 | #else | ||
86 | /* we assume that this function will be called on each system tick and derive | ||
87 | the window size from this with a generous margin of error (note: the number | ||
88 | of ticks per second is given by HZ) */ | ||
89 | #define B_MARKER_DETECT_WINDOW ((1000/HZ)*10) | ||
90 | #endif | ||
91 | if (ab_B_marker != AB_MARKER_NONE) | ||
92 | { | ||
93 | if ( (song_position >= ab_B_marker) | ||
94 | && (song_position <= (ab_B_marker+B_MARKER_DETECT_WINDOW)) ) | ||
95 | return true; | ||
96 | } | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | #if (CONFIG_CODEC == SWCODEC) | ||
101 | static inline void ab_position_report(unsigned long position) | ||
102 | { | ||
103 | if (ab_repeat_mode_enabled()) | ||
104 | { | ||
105 | if ( !(audio_status() & AUDIO_STATUS_PAUSE) && | ||
106 | ab_reached_B_marker(position) ) | ||
107 | { | ||
108 | ab_jump_to_A_marker(); | ||
109 | } | ||
110 | } | ||
111 | } | ||
44 | #endif | 112 | #endif |
45 | 113 | ||
46 | #endif | 114 | #endif |
diff --git a/apps/bookmark.c b/apps/bookmark.c index 2eb4fc9d02..c8c6f941f2 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c | |||
@@ -739,7 +739,7 @@ static void display_bookmark(const char* bookmark, | |||
739 | /* bookmark shuffle and repeat states*/ | 739 | /* bookmark shuffle and repeat states*/ |
740 | switch (repeat_mode) | 740 | switch (repeat_mode) |
741 | { | 741 | { |
742 | #ifdef AB_REPEAT_ENABLE | 742 | #if (AB_REPEAT_ENABLE == 1) |
743 | case REPEAT_AB: | 743 | case REPEAT_AB: |
744 | statusbar_icon_play_mode(Icon_RepeatAB); | 744 | statusbar_icon_play_mode(Icon_RepeatAB); |
745 | break; | 745 | break; |
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index b9b3e9bcd0..31b4de239f 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #ifdef HAVE_LCD_CHARCELLS | 31 | #ifdef HAVE_LCD_CHARCELLS |
32 | #include "hwcompat.h" | 32 | #include "hwcompat.h" |
33 | #endif | 33 | #endif |
34 | #include "abrepeat.h" | ||
34 | #include "mp3_playback.h" | 35 | #include "mp3_playback.h" |
35 | #include "backlight.h" | 36 | #include "backlight.h" |
36 | #include "lang.h" | 37 | #include "lang.h" |
@@ -1431,8 +1432,8 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, | |||
1431 | HORIZONTAL); | 1432 | HORIZONTAL); |
1432 | #ifdef AB_REPEAT_ENABLE | 1433 | #ifdef AB_REPEAT_ENABLE |
1433 | if ( ab_repeat_mode_enabled() ) | 1434 | if ( ab_repeat_mode_enabled() ) |
1434 | ab_draw_markers(state->id3->length, 0, sby, LCD_WIDTH, | 1435 | ab_draw_markers(display, state->id3->length, 0, sby, |
1435 | PROGRESS_BAR_HEIGHT); | 1436 | PROGRESS_BAR_HEIGHT); |
1436 | #endif | 1437 | #endif |
1437 | update_line = true; | 1438 | update_line = true; |
1438 | } | 1439 | } |
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index efe207f94a..f75dd80d0f 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c | |||
@@ -392,11 +392,17 @@ long gui_wps_show(void) | |||
392 | #ifdef AB_REPEAT_ENABLE | 392 | #ifdef AB_REPEAT_ENABLE |
393 | /* if we're in A/B repeat mode and the current position | 393 | /* if we're in A/B repeat mode and the current position |
394 | is past the A marker, jump back to the A marker... */ | 394 | is past the A marker, jump back to the A marker... */ |
395 | if ( ab_repeat_mode_enabled() | 395 | if ( ab_repeat_mode_enabled() ) |
396 | && ab_after_A_marker(wps_state.id3->elapsed) ) | ||
397 | { | 396 | { |
398 | ab_jump_to_A_marker(); | 397 | if ( ab_after_A_marker(wps_state.id3->elapsed) ) |
399 | break; | 398 | { |
399 | ab_jump_to_A_marker(); | ||
400 | break; | ||
401 | #if (AB_REPEAT_ENABLE == 2) | ||
402 | } else { | ||
403 | ab_reset_markers(); | ||
404 | #endif | ||
405 | } | ||
400 | } | 406 | } |
401 | /* ...otherwise, do it normally */ | 407 | /* ...otherwise, do it normally */ |
402 | #endif | 408 | #endif |
@@ -451,11 +457,17 @@ long gui_wps_show(void) | |||
451 | #ifdef AB_REPEAT_ENABLE | 457 | #ifdef AB_REPEAT_ENABLE |
452 | /* if we're in A/B repeat mode and the current position is | 458 | /* if we're in A/B repeat mode and the current position is |
453 | before the A marker, jump to the A marker... */ | 459 | before the A marker, jump to the A marker... */ |
454 | if ( ab_repeat_mode_enabled() | 460 | if ( ab_repeat_mode_enabled() ) |
455 | && ab_before_A_marker(wps_state.id3->elapsed) ) | ||
456 | { | 461 | { |
457 | ab_jump_to_A_marker(); | 462 | if ( ab_before_A_marker(wps_state.id3->elapsed) ) |
458 | break; | 463 | { |
464 | ab_jump_to_A_marker(); | ||
465 | break; | ||
466 | #if (AB_REPEAT_ENABLE == 2) | ||
467 | } else { | ||
468 | ab_reset_markers(); | ||
469 | #endif | ||
470 | } | ||
459 | } | 471 | } |
460 | /* ...otherwise, do it normally */ | 472 | /* ...otherwise, do it normally */ |
461 | #endif | 473 | #endif |
@@ -545,6 +557,33 @@ long gui_wps_show(void) | |||
545 | 557 | ||
546 | #ifdef AB_REPEAT_ENABLE | 558 | #ifdef AB_REPEAT_ENABLE |
547 | 559 | ||
560 | #ifdef WPS_AB_SINGLE | ||
561 | case WPS_AB_SINGLE: | ||
562 | #ifdef WPS_AB_SINGLE_PRE | ||
563 | if (lastbutton != WPS_AB_SINGLE_PRE) | ||
564 | break; | ||
565 | #endif | ||
566 | /* If we are using the menu option to enable ab_repeat mode, don't do anything | ||
567 | * when it's disabled */ | ||
568 | #if (AB_REPEAT_ENABLE == 1) | ||
569 | if (!ab_repeat_mode_enabled()) | ||
570 | break; | ||
571 | #endif | ||
572 | if (ab_A_marker_set()) { | ||
573 | update_track = true; | ||
574 | if (ab_B_marker_set()) { | ||
575 | ab_reset_markers(); | ||
576 | break; | ||
577 | } | ||
578 | ab_set_B_marker(wps_state.id3->elapsed); | ||
579 | ab_jump_to_A_marker(); | ||
580 | break; | ||
581 | } | ||
582 | ab_set_A_marker(wps_state.id3->elapsed); | ||
583 | break; | ||
584 | #endif | ||
585 | |||
586 | |||
548 | #ifdef WPS_AB_SET_A_MARKER | 587 | #ifdef WPS_AB_SET_A_MARKER |
549 | /* set A marker for A-B repeat */ | 588 | /* set A marker for A-B repeat */ |
550 | case WPS_AB_SET_A_MARKER: | 589 | case WPS_AB_SET_A_MARKER: |
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index 1017181a21..e00f6288ef 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h | |||
@@ -68,6 +68,12 @@ | |||
68 | #define WPS_RC_CONTEXT (BUTTON_RC_MENU | BUTTON_REPEAT) | 68 | #define WPS_RC_CONTEXT (BUTTON_RC_MENU | BUTTON_REPEAT) |
69 | #define WPS_RC_QUICK (BUTTON_RC_MODE | BUTTON_REPEAT) | 69 | #define WPS_RC_QUICK (BUTTON_RC_MODE | BUTTON_REPEAT) |
70 | 70 | ||
71 | #ifdef AB_REPEAT_ENABLE | ||
72 | #define WPS_AB_SET_A_MARKER (BUTTON_ON | BUTTON_LEFT) | ||
73 | #define WPS_AB_SET_B_MARKER (BUTTON_ON | BUTTON_RIGHT) | ||
74 | #define WPS_AB_RESET_AB_MARKERS (BUTTON_ON | BUTTON_OFF) | ||
75 | #endif | ||
76 | |||
71 | #elif CONFIG_KEYPAD == RECORDER_PAD | 77 | #elif CONFIG_KEYPAD == RECORDER_PAD |
72 | #define WPS_NEXT (BUTTON_RIGHT | BUTTON_REL) | 78 | #define WPS_NEXT (BUTTON_RIGHT | BUTTON_REL) |
73 | #define WPS_NEXT_PRE BUTTON_RIGHT | 79 | #define WPS_NEXT_PRE BUTTON_RIGHT |
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 07d4e2eee6..6aac24f81e 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "quickscreen.h" | 20 | #include "quickscreen.h" |
21 | #ifdef HAS_QUICKSCREEN | 21 | #ifdef HAS_QUICKSCREEN |
22 | 22 | ||
23 | #include "system.h" | ||
23 | #include "icons.h" | 24 | #include "icons.h" |
24 | #include "textarea.h" | 25 | #include "textarea.h" |
25 | #include "font.h" | 26 | #include "font.h" |
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index d8e611af85..34ac5283af 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -247,11 +247,11 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
247 | Icon_Play); | 247 | Icon_Play); |
248 | 248 | ||
249 | switch (bar->info.repeat) { | 249 | switch (bar->info.repeat) { |
250 | #ifdef AB_REPEAT_ENABLE | 250 | #if (AB_REPEAT_ENABLE == 1) |
251 | case REPEAT_AB: | 251 | case REPEAT_AB: |
252 | gui_statusbar_icon_play_mode(display, Icon_RepeatAB); | 252 | gui_statusbar_icon_play_mode(display, Icon_RepeatAB); |
253 | break; | 253 | break; |
254 | #endif /* AB_REPEAT_ENABLE */ | 254 | #endif /* AB_REPEAT_ENABLE == 1 */ |
255 | 255 | ||
256 | case REPEAT_ONE: | 256 | case REPEAT_ONE: |
257 | gui_statusbar_icon_play_mode(display, Icon_RepeatOne); | 257 | gui_statusbar_icon_play_mode(display, Icon_RepeatOne); |
diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c index 3345a691ca..225f6d3f43 100644 --- a/apps/gui/yesno.c +++ b/apps/gui/yesno.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include "yesno.h" | 1 | #include "yesno.h" |
2 | #include "system.h" | ||
2 | #include "kernel.h" | 3 | #include "kernel.h" |
3 | #include "misc.h" | 4 | #include "misc.h" |
4 | #include "lang.h" | 5 | #include "lang.h" |
diff --git a/apps/playback.c b/apps/playback.c index 932bf115f9..0331405846 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include "pcm_record.h" | 49 | #include "pcm_record.h" |
50 | #include "buffer.h" | 50 | #include "buffer.h" |
51 | #include "dsp.h" | 51 | #include "dsp.h" |
52 | #include "abrepeat.h" | ||
52 | #ifdef HAVE_LCD_BITMAP | 53 | #ifdef HAVE_LCD_BITMAP |
53 | #include "icons.h" | 54 | #include "icons.h" |
54 | #include "peakmeter.h" | 55 | #include "peakmeter.h" |
@@ -418,6 +419,9 @@ void codec_set_elapsed_callback(unsigned int value) | |||
418 | if (ci.stop_codec || current_codec == CODEC_IDX_VOICE) | 419 | if (ci.stop_codec || current_codec == CODEC_IDX_VOICE) |
419 | return ; | 420 | return ; |
420 | 421 | ||
422 | #ifdef AB_REPEAT_ENABLE | ||
423 | ab_position_report(value); | ||
424 | #endif | ||
421 | latency = pcmbuf_get_latency(); | 425 | latency = pcmbuf_get_latency(); |
422 | 426 | ||
423 | if (value < latency) { | 427 | if (value < latency) { |
@@ -1663,7 +1667,10 @@ bool codec_request_next_track_callback(void) | |||
1663 | the core has been requested the codec to be terminated. */ | 1667 | the core has been requested the codec to be terminated. */ |
1664 | return !ci_voice.stop_codec && queue_empty(&voice_codec_queue); | 1668 | return !ci_voice.stop_codec && queue_empty(&voice_codec_queue); |
1665 | } | 1669 | } |
1666 | 1670 | #ifdef AB_REPEAT_ENABLE | |
1671 | ab_end_of_track_report(); | ||
1672 | #endif | ||
1673 | |||
1667 | pcmbuf_set_position_callback(pcmbuf_position_callback); | 1674 | pcmbuf_set_position_callback(pcmbuf_position_callback); |
1668 | 1675 | ||
1669 | if (ci.stop_codec || !playing) | 1676 | if (ci.stop_codec || !playing) |
diff --git a/apps/playlist.c b/apps/playlist.c index e8239b21f2..d760b2450d 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -994,7 +994,7 @@ static int get_next_index(const struct playlist_info* playlist, int steps, | |||
994 | } | 994 | } |
995 | 995 | ||
996 | case REPEAT_ONE: | 996 | case REPEAT_ONE: |
997 | #ifdef AB_REPEAT_ENABLE | 997 | #if (AB_REPEAT_ENABLE == 1) |
998 | case REPEAT_AB: | 998 | case REPEAT_AB: |
999 | #endif | 999 | #endif |
1000 | next_index = current_index; | 1000 | next_index = current_index; |
@@ -2205,7 +2205,7 @@ int playlist_next(int steps) | |||
2205 | int index; | 2205 | int index; |
2206 | 2206 | ||
2207 | if ( (steps > 0) | 2207 | if ( (steps > 0) |
2208 | #ifdef AB_REPEAT_ENABLE | 2208 | #if (AB_REPEAT_ENABLE == 1) |
2209 | && (global_settings.repeat_mode != REPEAT_AB) | 2209 | && (global_settings.repeat_mode != REPEAT_AB) |
2210 | #endif | 2210 | #endif |
2211 | && (global_settings.repeat_mode != REPEAT_ONE) ) | 2211 | && (global_settings.repeat_mode != REPEAT_ONE) ) |
diff --git a/apps/screens.c b/apps/screens.c index 2cb0fb576a..9897e2541d 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include "debug.h" | 46 | #include "debug.h" |
47 | #include "led.h" | 47 | #include "led.h" |
48 | #include "sound.h" | 48 | #include "sound.h" |
49 | #include "abrepeat.h" | ||
50 | #include "gwps-common.h" | 49 | #include "gwps-common.h" |
51 | #include "splash.h" | 50 | #include "splash.h" |
52 | #include "statusbar.h" | 51 | #include "statusbar.h" |
@@ -515,7 +514,7 @@ bool quick_screen_quick(int button_enter) | |||
515 | [REPEAT_ALL]={ STR(LANG_REPEAT_ALL) }, | 514 | [REPEAT_ALL]={ STR(LANG_REPEAT_ALL) }, |
516 | [REPEAT_ONE]={ STR(LANG_REPEAT_ONE) }, | 515 | [REPEAT_ONE]={ STR(LANG_REPEAT_ONE) }, |
517 | [REPEAT_SHUFFLE]={ STR(LANG_SHUFFLE) }, | 516 | [REPEAT_SHUFFLE]={ STR(LANG_SHUFFLE) }, |
518 | #ifdef AB_REPEAT_ENABLE | 517 | #if (AB_REPEAT_ENABLE == 1) |
519 | [REPEAT_AB]={ STR(LANG_REPEAT_AB) } | 518 | [REPEAT_AB]={ STR(LANG_REPEAT_AB) } |
520 | #endif | 519 | #endif |
521 | }; | 520 | }; |
diff --git a/apps/settings.h b/apps/settings.h index 4d7d4fb707..d60c39f6e0 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -25,7 +25,6 @@ | |||
25 | #include "file.h" | 25 | #include "file.h" |
26 | #include "dircache.h" | 26 | #include "dircache.h" |
27 | #include "timefuncs.h" | 27 | #include "timefuncs.h" |
28 | #include "abrepeat.h" | ||
29 | 28 | ||
30 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | 29 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS |
31 | #include "backlight.h" /* for [MIN|MAX]_BRIGHTNESS_SETTING */ | 30 | #include "backlight.h" /* for [MIN|MAX]_BRIGHTNESS_SETTING */ |
@@ -478,7 +477,7 @@ enum | |||
478 | REPEAT_ALL, | 477 | REPEAT_ALL, |
479 | REPEAT_ONE, | 478 | REPEAT_ONE, |
480 | REPEAT_SHUFFLE, | 479 | REPEAT_SHUFFLE, |
481 | #ifdef AB_REPEAT_ENABLE | 480 | #if (AB_REPEAT_ENABLE == 1) |
482 | REPEAT_AB, | 481 | REPEAT_AB, |
483 | #endif | 482 | #endif |
484 | NUM_REPEAT_MODES | 483 | NUM_REPEAT_MODES |
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 5338be34a3..35b4d8772d 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -580,7 +580,7 @@ static bool repeat_mode(void) | |||
580 | { STR(LANG_REPEAT_ALL) }, | 580 | { STR(LANG_REPEAT_ALL) }, |
581 | { STR(LANG_REPEAT_ONE) }, | 581 | { STR(LANG_REPEAT_ONE) }, |
582 | { STR(LANG_SHUFFLE) }, | 582 | { STR(LANG_SHUFFLE) }, |
583 | #ifdef AB_REPEAT_ENABLE | 583 | #if (AB_REPEAT_ENABLE == 1) |
584 | { STR(LANG_REPEAT_AB) } | 584 | { STR(LANG_REPEAT_AB) } |
585 | #endif | 585 | #endif |
586 | }; | 586 | }; |