forked from len0rd/rockbox
Volume fade patch by Eric Linenberg
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3263 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
84eb9ce4a8
commit
e2628d9931
6 changed files with 74 additions and 4 deletions
|
|
@ -1391,3 +1391,8 @@ id: LANG_SETTINGS_LOADED2
|
|||
desc: Feedback shown when a .cfg file is loaded
|
||||
eng: "loaded"
|
||||
new:
|
||||
|
||||
id: LANG_FADE_ON_STOP
|
||||
decs: options menu to set fade on stop or pause
|
||||
eng: "Fade On Stop/Pause"
|
||||
new:
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ modified unless the header & checksum test fails.
|
|||
|
||||
|
||||
Rest of config block, only saved to disk:
|
||||
0xAE fade on pause/unpause/stop setting (bit 0)
|
||||
0xB0 peak meter clip hold timeout (bit 0-4)
|
||||
0xB1 peak meter release step size, peak_meter_dbfs (bit 7)
|
||||
0xB2 peak meter min either in -db or in percent
|
||||
|
|
@ -368,7 +369,8 @@ int settings_save( void )
|
|||
config_block[0x28]=(unsigned char)(global_settings.topruntime & 0xff);
|
||||
config_block[0x29]=(unsigned char)(global_settings.topruntime >> 8);
|
||||
}
|
||||
|
||||
|
||||
config_block[0xae] = (unsigned char)global_settings.fade_on_stop;
|
||||
config_block[0xb0] = (unsigned char)global_settings.peak_meter_clip_hold |
|
||||
(global_settings.peak_meter_performance ? 0x80 : 0);
|
||||
config_block[0xb1] = global_settings.peak_meter_release |
|
||||
|
|
@ -651,6 +653,8 @@ void settings_load(void)
|
|||
global_settings.topruntime =
|
||||
config_block[0x28] | (config_block[0x29] << 8);
|
||||
|
||||
global_settings.fade_on_stop=config_block[0xae];
|
||||
|
||||
global_settings.peak_meter_clip_hold = (config_block[0xb0]) & 0x1f;
|
||||
global_settings.peak_meter_performance =
|
||||
(config_block[0xb0] & 0x80) != 0;
|
||||
|
|
@ -672,6 +676,9 @@ void settings_load(void)
|
|||
if (config_block[0xb7] != 0xff)
|
||||
global_settings.bidir_limit = config_block[0xb7];
|
||||
|
||||
if (config_block[0xae] != 0xff)
|
||||
global_settings.fade_on_stop = config_block[0xae];
|
||||
|
||||
memcpy(&global_settings.resume_first_index, &config_block[0xF4], 4);
|
||||
memcpy(&global_settings.resume_seed, &config_block[0xF8], 4);
|
||||
|
||||
|
|
@ -980,6 +987,8 @@ bool settings_load_config(char* file)
|
|||
else if (!strcasecmp(name, "trickle charge"))
|
||||
set_cfg_bool(&global_settings.trickle_charge, value);
|
||||
#endif
|
||||
else if (!strcasecmp(name, "volume fade"))
|
||||
set_cfg_bool(&global_settings.fade_on_stop, value);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
|
@ -1057,6 +1066,7 @@ void settings_reset(void) {
|
|||
global_settings.runtime = 0;
|
||||
global_settings.topruntime = 0;
|
||||
global_settings.cpu_sleep = true;
|
||||
global_settings.fade_on_stop = true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ struct user_settings
|
|||
int scroll_step; /* pixels to advance per update */
|
||||
|
||||
bool cpu_sleep; /* Use sleep instruction when idle? */
|
||||
bool fade_on_stop; /* fade on pause/unpause/stop */
|
||||
};
|
||||
|
||||
/* prototypes */
|
||||
|
|
|
|||
|
|
@ -565,6 +565,12 @@ static bool ff_rewind_min_step(void)
|
|||
names, 14, NULL );
|
||||
}
|
||||
|
||||
static bool set_fade_on_stop(void)
|
||||
{
|
||||
return set_bool( str(LANG_FADE_ON_STOP), &global_settings.fade_on_stop );
|
||||
}
|
||||
|
||||
|
||||
static bool ff_rewind_accel(void)
|
||||
{
|
||||
char* names[] = { str(LANG_OFF), "2x/1s", "2x/2s", "2x/3s",
|
||||
|
|
@ -594,6 +600,7 @@ static bool playback_settings_menu(void)
|
|||
{ str(LANG_FFRW_STEP), ff_rewind_min_step },
|
||||
{ str(LANG_FFRW_ACCEL), ff_rewind_accel },
|
||||
{ str(LANG_MP3BUFFER_MARGIN), buffer_margin },
|
||||
{ str(LANG_FADE_ON_STOP), set_fade_on_stop },
|
||||
};
|
||||
|
||||
bool old_shuffle = global_settings.playlist_shuffle;
|
||||
|
|
|
|||
52
apps/wps.c
52
apps/wps.c
|
|
@ -665,6 +665,43 @@ static bool menu(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
static void fade(bool fade_in)
|
||||
{
|
||||
if (fade_in) {
|
||||
/* fade in */
|
||||
int current_volume = 20;
|
||||
|
||||
/* zero out the sound */
|
||||
mpeg_sound_set(SOUND_VOLUME, current_volume);
|
||||
|
||||
mpeg_resume();
|
||||
sleep(1); /* let mpeg thread run */
|
||||
|
||||
while (current_volume < global_settings.volume) {
|
||||
current_volume += 2;
|
||||
sleep(1);
|
||||
mpeg_sound_set(SOUND_VOLUME, current_volume);
|
||||
}
|
||||
mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
|
||||
}
|
||||
else {
|
||||
/* fade out */
|
||||
int current_volume = global_settings.volume;
|
||||
|
||||
while (current_volume > 20) {
|
||||
current_volume -= 2;
|
||||
sleep(1);
|
||||
mpeg_sound_set(SOUND_VOLUME, current_volume);
|
||||
}
|
||||
mpeg_pause();
|
||||
sleep(1); /* let mpeg thread run */
|
||||
|
||||
/* reset volume to what it was before the fade */
|
||||
mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* demonstrates showing different formats from playtune */
|
||||
int wps_show(void)
|
||||
{
|
||||
|
|
@ -801,15 +838,21 @@ int wps_show(void)
|
|||
case BUTTON_PLAY:
|
||||
if ( paused )
|
||||
{
|
||||
mpeg_resume();
|
||||
paused = false;
|
||||
status_set_playmode(STATUS_PLAY);
|
||||
if ( global_settings.fade_on_stop )
|
||||
fade(1);
|
||||
else
|
||||
mpeg_resume();
|
||||
}
|
||||
else
|
||||
{
|
||||
mpeg_pause();
|
||||
paused = true;
|
||||
status_set_playmode(STATUS_PAUSE);
|
||||
if ( global_settings.fade_on_stop )
|
||||
fade(0);
|
||||
else
|
||||
mpeg_pause();
|
||||
if (global_settings.resume) {
|
||||
settings_save();
|
||||
#ifndef HAVE_RTC
|
||||
|
|
@ -915,7 +958,7 @@ int wps_show(void)
|
|||
|
||||
/* stop and exit wps */
|
||||
#ifdef HAVE_RECORDER_KEYPAD
|
||||
case BUTTON_OFF | BUTTON_REL:
|
||||
case BUTTON_OFF:
|
||||
#else
|
||||
case BUTTON_STOP | BUTTON_REL:
|
||||
if ( lastbutton != BUTTON_STOP )
|
||||
|
|
@ -947,6 +990,9 @@ int wps_show(void)
|
|||
status_set_record(false);
|
||||
status_set_audio(false);
|
||||
#endif
|
||||
if (global_settings.fade_on_stop)
|
||||
fade(0);
|
||||
|
||||
lcd_stop_scroll();
|
||||
mpeg_stop();
|
||||
status_set_playmode(STATUS_STOP);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ resume (off, ask, on)
|
|||
scan min step (1, 2, 3, 4, 5, 6, 8, 10, 15, 20, 25) [seconds]
|
||||
scan accel (0 - 15) [double scan speed every X seconds]
|
||||
antiskip (0 - 7) [seconds]
|
||||
volume fade (on, off)
|
||||
|
||||
sort case (on, off)
|
||||
show files (all, supported, music)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue