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 | |
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')
-rw-r--r-- | apps/gui/list.c | 9 | ||||
-rw-r--r-- | apps/gui/list.h | 2 | ||||
-rw-r--r-- | apps/gui/pitchscreen.c | 78 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 2 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 39 | ||||
-rw-r--r-- | apps/gui/splash.c | 2 | ||||
-rw-r--r-- | apps/gui/statusbar.c | 49 | ||||
-rw-r--r-- | apps/gui/wps.c | 128 |
8 files changed, 5 insertions, 304 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index ce444cc9c2..b1120aa794 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -317,10 +317,6 @@ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list, | |||
317 | 317 | ||
318 | static void edge_beep(struct gui_synclist * gui_list, bool wrap) | 318 | static void edge_beep(struct gui_synclist * gui_list, bool wrap) |
319 | { | 319 | { |
320 | #if CONFIG_CODEC != SWCODEC | ||
321 | (void)gui_list; | ||
322 | (void)wrap; | ||
323 | #else | ||
324 | if (global_settings.keyclick) | 320 | if (global_settings.keyclick) |
325 | { | 321 | { |
326 | list_speak_item *cb = gui_list->callback_speak_item; | 322 | list_speak_item *cb = gui_list->callback_speak_item; |
@@ -354,7 +350,6 @@ static void edge_beep(struct gui_synclist * gui_list, bool wrap) | |||
354 | talk_force_shutup(); | 350 | talk_force_shutup(); |
355 | } | 351 | } |
356 | } | 352 | } |
357 | #endif | ||
358 | } | 353 | } |
359 | 354 | ||
360 | static void _gui_synclist_speak_item(struct gui_synclist *lists) | 355 | static void _gui_synclist_speak_item(struct gui_synclist *lists) |
@@ -615,7 +610,6 @@ static void gui_synclist_scroll_left(struct gui_synclist * lists) | |||
615 | } | 610 | } |
616 | #endif /* HAVE_LCD_BITMAP */ | 611 | #endif /* HAVE_LCD_BITMAP */ |
617 | 612 | ||
618 | #if CONFIG_CODEC == SWCODEC | ||
619 | bool gui_synclist_keyclick_callback(int action, void* data) | 613 | bool gui_synclist_keyclick_callback(int action, void* data) |
620 | { | 614 | { |
621 | struct gui_synclist *lists = (struct gui_synclist *)data; | 615 | struct gui_synclist *lists = (struct gui_synclist *)data; |
@@ -633,7 +627,6 @@ bool gui_synclist_keyclick_callback(int action, void* data) | |||
633 | 627 | ||
634 | return action != ACTION_NONE; | 628 | return action != ACTION_NONE; |
635 | } | 629 | } |
636 | #endif | ||
637 | 630 | ||
638 | /* | 631 | /* |
639 | * Magic to make sure the list gets updated correctly if the skin does | 632 | * Magic to make sure the list gets updated correctly if the skin does |
@@ -864,9 +857,7 @@ bool list_do_action(int context, int timeout, | |||
864 | do_button, and places the action from get_action in *action. */ | 857 | do_button, and places the action from get_action in *action. */ |
865 | { | 858 | { |
866 | timeout = list_do_action_timeout(lists, timeout); | 859 | timeout = list_do_action_timeout(lists, timeout); |
867 | #if CONFIG_CODEC == SWCODEC | ||
868 | keyclick_set_callback(gui_synclist_keyclick_callback, lists); | 860 | keyclick_set_callback(gui_synclist_keyclick_callback, lists); |
869 | #endif | ||
870 | *action = get_action(context, timeout); | 861 | *action = get_action(context, timeout); |
871 | return gui_synclist_do_button(lists, action, wrap); | 862 | return gui_synclist_do_button(lists, action, wrap); |
872 | } | 863 | } |
diff --git a/apps/gui/list.h b/apps/gui/list.h index 1be9da496a..9107bf0591 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h | |||
@@ -170,9 +170,7 @@ extern void gui_synclist_hide_selection_marker(struct gui_synclist *lists, | |||
170 | extern bool gui_synclist_item_is_onscreen(struct gui_synclist *lists, | 170 | extern bool gui_synclist_item_is_onscreen(struct gui_synclist *lists, |
171 | enum screen_type screen, int item); | 171 | enum screen_type screen, int item); |
172 | 172 | ||
173 | #if CONFIG_CODEC == SWCODEC | ||
174 | extern bool gui_synclist_keyclick_callback(int action, void* data); | 173 | extern bool gui_synclist_keyclick_callback(int action, void* data); |
175 | #endif | ||
176 | /* | 174 | /* |
177 | * Do the action implied by the given button, | 175 | * Do the action implied by the given button, |
178 | * returns true if the action was handled. | 176 | * returns true if the action was handled. |
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index bf016fdd5f..0d31193fa6 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c | |||
@@ -38,9 +38,7 @@ | |||
38 | #include "misc.h" | 38 | #include "misc.h" |
39 | #include "pitchscreen.h" | 39 | #include "pitchscreen.h" |
40 | #include "settings.h" | 40 | #include "settings.h" |
41 | #if CONFIG_CODEC == SWCODEC | ||
42 | #include "tdspeed.h" | 41 | #include "tdspeed.h" |
43 | #endif | ||
44 | 42 | ||
45 | #define ICON_BORDER 12 /* icons are currently 7x8, so add ~2 pixels */ | 43 | #define ICON_BORDER 12 /* icons are currently 7x8, so add ~2 pixels */ |
46 | /* on both sides when drawing */ | 44 | /* on both sides when drawing */ |
@@ -167,13 +165,9 @@ static bool at_limit = false; | |||
167 | 165 | ||
168 | static void speak_pitch_mode(bool enqueue) | 166 | static void speak_pitch_mode(bool enqueue) |
169 | { | 167 | { |
170 | #if CONFIG_CODEC == SWCODEC | ||
171 | bool timestretch_mode = global_settings.pitch_mode_timestretch && dsp_timestretch_available(); | 168 | bool timestretch_mode = global_settings.pitch_mode_timestretch && dsp_timestretch_available(); |
172 | if (timestretch_mode) | 169 | if (timestretch_mode) |
173 | talk_id(VOICE_PITCH_TIMESTRETCH_MODE, enqueue); | 170 | talk_id(VOICE_PITCH_TIMESTRETCH_MODE, enqueue); |
174 | #else | ||
175 | #define timestretch_mode 0 | ||
176 | #endif | ||
177 | if (global_settings.pitch_mode_semitone) | 171 | if (global_settings.pitch_mode_semitone) |
178 | talk_id(VOICE_PITCH_SEMITONE_MODE, timestretch_mode ? true : enqueue); | 172 | talk_id(VOICE_PITCH_SEMITONE_MODE, timestretch_mode ? true : enqueue); |
179 | else | 173 | else |
@@ -238,9 +232,7 @@ static void pitchscreen_draw_icons(struct screen *display, | |||
238 | static void pitchscreen_draw(struct screen *display, int max_lines, | 232 | static void pitchscreen_draw(struct screen *display, int max_lines, |
239 | struct viewport pitch_viewports[PITCH_ITEM_COUNT], | 233 | struct viewport pitch_viewports[PITCH_ITEM_COUNT], |
240 | int32_t pitch, int32_t semitone | 234 | int32_t pitch, int32_t semitone |
241 | #if CONFIG_CODEC == SWCODEC | ||
242 | ,int32_t speed | 235 | ,int32_t speed |
243 | #endif | ||
244 | ) | 236 | ) |
245 | { | 237 | { |
246 | const char* ptr; | 238 | const char* ptr; |
@@ -308,7 +300,6 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
308 | /* Middle section upper line - hide for a small screen */ | 300 | /* Middle section upper line - hide for a small screen */ |
309 | if ((show_lang_pitch = (max_lines >= 3))) | 301 | if ((show_lang_pitch = (max_lines >= 3))) |
310 | { | 302 | { |
311 | #if CONFIG_CODEC == SWCODEC | ||
312 | if(global_settings.pitch_mode_timestretch) | 303 | if(global_settings.pitch_mode_timestretch) |
313 | { | 304 | { |
314 | /* Pitch:XXX.X% */ | 305 | /* Pitch:XXX.X% */ |
@@ -330,7 +321,6 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
330 | } | 321 | } |
331 | } | 322 | } |
332 | else | 323 | else |
333 | #endif | ||
334 | { | 324 | { |
335 | /* Rate */ | 325 | /* Rate */ |
336 | snprintf(buf, sizeof(buf), "%s:", str(LANG_PLAYBACK_RATE)); | 326 | snprintf(buf, sizeof(buf), "%s:", str(LANG_PLAYBACK_RATE)); |
@@ -344,7 +334,6 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
344 | 334 | ||
345 | /* Middle section lower line */ | 335 | /* Middle section lower line */ |
346 | /* "Speed:XXX%" */ | 336 | /* "Speed:XXX%" */ |
347 | #if CONFIG_CODEC == SWCODEC | ||
348 | if(global_settings.pitch_mode_timestretch) | 337 | if(global_settings.pitch_mode_timestretch) |
349 | { | 338 | { |
350 | snprintf(buf, sizeof(buf), "%s: %ld.%ld%%", str(LANG_SPEED), | 339 | snprintf(buf, sizeof(buf), "%s: %ld.%ld%%", str(LANG_SPEED), |
@@ -352,7 +341,6 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
352 | (speed % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); | 341 | (speed % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); |
353 | } | 342 | } |
354 | else | 343 | else |
355 | #endif | ||
356 | { | 344 | { |
357 | if(global_settings.pitch_mode_semitone) | 345 | if(global_settings.pitch_mode_semitone) |
358 | { | 346 | { |
@@ -396,13 +384,11 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
396 | /* Middle section left/right labels */ | 384 | /* Middle section left/right labels */ |
397 | const char *leftlabel = "-2%"; | 385 | const char *leftlabel = "-2%"; |
398 | const char *rightlabel = "+2%"; | 386 | const char *rightlabel = "+2%"; |
399 | #if CONFIG_CODEC == SWCODEC | ||
400 | if (global_settings.pitch_mode_timestretch) | 387 | if (global_settings.pitch_mode_timestretch) |
401 | { | 388 | { |
402 | leftlabel = "<<"; | 389 | leftlabel = "<<"; |
403 | rightlabel = ">>"; | 390 | rightlabel = ">>"; |
404 | } | 391 | } |
405 | #endif | ||
406 | 392 | ||
407 | /* Only display if they fit */ | 393 | /* Only display if they fit */ |
408 | display->getstringsize(leftlabel, &w, &h); | 394 | display->getstringsize(leftlabel, &w, &h); |
@@ -423,16 +409,12 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
423 | } | 409 | } |
424 | 410 | ||
425 | static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cutoff | 411 | static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cutoff |
426 | #if CONFIG_CODEC == SWCODEC | ||
427 | /* need this to maintain correct pitch/speed caps */ | 412 | /* need this to maintain correct pitch/speed caps */ |
428 | , int32_t speed | 413 | , int32_t speed |
429 | #endif | ||
430 | ) | 414 | ) |
431 | { | 415 | { |
432 | int32_t new_pitch; | 416 | int32_t new_pitch; |
433 | #if CONFIG_CODEC == SWCODEC | ||
434 | int32_t new_stretch; | 417 | int32_t new_stretch; |
435 | #endif | ||
436 | at_limit = false; | 418 | at_limit = false; |
437 | 419 | ||
438 | if (pitch_delta < 0) | 420 | if (pitch_delta < 0) |
@@ -480,7 +462,6 @@ static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cut | |||
480 | /* pitch_delta == 0 -> no real change */ | 462 | /* pitch_delta == 0 -> no real change */ |
481 | return pitch; | 463 | return pitch; |
482 | } | 464 | } |
483 | #if CONFIG_CODEC == SWCODEC | ||
484 | if (dsp_timestretch_available()) | 465 | if (dsp_timestretch_available()) |
485 | { | 466 | { |
486 | /* increase the multiple to increase precision of this calculation */ | 467 | /* increase the multiple to increase precision of this calculation */ |
@@ -504,7 +485,6 @@ static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cut | |||
504 | at_limit = true; | 485 | at_limit = true; |
505 | } | 486 | } |
506 | } | 487 | } |
507 | #endif | ||
508 | 488 | ||
509 | sound_set_pitch(new_pitch); | 489 | sound_set_pitch(new_pitch); |
510 | 490 | ||
@@ -579,9 +559,7 @@ static int32_t get_pitch_from_semitone(int32_t semitone) | |||
579 | static int32_t pitch_increase_semitone(int32_t pitch, | 559 | static int32_t pitch_increase_semitone(int32_t pitch, |
580 | int32_t current_semitone, | 560 | int32_t current_semitone, |
581 | int32_t semitone_delta | 561 | int32_t semitone_delta |
582 | #if CONFIG_CODEC == SWCODEC | ||
583 | , int32_t speed | 562 | , int32_t speed |
584 | #endif | ||
585 | ) | 563 | ) |
586 | { | 564 | { |
587 | int32_t new_semitone = current_semitone; | 565 | int32_t new_semitone = current_semitone; |
@@ -613,7 +591,6 @@ static int32_t pitch_increase_semitone(int32_t pitch, | |||
613 | 591 | ||
614 | int32_t new_pitch = get_pitch_from_semitone(new_semitone); | 592 | int32_t new_pitch = get_pitch_from_semitone(new_semitone); |
615 | 593 | ||
616 | #if CONFIG_CODEC == SWCODEC | ||
617 | int32_t new_stretch = GET_STRETCH(new_pitch, speed); | 594 | int32_t new_stretch = GET_STRETCH(new_pitch, speed); |
618 | 595 | ||
619 | /* clamp the pitch so it doesn't go beyond the stretch limits */ | 596 | /* clamp the pitch so it doesn't go beyond the stretch limits */ |
@@ -629,12 +606,9 @@ static int32_t pitch_increase_semitone(int32_t pitch, | |||
629 | new_semitone = get_semitone_from_pitch(new_pitch); | 606 | new_semitone = get_semitone_from_pitch(new_pitch); |
630 | at_limit = true; | 607 | at_limit = true; |
631 | } | 608 | } |
632 | #endif | ||
633 | 609 | ||
634 | pitch_increase(pitch, new_pitch - pitch, false | 610 | pitch_increase(pitch, new_pitch - pitch, false |
635 | #if CONFIG_CODEC == SWCODEC | ||
636 | , speed | 611 | , speed |
637 | #endif | ||
638 | ); | 612 | ); |
639 | 613 | ||
640 | return new_semitone; | 614 | return new_semitone; |
@@ -765,7 +739,6 @@ int gui_syncpitchscreen_run(void) | |||
765 | 739 | ||
766 | push_current_activity(ACTIVITY_PITCHSCREEN); | 740 | push_current_activity(ACTIVITY_PITCHSCREEN); |
767 | 741 | ||
768 | #if CONFIG_CODEC == SWCODEC | ||
769 | int32_t new_speed = 0, new_stretch; | 742 | int32_t new_speed = 0, new_stretch; |
770 | 743 | ||
771 | /* the speed variable holds the apparent speed of the playback */ | 744 | /* the speed variable holds the apparent speed of the playback */ |
@@ -785,7 +758,6 @@ int gui_syncpitchscreen_run(void) | |||
785 | global_settings.pitch_mode_timestretch = false; | 758 | global_settings.pitch_mode_timestretch = false; |
786 | settings_save(); | 759 | settings_save(); |
787 | } | 760 | } |
788 | #endif | ||
789 | 761 | ||
790 | /* Count decimals for speaking */ | 762 | /* Count decimals for speaking */ |
791 | for (i = PITCH_SPEED_PRECISION; i >= 10; i /= 10) | 763 | for (i = PITCH_SPEED_PRECISION; i >= 10; i /= 10) |
@@ -806,23 +778,17 @@ int gui_syncpitchscreen_run(void) | |||
806 | /* also, draw the icons now, it's only needed once */ | 778 | /* also, draw the icons now, it's only needed once */ |
807 | pitchscreen_draw_icons(&screens[i], &parent[i]); | 779 | pitchscreen_draw_icons(&screens[i], &parent[i]); |
808 | } | 780 | } |
809 | #if CONFIG_CODEC == SWCODEC | ||
810 | pcmbuf_set_low_latency(true); | 781 | pcmbuf_set_low_latency(true); |
811 | #endif | ||
812 | 782 | ||
813 | while (!exit) | 783 | while (!exit) |
814 | { | 784 | { |
815 | FOR_NB_SCREENS(i) | 785 | FOR_NB_SCREENS(i) |
816 | pitchscreen_draw(&screens[i], max_lines[i], | 786 | pitchscreen_draw(&screens[i], max_lines[i], |
817 | pitch_viewports[i], pitch, semitone | 787 | pitch_viewports[i], pitch, semitone |
818 | #if CONFIG_CODEC == SWCODEC | ||
819 | , speed | 788 | , speed |
820 | #endif | ||
821 | ); | 789 | ); |
822 | pitch_delta = 0; | 790 | pitch_delta = 0; |
823 | #if CONFIG_CODEC == SWCODEC | ||
824 | new_speed = 0; | 791 | new_speed = 0; |
825 | #endif | ||
826 | 792 | ||
827 | if (global_settings.talk_menu && updated) | 793 | if (global_settings.talk_menu && updated) |
828 | { | 794 | { |
@@ -835,29 +801,23 @@ int gui_syncpitchscreen_run(void) | |||
835 | else | 801 | else |
836 | talk_value_decimal(pitch, UNIT_PERCENT, decimals, false); | 802 | talk_value_decimal(pitch, UNIT_PERCENT, decimals, false); |
837 | break; | 803 | break; |
838 | #if CONFIG_CODEC == SWCODEC | ||
839 | case 2: | 804 | case 2: |
840 | talk_value_decimal(speed, UNIT_PERCENT, decimals, false); | 805 | talk_value_decimal(speed, UNIT_PERCENT, decimals, false); |
841 | break; | 806 | break; |
842 | #endif | ||
843 | case 3: | 807 | case 3: |
844 | speak_pitch_mode(false); | 808 | speak_pitch_mode(false); |
845 | break; | 809 | break; |
846 | case 4: | 810 | case 4: |
847 | #if CONFIG_CODEC == SWCODEC | ||
848 | if (global_settings.pitch_mode_timestretch && dsp_timestretch_available()) | 811 | if (global_settings.pitch_mode_timestretch && dsp_timestretch_available()) |
849 | talk_id(LANG_PITCH, false); | 812 | talk_id(LANG_PITCH, false); |
850 | else | 813 | else |
851 | #endif | ||
852 | talk_id(LANG_PLAYBACK_RATE, false); | 814 | talk_id(LANG_PLAYBACK_RATE, false); |
853 | talk_value_decimal(pitch, UNIT_PERCENT, decimals, true); | 815 | talk_value_decimal(pitch, UNIT_PERCENT, decimals, true); |
854 | #if CONFIG_CODEC == SWCODEC | ||
855 | if (global_settings.pitch_mode_timestretch && dsp_timestretch_available()) | 816 | if (global_settings.pitch_mode_timestretch && dsp_timestretch_available()) |
856 | { | 817 | { |
857 | talk_id(LANG_SPEED, true); | 818 | talk_id(LANG_SPEED, true); |
858 | talk_value_decimal(speed, UNIT_PERCENT, decimals, true); | 819 | talk_value_decimal(speed, UNIT_PERCENT, decimals, true); |
859 | } | 820 | } |
860 | #endif | ||
861 | speak_pitch_mode(true); | 821 | speak_pitch_mode(true); |
862 | break; | 822 | break; |
863 | default: | 823 | default: |
@@ -910,24 +870,17 @@ int gui_syncpitchscreen_run(void) | |||
910 | break; | 870 | break; |
911 | 871 | ||
912 | case ACTION_PS_NUDGE_RIGHT: | 872 | case ACTION_PS_NUDGE_RIGHT: |
913 | #if CONFIG_CODEC == SWCODEC | ||
914 | if (!global_settings.pitch_mode_timestretch) | 873 | if (!global_settings.pitch_mode_timestretch) |
915 | { | 874 | { |
916 | #endif | ||
917 | new_pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false | 875 | new_pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false |
918 | #if CONFIG_CODEC == SWCODEC | ||
919 | , speed | 876 | , speed |
920 | #endif | ||
921 | ); | 877 | ); |
922 | nudged = (new_pitch != pitch); | 878 | nudged = (new_pitch != pitch); |
923 | pitch = new_pitch; | 879 | pitch = new_pitch; |
924 | semitone = get_semitone_from_pitch(pitch); | 880 | semitone = get_semitone_from_pitch(pitch); |
925 | #if CONFIG_CODEC == SWCODEC | ||
926 | speed = pitch; | 881 | speed = pitch; |
927 | #endif | ||
928 | updated = nudged ? 1 : 0; | 882 | updated = nudged ? 1 : 0; |
929 | break; | 883 | break; |
930 | #if CONFIG_CODEC == SWCODEC | ||
931 | } | 884 | } |
932 | else | 885 | else |
933 | { | 886 | { |
@@ -948,19 +901,14 @@ int gui_syncpitchscreen_run(void) | |||
948 | updated = 2; | 901 | updated = 2; |
949 | } | 902 | } |
950 | break; | 903 | break; |
951 | #endif | ||
952 | 904 | ||
953 | case ACTION_PS_NUDGE_RIGHTOFF: | 905 | case ACTION_PS_NUDGE_RIGHTOFF: |
954 | if (nudged) | 906 | if (nudged) |
955 | { | 907 | { |
956 | pitch = pitch_increase(pitch, -PITCH_NUDGE_DELTA, false | 908 | pitch = pitch_increase(pitch, -PITCH_NUDGE_DELTA, false |
957 | #if CONFIG_CODEC == SWCODEC | ||
958 | , speed | 909 | , speed |
959 | #endif | ||
960 | ); | 910 | ); |
961 | #if CONFIG_CODEC == SWCODEC | ||
962 | speed = pitch; | 911 | speed = pitch; |
963 | #endif | ||
964 | semitone = get_semitone_from_pitch(pitch); | 912 | semitone = get_semitone_from_pitch(pitch); |
965 | nudged = false; | 913 | nudged = false; |
966 | updated = 1; | 914 | updated = 1; |
@@ -968,24 +916,17 @@ int gui_syncpitchscreen_run(void) | |||
968 | break; | 916 | break; |
969 | 917 | ||
970 | case ACTION_PS_NUDGE_LEFT: | 918 | case ACTION_PS_NUDGE_LEFT: |
971 | #if CONFIG_CODEC == SWCODEC | ||
972 | if (!global_settings.pitch_mode_timestretch) | 919 | if (!global_settings.pitch_mode_timestretch) |
973 | { | 920 | { |
974 | #endif | ||
975 | new_pitch = pitch_increase(pitch, -PITCH_NUDGE_DELTA, false | 921 | new_pitch = pitch_increase(pitch, -PITCH_NUDGE_DELTA, false |
976 | #if CONFIG_CODEC == SWCODEC | ||
977 | , speed | 922 | , speed |
978 | #endif | ||
979 | ); | 923 | ); |
980 | nudged = (new_pitch != pitch); | 924 | nudged = (new_pitch != pitch); |
981 | pitch = new_pitch; | 925 | pitch = new_pitch; |
982 | semitone = get_semitone_from_pitch(pitch); | 926 | semitone = get_semitone_from_pitch(pitch); |
983 | #if CONFIG_CODEC == SWCODEC | ||
984 | speed = pitch; | 927 | speed = pitch; |
985 | #endif | ||
986 | updated = nudged ? 1 : 0; | 928 | updated = nudged ? 1 : 0; |
987 | break; | 929 | break; |
988 | #if CONFIG_CODEC == SWCODEC | ||
989 | } | 930 | } |
990 | else | 931 | else |
991 | { | 932 | { |
@@ -1006,19 +947,14 @@ int gui_syncpitchscreen_run(void) | |||
1006 | updated = 2; | 947 | updated = 2; |
1007 | } | 948 | } |
1008 | break; | 949 | break; |
1009 | #endif | ||
1010 | 950 | ||
1011 | case ACTION_PS_NUDGE_LEFTOFF: | 951 | case ACTION_PS_NUDGE_LEFTOFF: |
1012 | if (nudged) | 952 | if (nudged) |
1013 | { | 953 | { |
1014 | pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false | 954 | pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false |
1015 | #if CONFIG_CODEC == SWCODEC | ||
1016 | , speed | 955 | , speed |
1017 | #endif | ||
1018 | ); | 956 | ); |
1019 | #if CONFIG_CODEC == SWCODEC | ||
1020 | speed = pitch; | 957 | speed = pitch; |
1021 | #endif | ||
1022 | semitone = get_semitone_from_pitch(pitch); | 958 | semitone = get_semitone_from_pitch(pitch); |
1023 | nudged = false; | 959 | nudged = false; |
1024 | updated = 1; | 960 | updated = 1; |
@@ -1028,21 +964,18 @@ int gui_syncpitchscreen_run(void) | |||
1028 | case ACTION_PS_RESET: | 964 | case ACTION_PS_RESET: |
1029 | pitch = PITCH_SPEED_100; | 965 | pitch = PITCH_SPEED_100; |
1030 | sound_set_pitch(pitch); | 966 | sound_set_pitch(pitch); |
1031 | #if CONFIG_CODEC == SWCODEC | ||
1032 | speed = PITCH_SPEED_100; | 967 | speed = PITCH_SPEED_100; |
1033 | if (dsp_timestretch_available()) | 968 | if (dsp_timestretch_available()) |
1034 | { | 969 | { |
1035 | dsp_set_timestretch(PITCH_SPEED_100); | 970 | dsp_set_timestretch(PITCH_SPEED_100); |
1036 | at_limit = false; | 971 | at_limit = false; |
1037 | } | 972 | } |
1038 | #endif | ||
1039 | semitone = get_semitone_from_pitch(pitch); | 973 | semitone = get_semitone_from_pitch(pitch); |
1040 | updated = 4; | 974 | updated = 4; |
1041 | break; | 975 | break; |
1042 | 976 | ||
1043 | case ACTION_PS_TOGGLE_MODE: | 977 | case ACTION_PS_TOGGLE_MODE: |
1044 | global_settings.pitch_mode_semitone = !global_settings.pitch_mode_semitone; | 978 | global_settings.pitch_mode_semitone = !global_settings.pitch_mode_semitone; |
1045 | #if CONFIG_CODEC == SWCODEC | ||
1046 | 979 | ||
1047 | if (dsp_timestretch_available() && !global_settings.pitch_mode_semitone) | 980 | if (dsp_timestretch_available() && !global_settings.pitch_mode_semitone) |
1048 | { | 981 | { |
@@ -1055,7 +988,6 @@ int gui_syncpitchscreen_run(void) | |||
1055 | } | 988 | } |
1056 | } | 989 | } |
1057 | settings_save(); | 990 | settings_save(); |
1058 | #endif | ||
1059 | updated = 3; | 991 | updated = 3; |
1060 | break; | 992 | break; |
1061 | 993 | ||
@@ -1073,22 +1005,17 @@ int gui_syncpitchscreen_run(void) | |||
1073 | if (global_settings.pitch_mode_semitone) | 1005 | if (global_settings.pitch_mode_semitone) |
1074 | { | 1006 | { |
1075 | semitone = pitch_increase_semitone(pitch, semitone, pitch_delta | 1007 | semitone = pitch_increase_semitone(pitch, semitone, pitch_delta |
1076 | #if CONFIG_CODEC == SWCODEC | ||
1077 | , speed | 1008 | , speed |
1078 | #endif | ||
1079 | ); | 1009 | ); |
1080 | pitch = get_pitch_from_semitone(semitone); | 1010 | pitch = get_pitch_from_semitone(semitone); |
1081 | } | 1011 | } |
1082 | else | 1012 | else |
1083 | { | 1013 | { |
1084 | pitch = pitch_increase(pitch, pitch_delta, true | 1014 | pitch = pitch_increase(pitch, pitch_delta, true |
1085 | #if CONFIG_CODEC == SWCODEC | ||
1086 | , speed | 1015 | , speed |
1087 | #endif | ||
1088 | ); | 1016 | ); |
1089 | semitone = get_semitone_from_pitch(pitch); | 1017 | semitone = get_semitone_from_pitch(pitch); |
1090 | } | 1018 | } |
1091 | #if CONFIG_CODEC == SWCODEC | ||
1092 | if (global_settings.pitch_mode_timestretch) | 1019 | if (global_settings.pitch_mode_timestretch) |
1093 | { | 1020 | { |
1094 | /* do this to make sure we properly obey the stretch limits */ | 1021 | /* do this to make sure we properly obey the stretch limits */ |
@@ -1098,10 +1025,8 @@ int gui_syncpitchscreen_run(void) | |||
1098 | { | 1025 | { |
1099 | speed = pitch; | 1026 | speed = pitch; |
1100 | } | 1027 | } |
1101 | #endif | ||
1102 | } | 1028 | } |
1103 | 1029 | ||
1104 | #if CONFIG_CODEC == SWCODEC | ||
1105 | if(new_speed) | 1030 | if(new_speed) |
1106 | { | 1031 | { |
1107 | new_stretch = GET_STRETCH(pitch, new_speed); | 1032 | new_stretch = GET_STRETCH(pitch, new_speed); |
@@ -1135,11 +1060,8 @@ int gui_syncpitchscreen_run(void) | |||
1135 | /* when needed */ | 1060 | /* when needed */ |
1136 | new_speed = 0; | 1061 | new_speed = 0; |
1137 | } | 1062 | } |
1138 | #endif | ||
1139 | } | 1063 | } |
1140 | #if CONFIG_CODEC == SWCODEC | ||
1141 | pcmbuf_set_low_latency(false); | 1064 | pcmbuf_set_low_latency(false); |
1142 | #endif | ||
1143 | pop_current_activity(); | 1065 | pop_current_activity(); |
1144 | return 0; | 1066 | return 0; |
1145 | } | 1067 | } |
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 7ee349b346..345d74b65c 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -57,9 +57,7 @@ | |||
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | #include "cuesheet.h" | 59 | #include "cuesheet.h" |
60 | #if CONFIG_CODEC == SWCODEC | ||
61 | #include "playback.h" | 60 | #include "playback.h" |
62 | #endif | ||
63 | #include "backdrop.h" | 61 | #include "backdrop.h" |
64 | #include "viewport.h" | 62 | #include "viewport.h" |
65 | #if CONFIG_TUNER | 63 | #if CONFIG_TUNER |
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 50704fd66e..2528a0af55 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c | |||
@@ -47,10 +47,8 @@ | |||
47 | #include "albumart.h" | 47 | #include "albumart.h" |
48 | #endif | 48 | #endif |
49 | #include "playlist.h" | 49 | #include "playlist.h" |
50 | #if CONFIG_CODEC == SWCODEC | ||
51 | #include "playback.h" | 50 | #include "playback.h" |
52 | #include "tdspeed.h" | 51 | #include "tdspeed.h" |
53 | #endif | ||
54 | #include "viewport.h" | 52 | #include "viewport.h" |
55 | #include "tagcache.h" | 53 | #include "tagcache.h" |
56 | 54 | ||
@@ -558,18 +556,16 @@ static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename) | |||
558 | static char filename_buf[MAX_PATH + 1]; | 556 | static char filename_buf[MAX_PATH + 1]; |
559 | fname = playlist_peek(offset, filename_buf, sizeof(filename_buf)); | 557 | fname = playlist_peek(offset, filename_buf, sizeof(filename_buf)); |
560 | *filename = (char*)fname; | 558 | *filename = (char*)fname; |
561 | #if CONFIG_CODEC == SWCODEC | ||
562 | static struct mp3entry tempid3; | 559 | static struct mp3entry tempid3; |
563 | if ( | 560 | if ( |
564 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | 561 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) |
565 | tagcache_fill_tags(&tempid3, fname) || | 562 | tagcache_fill_tags(&tempid3, fname) || |
566 | #endif | 563 | #endif |
567 | audio_peek_track(&tempid3, offset) | 564 | audio_peek_track(&tempid3, offset) |
568 | ) | 565 | ) |
569 | { | 566 | { |
570 | pid3 = &tempid3; | 567 | pid3 = &tempid3; |
571 | } | 568 | } |
572 | #endif | ||
573 | } | 569 | } |
574 | return pid3; | 570 | return pid3; |
575 | } | 571 | } |
@@ -1224,7 +1220,6 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1224 | } | 1220 | } |
1225 | #endif | 1221 | #endif |
1226 | 1222 | ||
1227 | #if (CONFIG_CODEC == SWCODEC) | ||
1228 | case SKIN_TOKEN_CROSSFADE: | 1223 | case SKIN_TOKEN_CROSSFADE: |
1229 | #ifdef HAVE_CROSSFADE | 1224 | #ifdef HAVE_CROSSFADE |
1230 | if (intval) | 1225 | if (intval) |
@@ -1277,7 +1272,6 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1277 | } | 1272 | } |
1278 | return buf; | 1273 | return buf; |
1279 | } | 1274 | } |
1280 | #endif /* (CONFIG_CODEC == SWCODEC) */ | ||
1281 | 1275 | ||
1282 | #if defined (HAVE_PITCHCONTROL) | 1276 | #if defined (HAVE_PITCHCONTROL) |
1283 | case SKIN_TOKEN_SOUND_PITCH: | 1277 | case SKIN_TOKEN_SOUND_PITCH: |
@@ -1294,7 +1288,7 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1294 | } | 1288 | } |
1295 | #endif | 1289 | #endif |
1296 | 1290 | ||
1297 | #if (CONFIG_CODEC == SWCODEC) && defined (HAVE_PITCHCONTROL) | 1291 | #if defined (HAVE_PITCHCONTROL) |
1298 | case SKIN_TOKEN_SOUND_SPEED: | 1292 | case SKIN_TOKEN_SOUND_SPEED: |
1299 | { | 1293 | { |
1300 | int32_t pitch = sound_get_pitch(); | 1294 | int32_t pitch = sound_get_pitch(); |
@@ -1462,7 +1456,6 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1462 | return NULL; | 1456 | return NULL; |
1463 | case SKIN_TOKEN_REC_FREQ: /* order from REC_FREQ_CFG_VAL_LIST */ | 1457 | case SKIN_TOKEN_REC_FREQ: /* order from REC_FREQ_CFG_VAL_LIST */ |
1464 | { | 1458 | { |
1465 | #if CONFIG_CODEC == SWCODEC | ||
1466 | unsigned long samprk; | 1459 | unsigned long samprk; |
1467 | int rec_freq = global_settings.rec_frequency; | 1460 | int rec_freq = global_settings.rec_frequency; |
1468 | 1461 | ||
@@ -1528,26 +1521,8 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1528 | } | 1521 | } |
1529 | } | 1522 | } |
1530 | snprintf(buf, buf_size, "%lu.%1lu", samprk/1000,samprk%1000); | 1523 | snprintf(buf, buf_size, "%lu.%1lu", samprk/1000,samprk%1000); |
1531 | #else /* HWCODEC */ | ||
1532 | |||
1533 | static const char * const freq_strings[] = | ||
1534 | {"--", "44", "48", "32", "22", "24", "16"}; | ||
1535 | int freq = 1 + global_settings.rec_frequency; | ||
1536 | #ifdef HAVE_SPDIF_REC | ||
1537 | if (global_settings.rec_source == AUDIO_SRC_SPDIF) | ||
1538 | { | ||
1539 | /* Can't measure S/PDIF sample rate on Archos/Sim yet */ | ||
1540 | freq = 0; | ||
1541 | } | ||
1542 | #endif /* HAVE_SPDIF_IN */ | ||
1543 | if (intval) | ||
1544 | *intval = freq+1; /* so the token gets a value 1<=x<=7 */ | ||
1545 | snprintf(buf, buf_size, "%s\n", | ||
1546 | freq_strings[global_settings.rec_frequency]); | ||
1547 | #endif | ||
1548 | return buf; | 1524 | return buf; |
1549 | } | 1525 | } |
1550 | #if CONFIG_CODEC == SWCODEC | ||
1551 | case SKIN_TOKEN_REC_ENCODER: | 1526 | case SKIN_TOKEN_REC_ENCODER: |
1552 | { | 1527 | { |
1553 | int rec_format = global_settings.rec_format+1; /* WAV, AIFF, WV, MPEG */ | 1528 | int rec_format = global_settings.rec_format+1; /* WAV, AIFF, WV, MPEG */ |
@@ -1568,9 +1543,7 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1568 | } | 1543 | } |
1569 | break; | 1544 | break; |
1570 | } | 1545 | } |
1571 | #endif | ||
1572 | case SKIN_TOKEN_REC_BITRATE: | 1546 | case SKIN_TOKEN_REC_BITRATE: |
1573 | #if CONFIG_CODEC == SWCODEC | ||
1574 | if (global_settings.rec_format == REC_FORMAT_MPA_L3) | 1547 | if (global_settings.rec_format == REC_FORMAT_MPA_L3) |
1575 | { | 1548 | { |
1576 | if (intval) | 1549 | if (intval) |
@@ -1632,17 +1605,11 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1632 | } | 1605 | } |
1633 | else | 1606 | else |
1634 | return NULL; /* Fixme later */ | 1607 | return NULL; /* Fixme later */ |
1635 | #else /* CONFIG_CODEC == HWCODEC */ | ||
1636 | if (intval) | ||
1637 | *intval = global_settings.rec_quality+1; | ||
1638 | snprintf(buf, buf_size, "%d", global_settings.rec_quality); | ||
1639 | return buf; | ||
1640 | #endif | ||
1641 | case SKIN_TOKEN_REC_MONO: | 1608 | case SKIN_TOKEN_REC_MONO: |
1642 | if (!global_settings.rec_channels) | 1609 | if (!global_settings.rec_channels) |
1643 | return "m"; | 1610 | return "m"; |
1644 | return NULL; | 1611 | return NULL; |
1645 | 1612 | ||
1646 | case SKIN_TOKEN_REC_SECONDS: | 1613 | case SKIN_TOKEN_REC_SECONDS: |
1647 | { | 1614 | { |
1648 | int time = (audio_recorded_time() / HZ) % 60; | 1615 | int time = (audio_recorded_time() / HZ) % 60; |
diff --git a/apps/gui/splash.c b/apps/gui/splash.c index 56df77d57a..fa2c21768a 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c | |||
@@ -199,7 +199,7 @@ void splashf(int ticks, const char *fmt, ...) | |||
199 | 199 | ||
200 | void splash(int ticks, const char *str) | 200 | void splash(int ticks, const char *str) |
201 | { | 201 | { |
202 | #if !defined(SIMULATOR) || CONFIG_CODEC == SWCODEC | 202 | #if !defined(SIMULATOR) |
203 | long id; | 203 | long id; |
204 | /* fmt may be a so called virtual pointer. See settings.h. */ | 204 | /* fmt may be a so called virtual pointer. See settings.h. */ |
205 | if((id = P2ID((const unsigned char*)str)) >= 0) | 205 | if((id = P2ID((const unsigned char*)str)) >= 0) |
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index 90d04a7930..0c8f54f749 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -27,9 +27,7 @@ | |||
27 | #include "sound.h" | 27 | #include "sound.h" |
28 | #include "settings.h" | 28 | #include "settings.h" |
29 | #include "viewport.h" | 29 | #include "viewport.h" |
30 | #if CONFIG_CODEC == SWCODEC | ||
31 | #include "metadata.h" | 30 | #include "metadata.h" |
32 | #endif | ||
33 | #include "icons.h" | 31 | #include "icons.h" |
34 | #include "powermgmt.h" | 32 | #include "powermgmt.h" |
35 | #include "usb.h" | 33 | #include "usb.h" |
@@ -602,7 +600,6 @@ static void gui_statusbar_time(struct screen * display, struct tm *time) | |||
602 | #endif | 600 | #endif |
603 | 601 | ||
604 | #ifdef HAVE_RECORDING | 602 | #ifdef HAVE_RECORDING |
605 | #if CONFIG_CODEC == SWCODEC | ||
606 | /** | 603 | /** |
607 | * Write a number to the display using bitmaps and return new position | 604 | * Write a number to the display using bitmaps and return new position |
608 | */ | 605 | */ |
@@ -650,7 +647,7 @@ static void gui_statusbar_write_format_info(struct screen * display) | |||
650 | xpos += BM_GLYPH_WIDTH; | 647 | xpos += BM_GLYPH_WIDTH; |
651 | } | 648 | } |
652 | } | 649 | } |
653 | 650 | ||
654 | 651 | ||
655 | /* Show bitmap - clipping right edge if needed */ | 652 | /* Show bitmap - clipping right edge if needed */ |
656 | display->mono_bitmap_part(bm, 0, 0, STATUSBAR_ENCODER_WIDTH, | 653 | display->mono_bitmap_part(bm, 0, 0, STATUSBAR_ENCODER_WIDTH, |
@@ -695,58 +692,14 @@ static void gui_statusbar_write_samplerate_info(struct screen * display) | |||
695 | STATUSBAR_Y_POS, BM_GLYPH_WIDTH, | 692 | STATUSBAR_Y_POS, BM_GLYPH_WIDTH, |
696 | STATUSBAR_HEIGHT); | 693 | STATUSBAR_HEIGHT); |
697 | } | 694 | } |
698 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
699 | 695 | ||
700 | static void gui_statusbar_icon_recording_info(struct screen * display) | 696 | static void gui_statusbar_icon_recording_info(struct screen * display) |
701 | { | 697 | { |
702 | #if CONFIG_CODEC != SWCODEC | ||
703 | char buffer[3]; | ||
704 | const char *p = buffer; | ||
705 | int width, height; | ||
706 | display->setfont(FONT_SYSFIXED); | ||
707 | #endif /* CONFIG_CODEC != SWCODEC */ | ||
708 | |||
709 | /* Display Codec info in statusbar */ | 698 | /* Display Codec info in statusbar */ |
710 | #if CONFIG_CODEC == SWCODEC | ||
711 | gui_statusbar_write_format_info(display); | 699 | gui_statusbar_write_format_info(display); |
712 | #else /* !SWCODEC */ | ||
713 | display->mono_bitmap(bitmap_icons_5x8[Icon_q], | ||
714 | STATUSBAR_ENCODER_X_POS + 8, STATUSBAR_Y_POS, | ||
715 | 5, STATUSBAR_HEIGHT); | ||
716 | |||
717 | snprintf(buffer, sizeof(buffer), "%d", global_settings.rec_quality); | ||
718 | display->getstringsize(buffer, &width, &height); | ||
719 | if (height <= STATUSBAR_HEIGHT) | ||
720 | display->putsxy(STATUSBAR_ENCODER_X_POS + 13, STATUSBAR_Y_POS, buffer); | ||
721 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
722 | 700 | ||
723 | /* Display Samplerate info in statusbar */ | 701 | /* Display Samplerate info in statusbar */ |
724 | #if CONFIG_CODEC == SWCODEC | ||
725 | /* SWCODEC targets use bitmaps for glyphs */ | ||
726 | gui_statusbar_write_samplerate_info(display); | 702 | gui_statusbar_write_samplerate_info(display); |
727 | #else /* !SWCODEC */ | ||
728 | /* hwcodec targets have sysfont characters */ | ||
729 | #ifdef HAVE_SPDIF_REC | ||
730 | if (global_settings.rec_source == AUDIO_SRC_SPDIF) | ||
731 | { | ||
732 | /* Can't measure S/PDIF sample rate on Archos/Sim yet */ | ||
733 | p = "--"; | ||
734 | } | ||
735 | else | ||
736 | #endif /* HAVE_SPDIF_IN */ | ||
737 | { | ||
738 | static const char * const freq_strings[] = | ||
739 | {"44", "48", "32", "22", "24", "16"}; | ||
740 | p = freq_strings[global_settings.rec_frequency]; | ||
741 | } | ||
742 | |||
743 | display->getstringsize(p, &width, &height); | ||
744 | |||
745 | if (height <= STATUSBAR_HEIGHT) | ||
746 | display->putsxy(STATUSBAR_RECFREQ_X_POS, STATUSBAR_Y_POS, p); | ||
747 | |||
748 | display->setfont(FONT_UI); | ||
749 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
750 | 703 | ||
751 | /* Display Channel status in status bar */ | 704 | /* Display Channel status in status bar */ |
752 | if(global_settings.rec_channels) | 705 | if(global_settings.rec_channels) |
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 |