forked from len0rd/rockbox
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
This commit is contained in:
parent
47a090105a
commit
6469926b88
4 changed files with 20 additions and 4 deletions
|
@ -102,7 +102,7 @@ MENUITEM_SETTING(crossfade_fade_out_duration,
|
||||||
&global_settings.crossfade_fade_out_duration, setcrossfadeonexit_callback);
|
&global_settings.crossfade_fade_out_duration, setcrossfadeonexit_callback);
|
||||||
MENUITEM_SETTING(crossfade_fade_out_mixmode,
|
MENUITEM_SETTING(crossfade_fade_out_mixmode,
|
||||||
&global_settings.crossfade_fade_out_mixmode,NULL);
|
&global_settings.crossfade_fade_out_mixmode,NULL);
|
||||||
#if MEMORYSIZE > 2
|
#ifdef HAVE_CROSSFADE
|
||||||
MAKE_MENU(crossfade_settings_menu,ID2P(LANG_CROSSFADE),0, Icon_NOICON,
|
MAKE_MENU(crossfade_settings_menu,ID2P(LANG_CROSSFADE),0, Icon_NOICON,
|
||||||
&crossfade, &crossfade_fade_in_delay, &crossfade_fade_in_duration,
|
&crossfade, &crossfade_fade_in_delay, &crossfade_fade_in_duration,
|
||||||
&crossfade_fade_out_delay, &crossfade_fade_out_duration,
|
&crossfade_fade_out_delay, &crossfade_fade_out_duration,
|
||||||
|
@ -187,7 +187,7 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
|
||||||
#endif
|
#endif
|
||||||
&fade_on_stop, &party_mode,
|
&fade_on_stop, &party_mode,
|
||||||
|
|
||||||
#if CONFIG_CODEC == SWCODEC && MEMORYSIZE > 2
|
#if CONFIG_CODEC == SWCODEC && defined(HAVE_CROSSFADE)
|
||||||
&crossfade_settings_menu, &replaygain_settings_menu, &beep,
|
&crossfade_settings_menu, &replaygain_settings_menu, &beep,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -91,11 +91,13 @@ static bool crossfade_init IDATA_ATTR;
|
||||||
|
|
||||||
/* Track the current location for processing crossfade */
|
/* Track the current location for processing crossfade */
|
||||||
static struct pcmbufdesc *crossfade_chunk IDATA_ATTR;
|
static struct pcmbufdesc *crossfade_chunk IDATA_ATTR;
|
||||||
|
#ifdef HAVE_CROSSFADE
|
||||||
static size_t crossfade_sample IDATA_ATTR;
|
static size_t crossfade_sample IDATA_ATTR;
|
||||||
|
|
||||||
/* Counters for fading in new data */
|
/* Counters for fading in new data */
|
||||||
static size_t crossfade_fade_in_total IDATA_ATTR;
|
static size_t crossfade_fade_in_total IDATA_ATTR;
|
||||||
static size_t crossfade_fade_in_rem IDATA_ATTR;
|
static size_t crossfade_fade_in_rem IDATA_ATTR;
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct pcmbufdesc *pcmbuf_read IDATA_ATTR;
|
static struct pcmbufdesc *pcmbuf_read IDATA_ATTR;
|
||||||
static struct pcmbufdesc *pcmbuf_read_end IDATA_ATTR;
|
static struct pcmbufdesc *pcmbuf_read_end IDATA_ATTR;
|
||||||
|
@ -543,6 +545,11 @@ static bool pcmbuf_flush_fillpos(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Low memory targets don't have crossfade, so don't compile crossfade
|
||||||
|
* specific code in order to save some memory. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CROSSFADE
|
||||||
/**
|
/**
|
||||||
* Completely process the crossfade fade out effect with current pcm buffer.
|
* Completely process the crossfade fade out effect with current pcm buffer.
|
||||||
*/
|
*/
|
||||||
|
@ -824,6 +831,7 @@ fade_done:
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool prepare_insert(size_t length)
|
static bool prepare_insert(size_t length)
|
||||||
{
|
{
|
||||||
|
@ -862,8 +870,10 @@ static bool prepare_insert(size_t length)
|
||||||
|
|
||||||
void* pcmbuf_request_buffer(int *count)
|
void* pcmbuf_request_buffer(int *count)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_CROSSFADE
|
||||||
if (crossfade_init)
|
if (crossfade_init)
|
||||||
crossfade_start();
|
crossfade_start();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (crossfade_active) {
|
if (crossfade_active) {
|
||||||
*count = MIN(*count, PCMBUF_MIX_CHUNK/4);
|
*count = MIN(*count, PCMBUF_MIX_CHUNK/4);
|
||||||
|
@ -929,7 +939,7 @@ bool pcmbuf_is_crossfade_active(void)
|
||||||
void pcmbuf_write_complete(int count)
|
void pcmbuf_write_complete(int count)
|
||||||
{
|
{
|
||||||
size_t length = (size_t)(unsigned int)count << 2;
|
size_t length = (size_t)(unsigned int)count << 2;
|
||||||
|
#ifdef HAVE_CROSSFADE
|
||||||
if (crossfade_active)
|
if (crossfade_active)
|
||||||
{
|
{
|
||||||
flush_crossfade(fadebuf, length);
|
flush_crossfade(fadebuf, length);
|
||||||
|
@ -937,6 +947,7 @@ void pcmbuf_write_complete(int count)
|
||||||
crossfade_active = false;
|
crossfade_active = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
audiobuffer_fillpos += length;
|
audiobuffer_fillpos += length;
|
||||||
|
|
||||||
|
|
|
@ -1129,7 +1129,7 @@ const struct settings_list settings[] = {
|
||||||
NULL, 4, ID2P(LANG_OFF), ID2P(LANG_WEAK),
|
NULL, 4, ID2P(LANG_OFF), ID2P(LANG_WEAK),
|
||||||
ID2P(LANG_MODERATE), ID2P(LANG_STRONG)),
|
ID2P(LANG_MODERATE), ID2P(LANG_STRONG)),
|
||||||
|
|
||||||
#if MEMORYSIZE > 2
|
#ifdef HAVE_CROSSFADE
|
||||||
/* crossfade */
|
/* crossfade */
|
||||||
CHOICE_SETTING(F_SOUNDSETTING, crossfade, LANG_CROSSFADE_ENABLE, 0,
|
CHOICE_SETTING(F_SOUNDSETTING, crossfade, LANG_CROSSFADE_ENABLE, 0,
|
||||||
"crossfade",
|
"crossfade",
|
||||||
|
|
|
@ -139,6 +139,11 @@
|
||||||
* for example in hardware, but not controllable*/
|
* for example in hardware, but not controllable*/
|
||||||
#define BACKLIGHT_FADING_TARGET 0x8
|
#define BACKLIGHT_FADING_TARGET 0x8
|
||||||
|
|
||||||
|
/*include support for crossfading - requires significant PCM buffer space*/
|
||||||
|
#if MEMORYSIZE > 2
|
||||||
|
#define HAVE_CROSSFADE
|
||||||
|
#endif
|
||||||
|
|
||||||
/* CONFIG_CHARGING */
|
/* CONFIG_CHARGING */
|
||||||
|
|
||||||
/* Generic types */
|
/* Generic types */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue