diff options
author | Michael Giacomelli <giac2000@hotmail.com> | 2009-08-11 02:05:38 +0000 |
---|---|---|
committer | Michael Giacomelli <giac2000@hotmail.com> | 2009-08-11 02:05:38 +0000 |
commit | 6469926b889f1533134233c63c894ac471f2f53c (patch) | |
tree | b1d0cfce47546917e49dbf4607216770f5bda721 /apps | |
parent | 47a090105adac2c7d63165a28f46126df08ce494 (diff) | |
download | rockbox-6469926b889f1533134233c63c894ac471f2f53c.tar.gz rockbox-6469926b889f1533134233c63c894ac471f2f53c.zip |
FS#10506. Don't compile various crossfade only functions in pcmbuf.c on low memory targets (mainly AMS) to save memory. Some crossfade related items remain in the code, but they're not worth cluttering the code with ifdefs over. Also, introduce HAVE_CROSSFADE define for neatness.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22248 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/menus/playback_menu.c | 4 | ||||
-rw-r--r-- | apps/pcmbuf.c | 13 | ||||
-rw-r--r-- | apps/settings_list.c | 2 |
3 files changed, 15 insertions, 4 deletions
diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c index e6298b95bb..d7f9aeef56 100644 --- a/apps/menus/playback_menu.c +++ b/apps/menus/playback_menu.c | |||
@@ -102,7 +102,7 @@ MENUITEM_SETTING(crossfade_fade_out_duration, | |||
102 | &global_settings.crossfade_fade_out_duration, setcrossfadeonexit_callback); | 102 | &global_settings.crossfade_fade_out_duration, setcrossfadeonexit_callback); |
103 | MENUITEM_SETTING(crossfade_fade_out_mixmode, | 103 | MENUITEM_SETTING(crossfade_fade_out_mixmode, |
104 | &global_settings.crossfade_fade_out_mixmode,NULL); | 104 | &global_settings.crossfade_fade_out_mixmode,NULL); |
105 | #if MEMORYSIZE > 2 | 105 | #ifdef HAVE_CROSSFADE |
106 | MAKE_MENU(crossfade_settings_menu,ID2P(LANG_CROSSFADE),0, Icon_NOICON, | 106 | MAKE_MENU(crossfade_settings_menu,ID2P(LANG_CROSSFADE),0, Icon_NOICON, |
107 | &crossfade, &crossfade_fade_in_delay, &crossfade_fade_in_duration, | 107 | &crossfade, &crossfade_fade_in_delay, &crossfade_fade_in_duration, |
108 | &crossfade_fade_out_delay, &crossfade_fade_out_duration, | 108 | &crossfade_fade_out_delay, &crossfade_fade_out_duration, |
@@ -187,7 +187,7 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, | |||
187 | #endif | 187 | #endif |
188 | &fade_on_stop, &party_mode, | 188 | &fade_on_stop, &party_mode, |
189 | 189 | ||
190 | #if CONFIG_CODEC == SWCODEC && MEMORYSIZE > 2 | 190 | #if CONFIG_CODEC == SWCODEC && defined(HAVE_CROSSFADE) |
191 | &crossfade_settings_menu, &replaygain_settings_menu, &beep, | 191 | &crossfade_settings_menu, &replaygain_settings_menu, &beep, |
192 | #endif | 192 | #endif |
193 | 193 | ||
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index b8d8a0c8d0..e23f6d0fb6 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c | |||
@@ -91,11 +91,13 @@ static bool crossfade_init IDATA_ATTR; | |||
91 | 91 | ||
92 | /* Track the current location for processing crossfade */ | 92 | /* Track the current location for processing crossfade */ |
93 | static struct pcmbufdesc *crossfade_chunk IDATA_ATTR; | 93 | static struct pcmbufdesc *crossfade_chunk IDATA_ATTR; |
94 | #ifdef HAVE_CROSSFADE | ||
94 | static size_t crossfade_sample IDATA_ATTR; | 95 | static size_t crossfade_sample IDATA_ATTR; |
95 | 96 | ||
96 | /* Counters for fading in new data */ | 97 | /* Counters for fading in new data */ |
97 | static size_t crossfade_fade_in_total IDATA_ATTR; | 98 | static size_t crossfade_fade_in_total IDATA_ATTR; |
98 | static size_t crossfade_fade_in_rem IDATA_ATTR; | 99 | static size_t crossfade_fade_in_rem IDATA_ATTR; |
100 | #endif | ||
99 | 101 | ||
100 | static struct pcmbufdesc *pcmbuf_read IDATA_ATTR; | 102 | static struct pcmbufdesc *pcmbuf_read IDATA_ATTR; |
101 | static struct pcmbufdesc *pcmbuf_read_end IDATA_ATTR; | 103 | static struct pcmbufdesc *pcmbuf_read_end IDATA_ATTR; |
@@ -543,6 +545,11 @@ static bool pcmbuf_flush_fillpos(void) | |||
543 | return false; | 545 | return false; |
544 | } | 546 | } |
545 | 547 | ||
548 | /** | ||
549 | * Low memory targets don't have crossfade, so don't compile crossfade | ||
550 | * specific code in order to save some memory. */ | ||
551 | |||
552 | #ifdef HAVE_CROSSFADE | ||
546 | /** | 553 | /** |
547 | * Completely process the crossfade fade out effect with current pcm buffer. | 554 | * Completely process the crossfade fade out effect with current pcm buffer. |
548 | */ | 555 | */ |
@@ -824,6 +831,7 @@ fade_done: | |||
824 | } | 831 | } |
825 | 832 | ||
826 | } | 833 | } |
834 | #endif | ||
827 | 835 | ||
828 | static bool prepare_insert(size_t length) | 836 | static bool prepare_insert(size_t length) |
829 | { | 837 | { |
@@ -862,8 +870,10 @@ static bool prepare_insert(size_t length) | |||
862 | 870 | ||
863 | void* pcmbuf_request_buffer(int *count) | 871 | void* pcmbuf_request_buffer(int *count) |
864 | { | 872 | { |
873 | #ifdef HAVE_CROSSFADE | ||
865 | if (crossfade_init) | 874 | if (crossfade_init) |
866 | crossfade_start(); | 875 | crossfade_start(); |
876 | #endif | ||
867 | 877 | ||
868 | if (crossfade_active) { | 878 | if (crossfade_active) { |
869 | *count = MIN(*count, PCMBUF_MIX_CHUNK/4); | 879 | *count = MIN(*count, PCMBUF_MIX_CHUNK/4); |
@@ -929,7 +939,7 @@ bool pcmbuf_is_crossfade_active(void) | |||
929 | void pcmbuf_write_complete(int count) | 939 | void pcmbuf_write_complete(int count) |
930 | { | 940 | { |
931 | size_t length = (size_t)(unsigned int)count << 2; | 941 | size_t length = (size_t)(unsigned int)count << 2; |
932 | 942 | #ifdef HAVE_CROSSFADE | |
933 | if (crossfade_active) | 943 | if (crossfade_active) |
934 | { | 944 | { |
935 | flush_crossfade(fadebuf, length); | 945 | flush_crossfade(fadebuf, length); |
@@ -937,6 +947,7 @@ void pcmbuf_write_complete(int count) | |||
937 | crossfade_active = false; | 947 | crossfade_active = false; |
938 | } | 948 | } |
939 | else | 949 | else |
950 | #endif | ||
940 | { | 951 | { |
941 | audiobuffer_fillpos += length; | 952 | audiobuffer_fillpos += length; |
942 | 953 | ||
diff --git a/apps/settings_list.c b/apps/settings_list.c index 71fbecc621..c03731f2b7 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -1129,7 +1129,7 @@ const struct settings_list settings[] = { | |||
1129 | NULL, 4, ID2P(LANG_OFF), ID2P(LANG_WEAK), | 1129 | NULL, 4, ID2P(LANG_OFF), ID2P(LANG_WEAK), |
1130 | ID2P(LANG_MODERATE), ID2P(LANG_STRONG)), | 1130 | ID2P(LANG_MODERATE), ID2P(LANG_STRONG)), |
1131 | 1131 | ||
1132 | #if MEMORYSIZE > 2 | 1132 | #ifdef HAVE_CROSSFADE |
1133 | /* crossfade */ | 1133 | /* crossfade */ |
1134 | CHOICE_SETTING(F_SOUNDSETTING, crossfade, LANG_CROSSFADE_ENABLE, 0, | 1134 | CHOICE_SETTING(F_SOUNDSETTING, crossfade, LANG_CROSSFADE_ENABLE, 0, |
1135 | "crossfade", | 1135 | "crossfade", |