summaryrefslogtreecommitdiff
path: root/apps/wps.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-10-29 12:09:15 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-10-29 12:09:15 +0000
commitfd0cc3b2b1302d77f3404861509e75c64fd505af (patch)
treeacdb25b87a549908424e052c04cc323d02b681f4 /apps/wps.c
parent8f11dc00ac1a0a5fe009d1d07d9a1378c3300ba8 (diff)
downloadrockbox-fd0cc3b2b1302d77f3404861509e75c64fd505af.tar.gz
rockbox-fd0cc3b2b1302d77f3404861509e75c64fd505af.zip
Phil Pertermann's dB peak meter patch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2774 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/wps.c')
-rw-r--r--apps/wps.c62
1 files changed, 46 insertions, 16 deletions
diff --git a/apps/wps.c b/apps/wps.c
index 3e48333818..8f9295a293 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -68,7 +68,7 @@ void player_change_volume(int button)
68 if(global_settings.volume > mpeg_sound_max(SOUND_VOLUME)) 68 if(global_settings.volume > mpeg_sound_max(SOUND_VOLUME))
69 global_settings.volume = mpeg_sound_max(SOUND_VOLUME); 69 global_settings.volume = mpeg_sound_max(SOUND_VOLUME);
70 mpeg_sound_set(SOUND_VOLUME, global_settings.volume); 70 mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
71 wps_refresh(id3,0,false); 71 wps_refresh(id3, 0, WPS_REFRESH_NON_STATIC);
72 settings_save(); 72 settings_save();
73 break; 73 break;
74 74
@@ -78,7 +78,7 @@ void player_change_volume(int button)
78 if(global_settings.volume < mpeg_sound_min(SOUND_VOLUME)) 78 if(global_settings.volume < mpeg_sound_min(SOUND_VOLUME))
79 global_settings.volume = mpeg_sound_min(SOUND_VOLUME); 79 global_settings.volume = mpeg_sound_min(SOUND_VOLUME);
80 mpeg_sound_set(SOUND_VOLUME, global_settings.volume); 80 mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
81 wps_refresh(id3,0,false); 81 wps_refresh(id3, 0, WPS_REFRESH_NON_STATIC);
82 settings_save(); 82 settings_save();
83 break; 83 break;
84 84
@@ -100,7 +100,7 @@ void player_change_volume(int button)
100 button = button_get(true); 100 button = button_get(true);
101 } 101 }
102 status_draw(); 102 status_draw();
103 wps_refresh(id3,0,true); 103 wps_refresh(id3,0, WPS_REFRESH_ALL);
104} 104}
105#endif 105#endif
106 106
@@ -366,9 +366,9 @@ static bool ffwd_rew(int button)
366 } 366 }
367 367
368 if(wps_time_countup == false) 368 if(wps_time_countup == false)
369 wps_refresh(id3, -ff_rewind_count, false); 369 wps_refresh(id3, -ff_rewind_count, WPS_REFRESH_PLAYER_PROGRESS);
370 else 370 else
371 wps_refresh(id3, ff_rewind_count, false); 371 wps_refresh(id3, ff_rewind_count, WPS_REFRESH_PLAYER_PROGRESS);
372 372
373 break; 373 break;
374 374
@@ -399,7 +399,7 @@ static bool ffwd_rew(int button)
399 if (!exit) 399 if (!exit)
400 button = button_get(true); 400 button = button_get(true);
401 } 401 }
402 wps_refresh(id3,0,true); 402 wps_refresh(id3, 0, WPS_REFRESH_ALL);
403 return usb; 403 return usb;
404} 404}
405 405
@@ -415,11 +415,11 @@ static bool update(void)
415 if (wps_display(id3)) 415 if (wps_display(id3))
416 retcode = true; 416 retcode = true;
417 else 417 else
418 wps_refresh(id3,0,true); 418 wps_refresh(id3, 0, WPS_REFRESH_ALL);
419 } 419 }
420 420
421 if (id3) 421 if (id3)
422 wps_refresh(id3,0,false); 422 wps_refresh(id3, 0, WPS_REFRESH_NON_STATIC);
423 423
424 status_draw(); 424 status_draw();
425 425
@@ -453,7 +453,7 @@ static bool keylock(void)
453#endif 453#endif
454 display_keylock_text(true); 454 display_keylock_text(true);
455 keys_locked = true; 455 keys_locked = true;
456 wps_refresh(id3,0,true); 456 wps_refresh(id3, 0, WPS_REFRESH_ALL);
457 if (wps_display(id3)) { 457 if (wps_display(id3)) {
458 keys_locked = false; 458 keys_locked = false;
459#ifdef HAVE_LCD_CHARCELLS 459#ifdef HAVE_LCD_CHARCELLS
@@ -511,7 +511,7 @@ static bool keylock(void)
511 default: 511 default:
512 display_keylock_text(true); 512 display_keylock_text(true);
513 while (button_get(false)); /* clear button queue */ 513 while (button_get(false)); /* clear button queue */
514 wps_refresh(id3,0,true); 514 wps_refresh(id3, 0, WPS_REFRESH_ALL);
515 if (wps_display(id3)) { 515 if (wps_display(id3)) {
516 keys_locked = false; 516 keys_locked = false;
517#ifdef HAVE_LCD_CHARCELLS 517#ifdef HAVE_LCD_CHARCELLS
@@ -628,7 +628,7 @@ static bool menu(void)
628#endif 628#endif
629 629
630 wps_display(id3); 630 wps_display(id3);
631 wps_refresh(id3,0,true); 631 wps_refresh(id3, 0, WPS_REFRESH_ALL);
632 return false; 632 return false;
633} 633}
634 634
@@ -659,7 +659,7 @@ int wps_show(void)
659 if (id3) { 659 if (id3) {
660 if (wps_display(id3)) 660 if (wps_display(id3))
661 return 0; 661 return 0;
662 wps_refresh(id3,0,true); 662 wps_refresh(id3, 0, WPS_REFRESH_ALL);
663 } 663 }
664 restore = true; 664 restore = true;
665 } 665 }
@@ -674,14 +674,44 @@ int wps_show(void)
674 isn't displayed */ 674 isn't displayed */
675 if (peak_meter_enabled) { 675 if (peak_meter_enabled) {
676 int i; 676 int i;
677
678 /* In high performance mode we read out the mas as
679 often as we can. There is no sleep for cpu */
680 if (global_settings.peak_meter_performance) {
681 long next_refresh = current_tick;
682 long next_big_refresh = current_tick + HZ / 5;
683 button = BUTTON_NONE;
684 while (!TIME_AFTER(current_tick, next_big_refresh)) {
685 button = button_get(false);
686 if (button != BUTTON_NONE) {
687 break;
688 }
689 peak_meter_peek();
690 yield();
691
692 if (TIME_AFTER(current_tick, next_refresh)) {
693 wps_refresh(id3, 0, WPS_REFRESH_PEAK_METER);
694 next_refresh = current_tick + HZ / peak_meter_fps;
695 }
696 }
697 }
698
699 /* In energy saver mode the cpu may sleep a
700 little bit while waiting for buttons */
701 else {
677 for (i = 0; i < 4; i++) { 702 for (i = 0; i < 4; i++) {
678 button = button_get_w_tmo(HZ / 20); 703 button = button_get_w_tmo(HZ / peak_meter_fps);
679 if (button != 0) { 704 if (button != 0) {
680 break; 705 break;
681 } 706 }
682 wps_refresh(id3, 0, false); 707 wps_refresh(id3, 0, WPS_REFRESH_PEAK_METER);
708 }
683 } 709 }
684 } else { 710 }
711
712 /* The peak meter is disabled
713 -> no additional screen updates needed */
714 else {
685 button = button_get_w_tmo(HZ/5); 715 button = button_get_w_tmo(HZ/5);
686 } 716 }
687#else 717#else
@@ -880,7 +910,7 @@ int wps_show(void)
880 if (wps_display(id3)) 910 if (wps_display(id3))
881 return 0; 911 return 0;
882 if (id3) 912 if (id3)
883 wps_refresh(id3,0,false); 913 wps_refresh(id3, 0, WPS_REFRESH_NON_STATIC);
884 } 914 }
885 if(button != BUTTON_NONE) 915 if(button != BUTTON_NONE)
886 lastbutton = button; 916 lastbutton = button;