diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-07-17 00:01:32 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-07-24 21:20:13 +0000 |
commit | 8cb555460ff79e636a7907fb2589e16db98c8600 (patch) | |
tree | 930a3878c7641c9ce045b24f0ade1309e36d5806 /apps/gui/wps.c | |
parent | 0c4f89370d05056faa789aa9cabcccc4e509fb9f (diff) | |
download | rockbox-8cb555460ff79e636a7907fb2589e16db98c8600.tar.gz rockbox-8cb555460ff79e636a7907fb2589e16db98c8600.zip |
[3/4] Completely remove HWCODEC support
'swcodec' is now always set (and recording_swcodec for recording-capable
units) in feature.txt so the manual and language strings don't need to
all be fixed up.
Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0
Diffstat (limited to 'apps/gui/wps.c')
-rw-r--r-- | apps/gui/wps.c | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index b417f82922..82321ff945 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include "filetypes.h" | 33 | #include "filetypes.h" |
34 | #include "settings.h" | 34 | #include "settings.h" |
35 | #include "skin_engine/skin_engine.h" | 35 | #include "skin_engine/skin_engine.h" |
36 | #include "mp3_playback.h" | ||
37 | #include "audio.h" | 36 | #include "audio.h" |
38 | #include "usb.h" | 37 | #include "usb.h" |
39 | #include "status.h" | 38 | #include "status.h" |
@@ -124,26 +123,17 @@ static void update_non_static(void) | |||
124 | 123 | ||
125 | void pause_action(bool may_fade, bool updatewps) | 124 | void pause_action(bool may_fade, bool updatewps) |
126 | { | 125 | { |
127 | #if CONFIG_CODEC == SWCODEC | ||
128 | /* Do audio first, then update, unless skin were to use its local | 126 | /* Do audio first, then update, unless skin were to use its local |
129 | status in which case, reverse it */ | 127 | status in which case, reverse it */ |
130 | audio_pause(); | 128 | audio_pause(); |
131 | 129 | ||
132 | if (updatewps) | 130 | if (updatewps) |
133 | update_non_static(); | 131 | update_non_static(); |
134 | #else | ||
135 | if (may_fade && global_settings.fade_on_stop) | ||
136 | fade(false, updatewps); | ||
137 | else | ||
138 | audio_pause(); | ||
139 | #endif | ||
140 | 132 | ||
141 | if (global_settings.pause_rewind) { | 133 | if (global_settings.pause_rewind) { |
142 | long newpos; | 134 | long newpos; |
143 | 135 | ||
144 | #if (CONFIG_CODEC == SWCODEC) | ||
145 | audio_pre_ff_rewind(); | 136 | audio_pre_ff_rewind(); |
146 | #endif | ||
147 | newpos = audio_current_track()->elapsed | 137 | newpos = audio_current_track()->elapsed |
148 | - global_settings.pause_rewind * 1000; | 138 | - global_settings.pause_rewind * 1000; |
149 | audio_ff_rewind(newpos > 0 ? newpos : 0); | 139 | audio_ff_rewind(newpos > 0 ? newpos : 0); |
@@ -154,80 +144,16 @@ void pause_action(bool may_fade, bool updatewps) | |||
154 | 144 | ||
155 | void unpause_action(bool may_fade, bool updatewps) | 145 | void unpause_action(bool may_fade, bool updatewps) |
156 | { | 146 | { |
157 | #if CONFIG_CODEC == SWCODEC | ||
158 | /* Do audio first, then update, unless skin were to use its local | 147 | /* Do audio first, then update, unless skin were to use its local |
159 | status in which case, reverse it */ | 148 | status in which case, reverse it */ |
160 | audio_resume(); | 149 | audio_resume(); |
161 | 150 | ||
162 | if (updatewps) | 151 | if (updatewps) |
163 | update_non_static(); | 152 | update_non_static(); |
164 | #else | ||
165 | if (may_fade && global_settings.fade_on_stop) | ||
166 | fade(true, updatewps); | ||
167 | else | ||
168 | audio_resume(); | ||
169 | #endif | ||
170 | 153 | ||
171 | (void)may_fade; | 154 | (void)may_fade; |
172 | } | 155 | } |
173 | 156 | ||
174 | #if CONFIG_CODEC != SWCODEC | ||
175 | void fade(bool fade_in, bool updatewps) | ||
176 | { | ||
177 | int fp_global_vol = global_settings.volume << 8; | ||
178 | int fp_min_vol = sound_min(SOUND_VOLUME) << 8; | ||
179 | int fp_step = (fp_global_vol - fp_min_vol) / 10; | ||
180 | |||
181 | skin_get_global_state()->is_fading = !fade_in; | ||
182 | if (fade_in) { | ||
183 | /* fade in */ | ||
184 | int fp_volume = fp_min_vol; | ||
185 | |||
186 | /* zero out the sound */ | ||
187 | sound_set_volume(fp_min_vol >> 8); | ||
188 | |||
189 | sleep(HZ/10); /* let audio thread run */ | ||
190 | audio_resume(); | ||
191 | |||
192 | if (updatewps) | ||
193 | update_non_static(); | ||
194 | |||
195 | while (fp_volume < fp_global_vol - fp_step) { | ||
196 | fp_volume += fp_step; | ||
197 | sound_set_volume(fp_volume >> 8); | ||
198 | sleep(1); | ||
199 | } | ||
200 | sound_set_volume(global_settings.volume); | ||
201 | } | ||
202 | else { | ||
203 | /* fade out */ | ||
204 | int fp_volume = fp_global_vol; | ||
205 | |||
206 | if (updatewps) | ||
207 | update_non_static(); | ||
208 | |||
209 | while (fp_volume > fp_min_vol + fp_step) { | ||
210 | fp_volume -= fp_step; | ||
211 | sound_set_volume(fp_volume >> 8); | ||
212 | sleep(1); | ||
213 | } | ||
214 | audio_pause(); | ||
215 | |||
216 | skin_get_global_state()->is_fading = false; | ||
217 | #if CONFIG_CODEC != SWCODEC | ||
218 | #ifndef SIMULATOR | ||
219 | /* let audio thread run and wait for the mas to run out of data */ | ||
220 | while (!mp3_pause_done()) | ||
221 | #endif | ||
222 | sleep(HZ/10); | ||
223 | #endif | ||
224 | |||
225 | /* reset volume to what it was before the fade */ | ||
226 | sound_set_volume(global_settings.volume); | ||
227 | } | ||
228 | } | ||
229 | #endif /* SWCODEC */ | ||
230 | |||
231 | static bool update_onvol_change(enum screen_type screen) | 157 | static bool update_onvol_change(enum screen_type screen) |
232 | { | 158 | { |
233 | skin_update(WPS, screen, SKIN_REFRESH_NON_STATIC); | 159 | skin_update(WPS, screen, SKIN_REFRESH_NON_STATIC); |
@@ -264,17 +190,8 @@ static int skintouch_to_wps(struct wps_data *data) | |||
264 | #endif | 190 | #endif |
265 | case ACTION_TOUCH_SCROLLBAR: | 191 | case ACTION_TOUCH_SCROLLBAR: |
266 | skin_get_global_state()->id3->elapsed = skin_get_global_state()->id3->length*offset/100; | 192 | skin_get_global_state()->id3->elapsed = skin_get_global_state()->id3->length*offset/100; |
267 | #if (CONFIG_CODEC == SWCODEC) | ||
268 | audio_pre_ff_rewind(); | 193 | audio_pre_ff_rewind(); |
269 | #else | ||
270 | if (!skin_get_global_state()->paused) | ||
271 | audio_pause(); | ||
272 | #endif | ||
273 | audio_ff_rewind(skin_get_global_state()->id3->elapsed); | 194 | audio_ff_rewind(skin_get_global_state()->id3->elapsed); |
274 | #if (CONFIG_CODEC != SWCODEC) | ||
275 | if (!skin_get_global_state()->paused) | ||
276 | audio_resume(); | ||
277 | #endif | ||
278 | return ACTION_TOUCHSCREEN; | 195 | return ACTION_TOUCHSCREEN; |
279 | case ACTION_TOUCH_VOLUME: | 196 | case ACTION_TOUCH_VOLUME: |
280 | { | 197 | { |
@@ -344,12 +261,7 @@ bool ffwd_rew(int button) | |||
344 | if ( (audio_status() & AUDIO_STATUS_PLAY) && | 261 | if ( (audio_status() & AUDIO_STATUS_PLAY) && |
345 | skin_get_global_state()->id3 && skin_get_global_state()->id3->length ) | 262 | skin_get_global_state()->id3 && skin_get_global_state()->id3->length ) |
346 | { | 263 | { |
347 | #if (CONFIG_CODEC == SWCODEC) | ||
348 | audio_pre_ff_rewind(); | 264 | audio_pre_ff_rewind(); |
349 | #else | ||
350 | if (!skin_get_global_state()->paused) | ||
351 | audio_pause(); | ||
352 | #endif | ||
353 | if (direction > 0) | 265 | if (direction > 0) |
354 | status_set_ffmode(STATUS_FASTFORWARD); | 266 | status_set_ffmode(STATUS_FASTFORWARD); |
355 | else | 267 | else |
@@ -393,10 +305,6 @@ bool ffwd_rew(int button) | |||
393 | skin_get_global_state()->ff_rewind_count = 0; | 305 | skin_get_global_state()->ff_rewind_count = 0; |
394 | skin_get_global_state()->ff_rewind = false; | 306 | skin_get_global_state()->ff_rewind = false; |
395 | status_set_ffmode(0); | 307 | status_set_ffmode(0); |
396 | #if (CONFIG_CODEC != SWCODEC) | ||
397 | if (!skin_get_global_state()->paused) | ||
398 | audio_resume(); | ||
399 | #endif | ||
400 | exit = true; | 308 | exit = true; |
401 | break; | 309 | break; |
402 | 310 | ||
@@ -495,19 +403,8 @@ static void prev_track(unsigned long skip_thresh) | |||
495 | return; | 403 | return; |
496 | } | 404 | } |
497 | 405 | ||
498 | #if (CONFIG_CODEC == SWCODEC) | ||
499 | audio_pre_ff_rewind(); | 406 | audio_pre_ff_rewind(); |
500 | #else | ||
501 | if (!state->paused) | ||
502 | audio_pause(); | ||
503 | #endif | ||
504 | |||
505 | audio_ff_rewind(0); | 407 | audio_ff_rewind(0); |
506 | |||
507 | #if (CONFIG_CODEC != SWCODEC) | ||
508 | if (!state->paused) | ||
509 | audio_resume(); | ||
510 | #endif | ||
511 | } | 408 | } |
512 | } | 409 | } |
513 | 410 | ||
@@ -573,9 +470,7 @@ static void play_hop(int direction) | |||
573 | } | 470 | } |
574 | else if (direction == 1 && step >= remaining) | 471 | else if (direction == 1 && step >= remaining) |
575 | { | 472 | { |
576 | #if CONFIG_CODEC == SWCODEC | ||
577 | system_sound_play(SOUND_TRACK_NO_MORE); | 473 | system_sound_play(SOUND_TRACK_NO_MORE); |
578 | #endif | ||
579 | return; | 474 | return; |
580 | } | 475 | } |
581 | else if (direction == -1 && elapsed < step) | 476 | else if (direction == -1 && elapsed < step) |
@@ -588,21 +483,10 @@ static void play_hop(int direction) | |||
588 | } | 483 | } |
589 | if(audio_status() & AUDIO_STATUS_PLAY) | 484 | if(audio_status() & AUDIO_STATUS_PLAY) |
590 | { | 485 | { |
591 | #if (CONFIG_CODEC == SWCODEC) | ||
592 | audio_pre_ff_rewind(); | 486 | audio_pre_ff_rewind(); |
593 | #else | ||
594 | if (!state->paused) | ||
595 | audio_pause(); | ||
596 | #endif | ||
597 | } | 487 | } |
598 | 488 | ||
599 | #if (CONFIG_CODEC == SWCODEC) | ||
600 | audio_ff_rewind(elapsed); | 489 | audio_ff_rewind(elapsed); |
601 | #else | ||
602 | audio_ff_rewind(state->id3->elapsed = elapsed); | ||
603 | if (!state->paused) | ||
604 | audio_resume(); | ||
605 | #endif | ||
606 | } | 490 | } |
607 | 491 | ||
608 | 492 | ||
@@ -867,12 +751,7 @@ long gui_wps_show(void) | |||
867 | { | 751 | { |
868 | if (state->id3->cuesheet) | 752 | if (state->id3->cuesheet) |
869 | { | 753 | { |
870 | #if (CONFIG_CODEC == SWCODEC) | ||
871 | audio_pre_ff_rewind(); | 754 | audio_pre_ff_rewind(); |
872 | #else | ||
873 | if (!state->paused) | ||
874 | audio_pause(); | ||
875 | #endif | ||
876 | audio_ff_rewind(0); | 755 | audio_ff_rewind(0); |
877 | } | 756 | } |
878 | else | 757 | else |
@@ -1128,13 +1007,8 @@ long gui_wps_show(void) | |||
1128 | } | 1007 | } |
1129 | 1008 | ||
1130 | if (exit) { | 1009 | if (exit) { |
1131 | #if CONFIG_CODEC != SWCODEC | ||
1132 | if (global_settings.fade_on_stop) | ||
1133 | fade(false, true); | ||
1134 | #else | ||
1135 | audio_pause(); | 1010 | audio_pause(); |
1136 | update_non_static(); | 1011 | update_non_static(); |
1137 | #endif | ||
1138 | if (bookmark) | 1012 | if (bookmark) |
1139 | bookmark_autobookmark(true); | 1013 | bookmark_autobookmark(true); |
1140 | audio_stop(); | 1014 | audio_stop(); |
@@ -1200,11 +1074,9 @@ static void wps_state_init(void) | |||
1200 | /* add the WPS track event callbacks */ | 1074 | /* add the WPS track event callbacks */ |
1201 | add_event(PLAYBACK_EVENT_TRACK_CHANGE, track_info_callback); | 1075 | add_event(PLAYBACK_EVENT_TRACK_CHANGE, track_info_callback); |
1202 | add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, track_info_callback); | 1076 | add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, track_info_callback); |
1203 | #if CONFIG_CODEC == SWCODEC | ||
1204 | /* Use the same callback as ..._TRACK_CHANGE for when remaining handles have | 1077 | /* Use the same callback as ..._TRACK_CHANGE for when remaining handles have |
1205 | finished */ | 1078 | finished */ |
1206 | add_event(PLAYBACK_EVENT_CUR_TRACK_READY, track_info_callback); | 1079 | add_event(PLAYBACK_EVENT_CUR_TRACK_READY, track_info_callback); |
1207 | #endif | ||
1208 | #ifdef AUDIO_FAST_SKIP_PREVIEW | 1080 | #ifdef AUDIO_FAST_SKIP_PREVIEW |
1209 | add_event(PLAYBACK_EVENT_TRACK_SKIP, track_info_callback); | 1081 | add_event(PLAYBACK_EVENT_TRACK_SKIP, track_info_callback); |
1210 | #endif | 1082 | #endif |